Bug 473346

Summary: Sub-menus overlap menus when window is not maximized on Wayland
Product: [Plasma] kwin Reporter: guimarcalsilva
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: kde, nate
Priority: NOR    
Version: 5.27.7   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=473347
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description guimarcalsilva 2023-08-13 18:55:28 UTC
SUMMARY
Some windows like Dolphin or Gwenview have hamburger menus on the right side of the window. When the window is maximized, sub-menus appear on the left side of the menus as expected (because there's no space on the right), however, if the same window is unmaximized and close to the right edge of the display, the sub-menus appear on top of the menu, obstructing the buttons below.

While I'm using hamburger menus as an example, this is NOT specific to hamburger menus, but it's harder to notice because menus in a toolbar usually aren't close to the edge of the screen. The following video illustrates the issue:
https://www.youtube.com/watch?v=cHaSOQs_Cik

STEPS TO REPRODUCE
1. Open Gwenview (with a hamburger menu to make it easier to reproduce)
2. Maximize, open the hamburger menu, and then hover over an item that opens a sub-menu. Notice how it opens to the left.
3. Now unmaximize, move the window to the right edge of the screen, and do the same.

OBSERVED RESULT
The submenu appears on top of the menu, obstructing the items below

EXPECTED RESULT
When there's space to the left and not on the right of the menu, open submenus on the left side instead of putting them on top of the menu, just the way it happens for maximized windows.

SOFTWARE/OS VERSIONS
Operating System: KDE neon 5.27
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.108.0
Qt Version: 5.15.10
Kernel Version: 6.2.0-26-generic (64-bit)
Graphics Platform: Wayland
Processors: 6 × Intel® Core™ i5-9400F CPU @ 2.90GHz
Memory: 15,4 GiB of RAM
Graphics Processor: AMD Radeon RX 570 Series
Comment 1 guimarcalsilva 2023-08-13 19:46:09 UTC
I tested on X11 and that doesn't happen there. I'm guessing this is a Kwin bug then.
Comment 2 Nate Graham 2023-08-13 20:06:21 UTC
In fact it's a Qt Wayland bug. It's fixed in Qt 6.
Comment 3 Nate Graham 2023-08-14 04:01:11 UTC
Oops, my mistake. Confirmed, and not fixed on Wayland.
Comment 5 guimarcalsilva 2023-10-03 21:40:02 UTC
I'll have to reopen. None of those bug reports are related to this one. All of them talk about the menus going off screen, however, that's not what's happening here. Here they don't go off screen, instead, they are placed on top of other menus when the window is not maximized. It's a different issue.
Comment 6 Vlad Zahorodnii 2024-09-18 10:41:39 UTC
(In reply to guimarcalsilva from comment #5)
> I'll have to reopen. None of those bug reports are related to this one. All
> of them talk about the menus going off screen, however, that's not what's
> happening here. Here they don't go off screen, instead, they are placed on
> top of other menus when the window is not maximized. It's a different issue.

They are. QtWayland doesn't set appropriate xdg_positioner flags to properly place popups. Popups are placed differently when a window is maximized because popup logic is built around the global coordinate space, and it just happens that when a window is maximized, that global coordinate space logic is more likely to work as expected because the window fills most of the screen area.