mirror of
https://github.com/libretro/RetroArch
synced 2025-02-27 18:41:01 +00:00
Avoid failing when XSetInputFocus fails.
This commit is contained in:
parent
eb0476ffab
commit
100c26f067
@ -165,6 +165,13 @@ static Bool glx_wait_notify(Display *d, XEvent *e, char *arg)
|
||||
return e->type == MapNotify && e->xmap.window == g_win;
|
||||
}
|
||||
|
||||
static int nul_handler(Display *dpy, XErrorEvent *event)
|
||||
{
|
||||
(void)dpy;
|
||||
(void)event;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height);
|
||||
static void gfx_ctx_destroy(void);
|
||||
|
||||
@ -440,8 +447,6 @@ static bool gfx_ctx_set_video_mode(
|
||||
XEvent event;
|
||||
XIfEvent(g_dpy, &event, glx_wait_notify, NULL);
|
||||
|
||||
XSetInputFocus(g_dpy, g_win, RevertToNone, CurrentTime);
|
||||
|
||||
g_ctx = glXCreateNewContext(g_dpy, g_fbc, GLX_RGBA_TYPE, 0, True);
|
||||
if (!g_ctx)
|
||||
{
|
||||
@ -475,6 +480,11 @@ static bool gfx_ctx_set_video_mode(
|
||||
|
||||
gfx_ctx_swap_interval(g_interval);
|
||||
|
||||
// This can blow up on some drivers. It's not fatal, so override errors for this call.
|
||||
int (*old_handler)(Display*, XErrorEvent*) = XSetErrorHandler(nul_handler);
|
||||
XSetInputFocus(g_dpy, g_win, RevertToNone, CurrentTime);
|
||||
XSetErrorHandler(old_handler);
|
||||
|
||||
XFree(vi);
|
||||
g_has_focus = true;
|
||||
g_inited = true;
|
||||
|
@ -64,6 +64,13 @@ static Bool egl_wait_notify(Display *d, XEvent *e, char *arg)
|
||||
return e->type == MapNotify && e->xmap.window == g_win;
|
||||
}
|
||||
|
||||
static int nul_handler(Display *dpy, XErrorEvent *event)
|
||||
{
|
||||
(void)dpy;
|
||||
(void)event;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height);
|
||||
static void gfx_ctx_destroy(void);
|
||||
|
||||
@ -393,7 +400,6 @@ static bool gfx_ctx_set_video_mode(
|
||||
|
||||
XEvent event;
|
||||
XIfEvent(g_dpy, &event, egl_wait_notify, NULL);
|
||||
XSetInputFocus(g_dpy, g_win, RevertToNone, CurrentTime);
|
||||
|
||||
g_quit_atom = XInternAtom(g_dpy, "WM_DELETE_WINDOW", False);
|
||||
if (g_quit_atom)
|
||||
@ -401,6 +407,11 @@ static bool gfx_ctx_set_video_mode(
|
||||
|
||||
gfx_ctx_swap_interval(g_interval);
|
||||
|
||||
// This can blow up on some drivers. It's not fatal, so override errors for this call.
|
||||
int (*old_handler)(Display*, XErrorEvent*) = XSetErrorHandler(nul_handler);
|
||||
XSetInputFocus(g_dpy, g_win, RevertToNone, CurrentTime);
|
||||
XSetErrorHandler(old_handler);
|
||||
|
||||
XFree(vi);
|
||||
g_has_focus = true;
|
||||
g_inited = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user