Bug 478186

Summary: On Wayland the "Show Menu" drop-down sometimes opens detached in the middle of the screen
Product: [Applications] systemsettings Reporter: ratijas <me>
Component: sidebarviewAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: nate, notmart
Priority: NOR Keywords: qt6
Version: master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=477885
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: happy floating menu floats afloat

Description ratijas 2023-12-07 01:00:20 UTC
Created attachment 163963 [details]
happy floating menu floats afloat

SUMMARY

After KWin task switching, the drop-down menu of System Settings opens up detached, and handles mouse events with wrong offset.

STEPS TO REPRODUCE
1. Open System Settings and some other apps.
2. Click "Show Menu" once, and dismiss it.
3. Alt+Tab though the list of apps, and release Alt back at System Settings.
4. Click "Show Menu again.

OBSERVED RESULT
At step 4 the menu pops up in the middle of a screen, but event handling is offset as if the menu were at the intended location under its button.

EXPECTED RESULT
stability

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.90.0
KDE Frameworks Version: 5.246.0
Qt Version: 6.6.1
Kernel Version: 6.6.3-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-6700HQ CPU @ 2.60GHz
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 970M/PCIe/SSE2
Comment 1 ratijas 2023-12-07 01:09:42 UTC
It seems like after cycling through the list of windows in task switcher and returning back to the original window _without_ letting go of the modifier key (Alt or Meta) in the process, the focus is not being fully returned to the window. For example, header colors remain those of "inactive" window until you really switch focus back and forth. This does not happen if the window switcher is closed via Escape key.
Comment 2 Bug Janitor Service 2023-12-07 01:13:33 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/systemsettings/-/merge_requests/274
Comment 3 Nate Graham 2023-12-07 03:32:25 UTC
In step 3, you're triggering Bug 477885. I can reproduce both that as well as this specific issue in System Settings.
Comment 4 David Edmundson 2023-12-07 08:33:45 UTC
Git commit eb012119806aae2777c0595a27eae26c9848a10a by David Edmundson, on behalf of ivan tkachenko.
Committed on 07/12/2023 at 09:33.
Pushed by davidedmundson into branch 'master'.

Sidebar: Set menu's parent before opening it

Without an explicit transient parent we rely on QtWayland guessing which can lead to a menu would open floating in the middle of the screen and have glitched pointer offset.

M  +2    -1    app/sidebar/SidebarMode.cpp

https://invent.kde.org/plasma/systemsettings/-/commit/eb012119806aae2777c0595a27eae26c9848a10a