move g_has_focus to x11_common.c

This commit is contained in:
twinaphex 2015-11-19 09:51:20 +01:00
parent c9dc5cf71d
commit 3f23a23dea
4 changed files with 14 additions and 14 deletions

View File

@ -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

View File

@ -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);

View File

@ -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)

View File

@ -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)