move g_has_focus to x11_common.c
This commit is contained in:
parent
c9dc5cf71d
commit
3f23a23dea
|
@ -29,8 +29,9 @@
|
||||||
static Atom XA_NET_WM_STATE;
|
static Atom XA_NET_WM_STATE;
|
||||||
static Atom XA_NET_WM_STATE_FULLSCREEN;
|
static Atom XA_NET_WM_STATE_FULLSCREEN;
|
||||||
static Atom XA_NET_MOVERESIZE_WINDOW;
|
static Atom XA_NET_MOVERESIZE_WINDOW;
|
||||||
Atom g_quit_atom;
|
Atom g_x11_quit_atom;
|
||||||
volatile sig_atomic_t g_quit;
|
volatile sig_atomic_t g_x11_quit;
|
||||||
|
bool g_x11_has_focus;
|
||||||
|
|
||||||
#define XA_INIT(x) XA##x = XInternAtom(dpy, #x, False)
|
#define XA_INIT(x) XA##x = XInternAtom(dpy, #x, False)
|
||||||
#define _NET_WM_STATE_ADD 1
|
#define _NET_WM_STATE_ADD 1
|
||||||
|
|
|
@ -35,8 +35,9 @@
|
||||||
|
|
||||||
#include "../video_context_driver.h"
|
#include "../video_context_driver.h"
|
||||||
|
|
||||||
Atom g_x11_quit_atom;
|
extern Atom g_x11_quit_atom;
|
||||||
volatile sig_atomic_t g_x11_quit;
|
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_show_mouse(Display *dpy, Window win, bool state);
|
||||||
void x11_windowed_fullscreen(Display *dpy, Window win);
|
void x11_windowed_fullscreen(Display *dpy, Window win);
|
||||||
|
|
|
@ -32,7 +32,6 @@ static void (*g_pglSwapIntervalEXT)(Display*, GLXDrawable, int);
|
||||||
|
|
||||||
typedef struct gfx_ctx_glx_data
|
typedef struct gfx_ctx_glx_data
|
||||||
{
|
{
|
||||||
bool g_has_focus;
|
|
||||||
bool g_true_full;
|
bool g_true_full;
|
||||||
bool g_use_hw_ctx;
|
bool g_use_hw_ctx;
|
||||||
bool g_core_es;
|
bool g_core_es;
|
||||||
|
@ -288,12 +287,12 @@ static void gfx_ctx_glx_check_window(void *data, bool *quit,
|
||||||
|
|
||||||
case MapNotify:
|
case MapNotify:
|
||||||
if (event.xmap.window == glx->g_win)
|
if (event.xmap.window == glx->g_win)
|
||||||
glx->g_has_focus = true;
|
g_x11_has_focus = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UnmapNotify:
|
case UnmapNotify:
|
||||||
if (event.xunmap.window == glx->g_win)
|
if (event.xunmap.window == glx->g_win)
|
||||||
glx->g_has_focus = false;
|
g_x11_has_focus = false;
|
||||||
break;
|
break;
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
x_input_poll_wheel(driver->input_data, &event.xbutton, true);
|
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);
|
XSetErrorHandler(old_handler);
|
||||||
|
|
||||||
XFree(vi);
|
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))
|
if (!x11_create_input_context(glx->g_dpy, glx->g_win, &glx->g_xim, &glx->g_xic))
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -702,7 +701,7 @@ static bool gfx_ctx_glx_has_focus(void *data)
|
||||||
|
|
||||||
XGetInputFocus(glx->g_dpy, &win, &rev);
|
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)
|
static bool gfx_ctx_glx_suppress_screensaver(void *data, bool enable)
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
static Display *g_dpy;
|
static Display *g_dpy;
|
||||||
static Window g_win;
|
static Window g_win;
|
||||||
static Colormap g_cmap;
|
static Colormap g_cmap;
|
||||||
static bool g_has_focus;
|
|
||||||
static bool g_true_full;
|
static bool g_true_full;
|
||||||
static unsigned g_screen;
|
static unsigned g_screen;
|
||||||
|
|
||||||
|
@ -176,12 +175,12 @@ static void gfx_ctx_xegl_check_window(void *data, bool *quit,
|
||||||
|
|
||||||
case MapNotify:
|
case MapNotify:
|
||||||
if (event.xmap.window == g_win)
|
if (event.xmap.window == g_win)
|
||||||
g_has_focus = true;
|
g_x11_has_focus = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UnmapNotify:
|
case UnmapNotify:
|
||||||
if (event.xunmap.window == g_win)
|
if (event.xunmap.window == g_win)
|
||||||
g_has_focus = false;
|
g_x11_has_focus = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
|
@ -612,7 +611,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
||||||
XSetErrorHandler(old_handler);
|
XSetErrorHandler(old_handler);
|
||||||
|
|
||||||
XFree(vi);
|
XFree(vi);
|
||||||
g_has_focus = true;
|
g_x11_has_focus = true;
|
||||||
g_inited = true;
|
g_inited = true;
|
||||||
|
|
||||||
if (!x11_create_input_context(g_dpy, g_win, &g_xim, &g_xic))
|
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);
|
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)
|
static bool gfx_ctx_xegl_suppress_screensaver(void *data, bool enable)
|
||||||
|
|
Loading…
Reference in New Issue