Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
5.15.2
-
Desktop
Description
In a situation where multiple monitors are connected and if a widget is in full screen, then application WIdget is not restored to fullscreen if screensaver is triggered due to inactivtiy and goes off.
It seems that windows WM_DISPLAYCHANGE message is not handled properly.
Probably the problem in file qwindowscontext.cpp in function
QWindowsContext::windowsProc()
If Monitor has a resolution of 3840x2160 and a window scale factor
of 150% (recommended)
these things happens:
1.) Monitor sleep lead to the activation of a simulated monitor profile
with 1024x768 and 100% or 96dpi
2.)WM_DPICHANGED was send with RECT(0,0,2561,1441) which is round about
3840 / 150 * 100, 2160 / 150 * 100
3.) Qt calls SetWindowPos with the suggested size
4.) WM_WINDOWPOSCHANGING is translated as
QtWindows::GeometryChangingEvent and calls handleGeometryChange which
stores new geometry
5.) Somebody limits the fullscreen window to (-1,-1,1026,770) and the
next WM_WINDOWPOSCHANGING message is send
6.) WM_DISPLAYCHANGE: Display(3840x2160 bits:32)
7.) Somebody fixes the size PWINDOWPOS(-1,-1,3842,2162)
8.) WM_DPICHANGEDis received with RECT(0,0,1539,1155) which is 1026 /
100 * 150, 770/ 100 * 150
9.) QT calls SetWindowPos with the suggested RECT(0,0,1539,1155)
Probable two problems here
1.) Qt resizes a fullscreen window to a much bigger size than the
simulated monitor supports (3.)
2.) After the system has resized the window in (7.) Qt resizes it again
(9.) based on the suggestion of the window manager.
If Qt ignores the suggested Rect considering the condition windowState Qt::WindowFullScreen tresizes it to fullscreen then this problem can be avoided.
So if following function is modified then that can solve the problem.
static inline bool resizeOnDpiChanged(const QWindow *w) { ,..,. case Qt::Tool: // result = !w->flags().testFlag(Qt::MSWindowsFixedSizeDialogHint); result = !w->flags().testFlag(Qt::MSWindowsFixedSizeDialogHint) && !w->windowState().testFlag(Qt::WindowFullScreen ); break; ...
Attachments
Issue Links
- duplicates
-
QTBUG-91380 When a monitor comes out of sleep mode then a fullscreen window can end up being shifted slightly so the position and size is wrong
- Closed