diff --git a/gfx/context/glx_ctx.c b/gfx/context/glx_ctx.c index cab05e1614..8f576fb147 100644 --- a/gfx/context/glx_ctx.c +++ b/gfx/context/glx_ctx.c @@ -33,6 +33,7 @@ static Window g_win; static Colormap g_cmap; static Atom g_quit_atom; static bool g_has_focus; +static bool g_true_full; static unsigned g_screen; static GLXContext g_ctx; @@ -366,9 +367,8 @@ static bool gfx_ctx_set_video_mode( driver.display_type = RARCH_DISPLAY_X11; driver.video_display = (uintptr_t)g_dpy; - - // Always assume that we have focus in true fullscreen. - driver.video_window = true_full ? (uintptr_t)None : (uintptr_t)g_win; + driver.video_window = (uintptr_t)g_win; + g_true_full = true_full; return true; @@ -449,7 +449,7 @@ static bool gfx_ctx_has_focus(void) int rev; XGetInputFocus(g_dpy, &win, &rev); - return (win == g_win && g_has_focus) || (g_win == None); + return (win == g_win && g_has_focus) || g_true_full; } static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol) diff --git a/gfx/context/xegl_ctx.c b/gfx/context/xegl_ctx.c index 587ccfde53..eb4c15a055 100644 --- a/gfx/context/xegl_ctx.c +++ b/gfx/context/xegl_ctx.c @@ -35,6 +35,7 @@ static Window g_win; static Colormap g_cmap; static Atom g_quit_atom; static bool g_has_focus; +static bool g_true_full; static unsigned g_screen; static EGLContext g_egl_ctx; @@ -385,9 +386,8 @@ static bool gfx_ctx_set_video_mode( driver.display_type = RARCH_DISPLAY_X11; driver.video_display = (uintptr_t)g_dpy; - - // Always assume that we have focus in true fullscreen. - driver.video_window = true_full ? (uintptr_t)None : (uintptr_t)g_win; + driver.video_window = (uintptr_t)g_win; + g_true_full = true_full; return true; @@ -479,7 +479,7 @@ static bool gfx_ctx_has_focus(void) int rev; XGetInputFocus(g_dpy, &win, &rev); - return (win == g_win && g_has_focus) || (g_win == None); + return (win == g_win && g_has_focus) || g_true_full; } static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol) diff --git a/input/x11_input.c b/input/x11_input.c index da590a1eae..6d28c3ee64 100644 --- a/input/x11_input.c +++ b/input/x11_input.c @@ -277,12 +277,8 @@ static void x_input_poll_mouse(x11_input_t *x11) x11->mouse_last_x = x11->mouse_x; x11->mouse_last_y = x11->mouse_y; - Window win = x11->win; - if (win == None) - win = RootWindow(x11->display, DefaultScreen(x11->display)); - XQueryPointer(x11->display, - win, + x11->win, &root_win, &child_win, &root_x, &root_y, &win_x, &win_y, @@ -299,11 +295,7 @@ static void x_input_poll(void *data) { x11_input_t *x11 = (x11_input_t*)data; - Window win = None; - int rev = 0; - XGetInputFocus(x11->display, &win, &rev); - - if (win == x11->win || x11->win == None) + if (video_focus_func()) XQueryKeymap(x11->display, x11->state); else memset(x11->state, 0, sizeof(x11->state));