From 6e147b208729f935bc058fcd93cf5dae4406d7d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20P=2E=20Tjern=C3=B8?= Date: Mon, 18 Feb 2013 18:28:02 -0800 Subject: [PATCH] Fix SDL_SetWindowSize on certain WMs. Makes SDL_SetWindowSize work on some WMs (like Fluxbox, ion3, Awesome, WindowMaker), and when running without a WM. Fixes bug 1513. CR: saml --- .../English.lproj/InfoPlist.strings | Bin 588 -> 588 bytes .../English.lproj/InfoPlist.strings | Bin 588 -> 588 bytes .../English.lproj/InfoPlist.strings | Bin 588 -> 588 bytes src/video/x11/SDL_x11window.c | 41 +++++++----------- 4 files changed, 16 insertions(+), 25 deletions(-) diff --git a/Xcode/TemplatesForXcodeTiger/SDL Application/English.lproj/InfoPlist.strings b/Xcode/TemplatesForXcodeTiger/SDL Application/English.lproj/InfoPlist.strings index e612457676d964a8021d20ec90290d5c6c3d88c1..38224b5a6dc9494230bdffbcad9c8bd915f478d9 100755 GIT binary patch delta 13 UcmX@Za)yQJ|G$mQo=l7k04L%Epa1{> delta 12 TcmX@Za)yQZ-+zXUOrA^tB1QzC diff --git a/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/InfoPlist.strings b/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/InfoPlist.strings index e612457676d964a8021d20ec90290d5c6c3d88c1..38224b5a6dc9494230bdffbcad9c8bd915f478d9 100755 GIT binary patch delta 13 UcmX@Za)yQJ|G$mQo=l7k04L%Epa1{> delta 12 TcmX@Za)yQZ-+zXUOrA^tB1QzC diff --git a/Xcode/TemplatesForXcodeTiger/SDL OpenGL Application/English.lproj/InfoPlist.strings b/Xcode/TemplatesForXcodeTiger/SDL OpenGL Application/English.lproj/InfoPlist.strings index e612457676d964a8021d20ec90290d5c6c3d88c1..38224b5a6dc9494230bdffbcad9c8bd915f478d9 100755 GIT binary patch delta 13 UcmX@Za)yQJ|G$mQo=l7k04L%Epa1{> delta 12 TcmX@Za)yQZ-+zXUOrA^tB1QzC diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index b16a0110a..4f935fc3c 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -768,37 +768,28 @@ X11_SetWindowSize(_THIS, SDL_Window * window) XFree(sizehints); /* From Pierre-Loup: - For the windowed resize problem; WMs each have their little quirks with - that. When you change the size hints, they get a ConfigureNotify event - with the WM_NORMAL_SIZE_HINTS Atom. They all save the hints then, but - they don't all resize the window right away to enforce the new hints. - Those who do properly do it are: - - - XFWM - - metacity - - KWin + WMs each have their little quirks with that. When you change the + size hints, they get a ConfigureNotify event with the + WM_NORMAL_SIZE_HINTS Atom. They all save the hints then, but they + don't all resize the window right away to enforce the new hints. - These are great. Now, others are more problematic as you could observe - first hand. Compiz/Unity only falls into the code that does it on select - actions, such as window move, raise, map, etc. + Some of them resize only after: + - A user-initiated move or resize + - A code-initiated move or resize + - Hiding & showing window (Unmap & map) - WindowMaker is even more difficult and will _only_ do it on map. - - Awesome only does it on user-initiated moves as far as I can tell. - - Your raise workaround only fixes compiz/Unity. With that all "modern" - window managers are covered. Trying to Hide/Show on windowed resize - (UnMap/Map) fixes both Unity and WindowMaker, but introduces subtle - problems with transitioning from Windowed to Fullscreen on Unity. Since - some window moves happen after the transitions to fullscreen, that forces - SDL to fall from windowed to fullscreen repeatedly and it sometimes leaves - itself in a state where the fullscreen window is slightly offset by what - used to be the window decoration titlebar. - */ + The following move & resize seems to help a lot of WMs that didn't + properly update after the hints were changed. We don't do a + hide/show, because there are supposedly subtle problems with doing so + and transitioning from windowed to fullscreen in Unity. + */ + XResizeWindow(display, data->xwindow, window->w, window->h); + XMoveWindow(display, data->xwindow, window->x, window->y); XRaiseWindow(display, data->xwindow); } else { XResizeWindow(display, data->xwindow, window->w, window->h); } + XFlush(display); }