https://bugs.kde.org/show_bug.cgi?id=526744

            Bug ID: 526744
           Summary: Window state lost when restoring from tray
    Classification: Frameworks and Libraries
           Product: frameworks-kstatusnotifieritem
      Version First 6.30.0
       Reported In:
          Platform: openSUSE
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Created attachment 196892
  --> https://bugs.kde.org/attachment.cgi?id=196892&action=edit
Reproducer (main.cpp + CMakeLists.txt) and a KSNI patch

### Observed behaviour and a reproducer

When I maximize Krusader, hide it into tray, and restore by clicking on the
icon, it becomes "restored" but not maximized anymore. I see this on openSUSE
Tumbleweed with KDE Frameworks 6.30.0, Krusader 2.9.0, Qt 6.11.2 on Wayland.

Attached is an automatic reproducer which creates a plain window, maximizes it,
hides it into tray, restores, checks maximization state and prints the latter
to terminal.

### Additional information and a patch

Since the port from QWidget to QWindow, minimizeRestore() calls QWindow::show()
to restore the associated window. Unlike QWidget::show(), QWindow::show() is
showNormal() for a top-level window, so it resets the window state that was set
just before. A window that was maximized when hidden to the tray comes back
unmaximized. This is visible on Wayland, where the surface is recreated with
the reset state. Under XWayland with KWin, the window manager kept the window
maximized anyway.

The solution is to use setVisible(true) instead, which does not touch the
window state. A patch is attached. It also uses windowStates() instead of
windowState() to compute the state to restore. windowState() returns only
Qt::WindowMinimized for a window that is both minimized and maximized, so
removing the minimized flag left Qt::WindowNoState and the window was
unmaximized when restored from a minimized state.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to