From 7bfdce4f9e579a04df1fb4693a1a93999db04940 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 24 Feb 2011 17:42:45 -0800 Subject: [PATCH] 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index 855388144..703c6f045 100644 --- a/src/video/x11/SDL_x11video.c +++ b/src/video/x11/SDL_x11video.c @@ -786,6 +786,11 @@ static void X11_SetSizeHints(_THIS, int w, int h, Uint32 flags) /* Center it, if desired */ if ( X11_WindowPosition(this, &hints->x, &hints->y, w, h) ) { hints->flags |= USPosition; + + /* Hints must be set before moving the window, otherwise an + unwanted ConfigureNotify event will be issued */ + XSetWMNormalHints(SDL_Display, WMwindow, hints); + XMoveWindow(SDL_Display, WMwindow, hints->x, hints->y); /* Flush the resize event so we don't catch it later */