Patch for SDL_VIDEO_CENTERED & OpenGL bug SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Thu, 24 Feb 2011 17:42:45 -0800
branchSDL-1.2
changeset 539467d3be4ec9f2
parent 5392 30e4d724fe98
child 5492 b214b7ce9b00
Patch for SDL_VIDEO_CENTERED & OpenGL bug

Stephen Anthony to SDL

Using SDL_VIDEO_CENTERED in Linux OpenGL mode issue an unwanted
ConfigureNotify event *after* the SDL screen has already been resized.
When going from a smaller to a larger screen, this event causes the mouse
tracking to be clamped at the *smaller* screen size, even though that
screen no longer exists.

The fix is to not issue a ConfigureNotify when the window is moved because
of the SDL_VIDEO_CENTERED environment variable. The included patch fixes
this bug. It seems the hints must be set before the window is moved.
src/video/x11/SDL_x11video.c
     1.1 --- a/src/video/x11/SDL_x11video.c	Thu Feb 24 09:39:23 2011 -0800
     1.2 +++ b/src/video/x11/SDL_x11video.c	Thu Feb 24 17:42:45 2011 -0800
     1.3 @@ -786,6 +786,11 @@
     1.4  		/* Center it, if desired */
     1.5  		if ( X11_WindowPosition(this, &hints->x, &hints->y, w, h) ) {
     1.6  			hints->flags |= USPosition;
     1.7 +
     1.8 +			/* Hints must be set before moving the window, otherwise an
     1.9 +			   unwanted ConfigureNotify event will be issued */
    1.10 +			XSetWMNormalHints(SDL_Display, WMwindow, hints);
    1.11 +
    1.12  			XMoveWindow(SDL_Display, WMwindow, hints->x, hints->y);
    1.13  
    1.14  			/* Flush the resize event so we don't catch it later */