Create x11_save_last_used_monitor

This commit is contained in:
twinaphex 2015-12-01 08:49:35 +01:00
parent c4354ff429
commit 6c6beca430
4 changed files with 21 additions and 32 deletions

View File

@ -597,3 +597,21 @@ void x11_event_queue_check(XEvent *event)
{
XIfEvent(g_x11_dpy, event, x11_wait_notify, NULL);
}
void x11_save_last_used_monitor(Window win)
{
#ifdef HAVE_XINERAMA
XWindowAttributes target;
Window child;
int x = 0, y = 0;
XGetWindowAttributes(g_x11_dpy, g_x11_win, &target);
XTranslateCoordinates(g_x11_dpy, g_x11_win, DefaultRootWindow(g_x11_dpy),
target.x, target.y, &x, &y, &child);
g_x11_screen = x11_get_xinerama_monitor(g_x11_dpy, x, y,
target.width, target.height);
RARCH_LOG("[X11]: Saved monitor #%u.\n", g_x11_screen);
#endif
}

View File

@ -40,6 +40,7 @@ extern Display *g_x11_dpy;
extern Colormap g_x11_cmap;
extern unsigned g_x11_screen;
void x11_save_last_used_monitor(Window win);
void x11_show_mouse(Display *dpy, Window win, bool state);
void x11_windowed_fullscreen(Display *dpy, Window win);
void x11_suspend_screensaver(Window win);

View File

@ -89,23 +89,7 @@ static void ctx_glx_destroy_resources(gfx_ctx_glx_data_t *glx)
glx->g_glx_win = 0;
/* Save last used monitor for later. */
#ifdef HAVE_XINERAMA
{
XWindowAttributes target;
Window child;
int x = 0, y = 0;
XGetWindowAttributes(g_x11_dpy, g_x11_win, &target);
XTranslateCoordinates(g_x11_dpy, g_x11_win, DefaultRootWindow(g_x11_dpy),
target.x, target.y, &x, &y, &child);
g_x11_screen = x11_get_xinerama_monitor(g_x11_dpy, x, y,
target.width, target.height);
RARCH_LOG("[GLX]: Saved monitor #%u.\n", g_x11_screen);
}
#endif
x11_save_last_used_monitor(DefaultRootWindow(g_x11_dpy));
x11_window_destroy(false);
}

View File

@ -48,21 +48,7 @@ static void gfx_ctx_xegl_destroy(void *data)
if (g_x11_win)
{
/* Save last used monitor for later. */
#ifdef HAVE_XINERAMA
XWindowAttributes target;
Window child;
int x = 0, y = 0;
XGetWindowAttributes(g_x11_dpy, g_x11_win, &target);
XTranslateCoordinates(g_x11_dpy, g_x11_win, RootWindow(g_x11_dpy, DefaultScreen(g_x11_dpy)),
target.x, target.y, &x, &y, &child);
g_x11_screen = x11_get_xinerama_monitor(g_x11_dpy, x, y,
target.width, target.height);
RARCH_LOG("[X/EGL]: Saved monitor #%u.\n", g_x11_screen);
#endif
x11_save_last_used_monitor(RootWindow(g_x11_dpy, DefaultScreen(g_x11_dpy)));
x11_window_destroy(false);
}