Skip to content
This repository has been archived by the owner. It is now read-only.
Browse files

Fixed setting programmatically setting the size of a window on X11 fo…

…r non-resizable windows.

Patch by Matthew Smaling
  • Loading branch information
slouken committed Apr 5, 2011
1 parent af77ae7 commit 81160d6851a4408d25c6330e4c713931a73b5baf
Showing with 16 additions and 1 deletion.
  1. +16 −1 src/video/x11/SDL_x11window.c
@@ -772,7 +772,22 @@ X11_SetWindowSize(_THIS, SDL_Window * window)

if (SDL_IsShapedWindow(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);

} else
XResizeWindow(display, data->xwindow, window->w, window->h);

0 comments on commit 81160d6

Please sign in to comment.