Create x11_event_queue_check

This commit is contained in:
twinaphex 2015-11-19 15:05:17 +01:00
parent 21124ec80a
commit 00be95159d
4 changed files with 14 additions and 15 deletions

View File

@ -587,3 +587,13 @@ void x11_install_quit_atom(void)
if (g_x11_quit_atom)
XSetWMProtocols(g_x11_dpy, g_x11_win, &g_x11_quit_atom, 1);
}
static Bool x11_wait_notify(Display *d, XEvent *e, char *arg)
{
return e->type == MapNotify && e->xmap.window == g_x11_win;
}
void x11_event_queue_check(XEvent *event)
{
XIfEvent(g_x11_dpy, event, x11_wait_notify, NULL);
}

View File

@ -91,5 +91,7 @@ void x11_colormap_destroy(void);
void x11_install_quit_atom(void);
void x11_event_queue_check(XEvent *event);
#endif

View File

@ -54,11 +54,6 @@ static unsigned g_minor;
static PFNGLXCREATECONTEXTATTRIBSARBPROC glx_create_context_attribs;
static Bool glx_wait_notify(Display *d, XEvent *e, char *arg)
{
return (e->type == MapNotify) && (e->xmap.window == g_x11_win);
}
static int glx_nul_handler(Display *dpy, XErrorEvent *event)
{
(void)dpy;
@ -390,7 +385,7 @@ static bool gfx_ctx_glx_set_video_mode(void *data,
x11_move_window(g_x11_dpy, g_x11_win, x_off, y_off, width, height);
}
XIfEvent(g_x11_dpy, &event, glx_wait_notify, NULL);
x11_event_queue_check(&event);
if (!glx->g_ctx)
{

View File

@ -39,13 +39,6 @@ static enum gfx_ctx_api g_api;
static unsigned g_major;
static unsigned g_minor;
static Bool egl_wait_notify(Display *d, XEvent *e, char *arg)
{
(void)d;
(void)e;
return e->type == MapNotify && e->xmap.window == g_x11_win;
}
static int egl_nul_handler(Display *dpy, XErrorEvent *event)
{
(void)dpy;
@ -400,8 +393,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
x11_move_window(g_x11_dpy, g_x11_win, x_off, y_off, width, height);
}
XIfEvent(g_x11_dpy, &event, egl_wait_notify, NULL);
x11_event_queue_check(&event);
x11_install_quit_atom();
gfx_ctx_xegl_swap_interval(data, g_interval);