[Commits] SDL: Fixed setting programmatically setting the size of a window...
libsdl.org revision control
commits-owner at libsdl.org
Tue Apr 5 09:49:08 PDT 2011
details: http://hg.libsdl.org/SDL/rev/477f550f6efd
changeset: 5531:477f550f6efd
user: Sam Lantinga <slouken at libsdl.org>
date: Tue Apr 05 09:47:34 2011 -0700
description:
Fixed setting programmatically setting the size of a window on X11 for non-resizable windows.
Patch by Matthew Smaling
diffstat:
src/video/x11/SDL_x11window.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diffs (27 lines):
diff -r 4e46a7b6773d -r 477f550f6efd src/video/x11/SDL_x11window.c
--- 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);
}
More information about the commits
mailing list