From 3f23a23deadb79fdd2b802bd7097c365a6c4425c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 19 Nov 2015 09:51:20 +0100 Subject: [PATCH] move g_has_focus to x11_common.c --- gfx/common/x11_common.c | 5 +++-- gfx/common/x11_common.h | 5 +++-- gfx/drivers_context/glx_ctx.c | 9 ++++----- gfx/drivers_context/xegl_ctx.c | 9 ++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/gfx/common/x11_common.c b/gfx/common/x11_common.c index 161a83b752..61827e4864 100644 --- a/gfx/common/x11_common.c +++ b/gfx/common/x11_common.c @@ -29,8 +29,9 @@ static Atom XA_NET_WM_STATE; static Atom XA_NET_WM_STATE_FULLSCREEN; static Atom XA_NET_MOVERESIZE_WINDOW; -Atom g_quit_atom; -volatile sig_atomic_t g_quit; +Atom g_x11_quit_atom; +volatile sig_atomic_t g_x11_quit; +bool g_x11_has_focus; #define XA_INIT(x) XA##x = XInternAtom(dpy, #x, False) #define _NET_WM_STATE_ADD 1 diff --git a/gfx/common/x11_common.h b/gfx/common/x11_common.h index 6ee144b73e..8e11710a07 100644 --- a/gfx/common/x11_common.h +++ b/gfx/common/x11_common.h @@ -35,8 +35,9 @@ #include "../video_context_driver.h" -Atom g_x11_quit_atom; -volatile sig_atomic_t g_x11_quit; +extern Atom g_x11_quit_atom; +extern volatile sig_atomic_t g_x11_quit; +extern bool g_x11_has_focus; void x11_show_mouse(Display *dpy, Window win, bool state); void x11_windowed_fullscreen(Display *dpy, Window win); diff --git a/gfx/drivers_context/glx_ctx.c b/gfx/drivers_context/glx_ctx.c index a05153fa5e..df53735bbd 100644 --- a/gfx/drivers_context/glx_ctx.c +++ b/gfx/drivers_context/glx_ctx.c @@ -32,7 +32,6 @@ static void (*g_pglSwapIntervalEXT)(Display*, GLXDrawable, int); typedef struct gfx_ctx_glx_data { - bool g_has_focus; bool g_true_full; bool g_use_hw_ctx; bool g_core_es; @@ -288,12 +287,12 @@ static void gfx_ctx_glx_check_window(void *data, bool *quit, case MapNotify: if (event.xmap.window == glx->g_win) - glx->g_has_focus = true; + g_x11_has_focus = true; break; case UnmapNotify: if (event.xunmap.window == glx->g_win) - glx->g_has_focus = false; + g_x11_has_focus = false; break; case ButtonPress: x_input_poll_wheel(driver->input_data, &event.xbutton, true); @@ -655,7 +654,7 @@ static bool gfx_ctx_glx_set_video_mode(void *data, XSetErrorHandler(old_handler); XFree(vi); - glx->g_has_focus = true; + g_x11_has_focus = true; if (!x11_create_input_context(glx->g_dpy, glx->g_win, &glx->g_xim, &glx->g_xic)) goto error; @@ -702,7 +701,7 @@ static bool gfx_ctx_glx_has_focus(void *data) XGetInputFocus(glx->g_dpy, &win, &rev); - return (win == glx->g_win && glx->g_has_focus) || glx->g_true_full; + return (win == glx->g_win && g_x11_has_focus) || glx->g_true_full; } static bool gfx_ctx_glx_suppress_screensaver(void *data, bool enable) diff --git a/gfx/drivers_context/xegl_ctx.c b/gfx/drivers_context/xegl_ctx.c index a5f1829789..ca03b69c30 100644 --- a/gfx/drivers_context/xegl_ctx.c +++ b/gfx/drivers_context/xegl_ctx.c @@ -37,7 +37,6 @@ static Display *g_dpy; static Window g_win; static Colormap g_cmap; -static bool g_has_focus; static bool g_true_full; static unsigned g_screen; @@ -176,12 +175,12 @@ static void gfx_ctx_xegl_check_window(void *data, bool *quit, case MapNotify: if (event.xmap.window == g_win) - g_has_focus = true; + g_x11_has_focus = true; break; case UnmapNotify: if (event.xunmap.window == g_win) - g_has_focus = false; + g_x11_has_focus = false; break; case ButtonPress: @@ -612,7 +611,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data, XSetErrorHandler(old_handler); XFree(vi); - g_has_focus = true; + g_x11_has_focus = true; g_inited = true; if (!x11_create_input_context(g_dpy, g_win, &g_xim, &g_xic)) @@ -726,7 +725,7 @@ static bool gfx_ctx_xegl_has_focus(void *data) XGetInputFocus(g_dpy, &win, &rev); - return (win == g_win && g_has_focus) || g_true_full; + return (win == g_win && g_x11_has_focus) || g_true_full; } static bool gfx_ctx_xegl_suppress_screensaver(void *data, bool enable)