Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-91550

Full screen does not restore to full screen after screensaver



    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Duplicate
    • Affects Version/s: 5.15.2
    • Fix Version/s: None
    • Component/s: QPA: Windows
    • Environment:
    • Platform/s:


      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

      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 =
                 result =
      !w->flags().testFlag(Qt::MSWindowsFixedSizeDialogHint) &&
      !w->windowState().testFlag(Qt::WindowFullScreen );


        1. AA_EnableHighDpiScaling_1.log
          23 kB
          Irfan Omair
        2. AA_EnableHighDpiScaling_2.log
          19 kB
          Irfan Omair
        3. main .cpp
          3 kB
          Irfan Omair

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.



              kleint Friedemann Kleint
              irfan.omair@digia.com Irfan Omair
              0 Vote for this issue
              1 Start watching this issue



                  Gerrit Reviews

                  There are no open Gerrit changes