mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-25 16:02:33 +01:00
Detect and override illegal window size hints
The problem - when VirtualBox starts virtual machine, window has very small height (couple of pixels) and it requires some manual fiddling to resize it to something usable. See related bugs here: https://www.virtualbox.org/ticket/14718#comment:19 - small horizontal line in the middle of the screen is newly opened virtual machine's window. https://www.virtualbox.org/ticket/15863 Inspecting with xdebug and xprop reveals that VirtualBox sends wrong hints: Request(12): ConfigureWindow window=0x0660000a values={x=27 y=559 width=720 height=65512} Which is interpreted by X server wrongly and shown with xprop as WM_NORMAL_HINTS(WM_SIZE_HINTS) : user specified location: 27, 559 user specified size: 720 by -24 program specified minimum size: 254 by 109 window gravity: Static Some part of X11 interprets such large value as signed int and wraps it to negative value. The solution will be if program requests such big window - detect it, ignore requested size and resize it to some reasonable defaults. Disclaimer - I tested it only on Ubuntu 16.04, but should apply to another systems as well - see bug reports.
This commit is contained in:
committed by
Carlos R. Mafra
parent
100745d356
commit
6668715402
@@ -2087,6 +2087,14 @@ void wWindowConfigure(WWindow *wwin, int req_x, int req_y, int req_width, int re
|
||||
int synth_notify = False;
|
||||
int resize;
|
||||
|
||||
/* if window size is guaranteed to fail - fix it to some reasonable
|
||||
* defaults */
|
||||
if (req_height > SHRT_MAX)
|
||||
req_height = 480;
|
||||
|
||||
if (req_width > SHRT_MAX)
|
||||
req_height = 640;
|
||||
|
||||
resize = (req_width != wwin->client.width || req_height != wwin->client.height);
|
||||
/*
|
||||
* if the window is being moved but not resized then
|
||||
|
||||
Reference in New Issue
Block a user