mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
X11: Added a test for a weird X11 error we get with Xinerama, rarely.
This commit is contained in:
parent
20ec137763
commit
1e3c28ac64
@ -192,6 +192,21 @@ CheckXinerama(Display * display, int *major, int *minor)
|
||||
#endif
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
/* !!! FIXME: remove this later. */
|
||||
/* we have a weird bug where XineramaQueryScreens() throws an X error, so this
|
||||
is here to help track it down (and not crash, too!). */
|
||||
static SDL_bool xinerama_triggered_error = SDL_FALSE;
|
||||
static int
|
||||
X11_XineramaFailed(Display * d, XErrorEvent * e)
|
||||
{
|
||||
xinerama_triggered_error = SDL_TRUE;
|
||||
fprintf(stderr, "XINERAMA X ERROR: type=%d serial=%lu err=%u req=%u minor=%u\n",
|
||||
e->type, e->serial, (unsigned int) e->error_code,
|
||||
(unsigned int) e->request_code, (unsigned int) e->minor_code);
|
||||
fflush(stderr);
|
||||
return 0;
|
||||
}
|
||||
#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */
|
||||
|
||||
#if SDL_VIDEO_DRIVER_X11_XRANDR
|
||||
@ -398,7 +413,15 @@ X11_InitModes(_THIS)
|
||||
* or newer of the Nvidia binary drivers
|
||||
*/
|
||||
if (CheckXinerama(data->display, &xinerama_major, &xinerama_minor)) {
|
||||
int (*handler) (Display *, XErrorEvent *);
|
||||
X11_XSync(data->display, False);
|
||||
handler = X11_XSetErrorHandler(X11_XineramaFailed);
|
||||
xinerama = X11_XineramaQueryScreens(data->display, &screencount);
|
||||
X11_XSync(data->display, False);
|
||||
X11_XSetErrorHandler(handler);
|
||||
if (xinerama_triggered_error) {
|
||||
xinerama = 0;
|
||||
}
|
||||
if (xinerama) {
|
||||
use_xinerama = xinerama_major * 100 + xinerama_minor;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user