From 81160d6851a4408d25c6330e4c713931a73b5baf Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 5 Apr 2011 09:47:34 -0700 Subject: [PATCH] Fixed setting programmatically setting the size of a window on X11 for non-resizable windows. Patch by Matthew Smaling --- src/video/x11/SDL_x11window.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 6b25ab47c..90ab5e6aa 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -772,7 +772,22 @@ X11_SetWindowSize(_THIS, SDL_Window * window) 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); }