-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Description
There seems to be a problem where on Windows, a call to Window::set_fullscreen() will not necessarily result in the window covering the screen (specifically, the height is slightly shorter than it should be) if the following conditions apply:
- The target monitor has a different DPI than the old monitor
- The window in question has a menu bar
This is illustrated in the attached demo where a window pops up and it does the following:
- Press
X, the window will become full screen on display\\.\DISPLAY2(this needs to be edited to point to a display with a different resolution than the primary monitor) - Press
Y, and a menu bar will be added
winit_bug_demo.zip
The problem seems to be that when SetWindowPos() is invoked to make the window full screen, WM_DPICHANGED will be sent to the window. I don't quite follow the maze of calculations within util::WindowArea::Inner::get_rect(), but having a menu bar seems to result in the inner rect being offset from the top. This seems to be correct, but ultimately the call to SetWindowPos() within WM_DPICHANGED makes the window smaller than it should be.
It is also not clear to me if the handler for WM_DPICHANGED should be doing anything if the DPI change is the result of calling Window::set_fullscreen() or any other programmatic call.
I hope this helps!
Windows version
Windows 10Winit version
0.30.11