Fixed setting programmatically setting the size of a window on X11 for non-resizable windows.
Patch by Matthew Smaling
--- a/src/video/x11/SDL_x11window.c Tue Apr 05 09:35:56 2011 -0700
+++ b/src/video/x11/SDL_x11window.c Tue Apr 05 09:47:34 2011 -0700
@@ -772,7 +772,22 @@
if (SDL_IsShapedWindow(window))
X11_ResizeWindowShape(window);
- XResizeWindow(display, data->xwindow, window->w, window->h);
+ if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
+ /* Apparently, if the X11 Window is set to a 'non-resizable' window, you cannot resize it using the XResizeWindow, thus
+ we must set the size hints to adjust the window size.*/
+ XSizeHints *sizehints = XAllocSizeHints();
+ long userhints;
+
+ XGetWMNormalHints(display, data->xwindow, sizehints, &userhints);
+
+ sizehints->min_width = sizehints->max_height = window->w;
+ sizehints->min_height = sizehints->max_height = window->h;
+
+ XSetWMNormalHints(display, data->xwindow, sizehints);
+
+ XFree(sizehints);
+ } else
+ XResizeWindow(display, data->xwindow, window->w, window->h);
XFlush(display);
}