Fixed setting programmatically setting the size of a window on X11 for non-resizable windows.
Patch by Matthew Smaling
This commit is contained in:
parent
65b0f3090a
commit
0e83d1d4f3
1 changed files with 16 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue