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

            Bug ID: 528400
           Summary: Wayland: window size is restored via
                    xdg-session-management on every show, ignoring
                    per-screen geometry (tab bar cut off / empty bar on
                    second monitor)
    Classification: Applications
           Product: yakuake
      Version First 26.08.2
       Reported In:
          Platform: Arch Linux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Created attachment 198102
  --> https://bugs.kde.org/attachment.cgi?id=198102&action=edit
Yakuake log file when opening and closing on multiple monitors

SUMMARY
On Wayland with two screens whose available areas differ (bottom panel on only
one screen), Yakuake keeps the window size from the first time it was shown.
On the other screen either the tab bar and title bar are cut off, or an empty
bar appears below them. Toggling repeatedly does not help.
WAYLAND_DEBUG shows the size comes from xdg-session-management: on every show
the toplevel is recreated, QtWayland calls restore_toplevel, and KWin restores
the previous size.

STEPS TO REPRODUCE
1. Two screens with identical resolution and scale (here 2x 2560x1440,
   scale 1, side by side: DP-2 at 0,0 / DP-3 at 2560,0).
2. Bottom panel (always visible, reserves 64 px) on DP-2 only; DP-3 has a top
   panel only.
3. Yakuake: width 90 %, height 90 %, open on the screen under the mouse.
4. Start Yakuake, open it with F12 on DP-3, close it.
5. Move the mouse to DP-2, open Yakuake again.

OBSERVED RESULT
Step 5: the window keeps the height from DP-3 (1263 px), while Yakuake
positions the window correctly for DP-2 and lays out its tab bar and title
bar for the DP-2 height (1206 px). Result: ~57 px empty bar below the title
bar.
Reverse order (first DP-2, then DP-3): tab bar and title bar are cut off by
~57 px.
Repeated toggling does not change anything. Only restarting Yakuake on the
target screen (or disabling the other screen) gives the correct size there.

EXPECTED RESULT
On every show the window has the configured size relative to the available
area of the screen it is shown on.

ANALYSIS
plasmashell reports correct available areas
(org.kde.PlasmaShell.StrutManager.availableScreenRect):
  DP-2: (0, 36, 2560, 1340)
  DP-3: (2560, 36, 2560, 1404)

WAYLAND_DEBUG (log attached):
- First show:
    xdg_session_v1.restore_toplevel(..., "MainWindow#1")
    <- configure_bounds(2560, 1404), configure(0, 0)
    -> set_window_geometry(0, 0, 2304, 1263)            # correct for DP-3
- Every later show (the toplevel is destroyed on hide and recreated on show):
    xdg_session_v1.restore_toplevel(..., "MainWindow#1")
    org_kde_plasma_surface.set_position(128, 36)        # correct for DP-2
    <- xdg_toplevel_session_v1.restored()
    <- configure(2304, 1263)                            # size of first show
    -> set_window_geometry(0, 0, 2304, 1263)
The expected DP-2 height (1206) never reaches the surface.

restore_toplevel is issued by QtWayland's session manager
(qtbase/src/plugins/platforms/wayland/qwaylandsessionmanager.cpp). For a
drop-down window that computes its geometry per screen and recreates its
toplevel on every show, restoring the previous size is wrong. Yakuake should
opt out of session restore for its main window, or re-apply its own geometry
after the restored configure.

WORKAROUND (confirmed)
  QT_WAYLAND_DISABLED_INTERFACES=xdg_session_manager_v1 yakuake
With this, the size is correct on both screens and no restore_toplevel
appears in the log. (wayland-info: 'xdg_session_manager_v1', version 1)

SOFTWARE/OS VERSIONS
Linux: Arch Linux, kernel 7.2.14-arch1-1, Wayland session
Yakuake: 26.08.2
KDE Plasma: 6.8.2
KDE Frameworks: 6.31.0
Qt: 6.12.0 (qt6-base 6.12.0-3; Wayland platform plugin is part of qt6-base)
Graphics: AMD Radeon RX 6600 (discrete), AMD Radeon 610M (integrated)
Screens: 2x LG UltraGear 27", 2560x1440 @ 144 Hz, HDR enabled, scale 1

ADDITIONAL INFORMATION
Related, but a different cause: bug 485069 and bug 504138 (first-show race
with the async D-Bus call). Here the size stays wrong on every toggle and
the cause is the session restore described above.

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

Reply via email to