|
@@ -995,6 +995,15 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/* This catches an error from XRRSetScreenSize, as a workaround for now. */
|
|
|
+/* !!! FIXME: remove this later when we have a better solution. */
|
|
|
+static int (*PreXRRSetScreenSizeErrorHandler)(Display *, XErrorEvent *) = NULL;
|
|
|
+static int
|
|
|
+SDL_XRRSetScreenSizeErrHandler(Display *d, XErrorEvent *e)
|
|
|
+{
|
|
|
+ return (e->error_code == BadMatch) ? 0 : PreXRRSetScreenSizeErrorHandler(d, e);
|
|
|
+}
|
|
|
+
|
|
|
int
|
|
|
X11_SetDisplayMode(_THIS, SDL_VideoDisplay * sdl_display, SDL_DisplayMode * mode)
|
|
|
{
|
|
@@ -1040,7 +1049,17 @@ X11_SetDisplayMode(_THIS, SDL_VideoDisplay * sdl_display, SDL_DisplayMode * mode
|
|
|
|
|
|
mm_width = mode->w * DisplayWidthMM(display, data->screen) / DisplayWidth(display, data->screen);
|
|
|
mm_height = mode->h * DisplayHeightMM(display, data->screen) / DisplayHeight(display, data->screen);
|
|
|
+
|
|
|
+ /* !!! FIXME: this can get into a problem scenario when a window is
|
|
|
+ bigger than a physical monitor in a configuration where one screen
|
|
|
+ spans multiple physical monitors. A detailed reproduction case is
|
|
|
+ discussed at https://github.com/libsdl-org/SDL/issues/4561 ...
|
|
|
+ for now we cheat and just catch the X11 error and carry on, which
|
|
|
+ is likely to cause subtle issues but is better than outright
|
|
|
+ crashing */
|
|
|
+ PreXRRSetScreenSizeErrorHandler = X11_XSetErrorHandler(SDL_XRRSetScreenSizeErrHandler);
|
|
|
X11_XRRSetScreenSize(display, RootWindow(display, data->screen), mode->w, mode->h, mm_width, mm_height);
|
|
|
+ X11_XSetErrorHandler(PreXRRSetScreenSizeErrorHandler);
|
|
|
|
|
|
status = X11_XRRSetCrtcConfig (display, res, output_info->crtc, CurrentTime,
|
|
|
crtc->x, crtc->y, modedata->xrandr_mode, crtc->rotation,
|