Bug 442375 - [Wayland] Hamburger menu opens as window if app window is unfocused
Summary: [Wayland] Hamburger menu opens as window if app window is unfocused
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kconfigwidgets
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.86.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords: wayland
: 444355 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-09-13 08:47 UTC by guimarcalsilva
Modified: 2022-11-06 23:27 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.89


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description guimarcalsilva 2021-09-13 08:47:18 UTC
SUMMARY


STEPS TO REPRODUCE
1. Open Dolphin or Gwenview
2. Click on the desktop to unfocus the window
3. Click on the hamburger menu button on the top right corner

OBSERVED RESULT

Hamburger menu gets its own window

EXPECTED RESULT

The menu should either open as intended on the first click or not get triggered and instead only focus the window (like what happens with the hamburger menu on System Settings when doing the same thing).

SOFTWARE/OS VERSIONS
Operating System: KDE neon 5.22
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.3
Kernel Version: 5.11.0-34-generic (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i5-6200U CPU @ 2.30GHz
Memory: 3.7 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 520
Comment 1 David Edmundson 2021-09-13 08:52:19 UTC
Moving to dolphin until kwin is proven to be at fault.
Comment 2 guimarcalsilva 2021-09-13 09:00:58 UTC
(In reply to David Edmundson from comment #1)
> Moving to dolphin until kwin is proven to be at fault.

Well, the issue also happens with Gwenview, so ir can't be expecific to Dolphin.
Comment 3 Nate Graham 2021-09-16 18:49:05 UTC
Could be an issue in KHamburgerMenu itself too. Given that it happens in both apps, moving to where it lives for now.
Comment 4 Felix Ernst 2021-09-21 14:56:06 UTC
Yes, my guess is that the bug is produced because no parent is set for the QMenu in KHamburgerMenuPrivate::newMenu(). It is saved in a std::unique_ptr currently which makes the normal workaround (https://community.kde.org/Guidelines_and_HOWTOs/Wayland_Porting_Notes#Popup_Menus) to this not easily applicable.

It is also doubly tricky because this menu is set to be the menu of any potential amount of hamburger menus that the application might want to place anywhere including in multiple windows. In practice we are not doing that currently but this means that there is no clear parent window that can be reliably chosen and expected to be alive for longer than the QMenu itself.
Comment 5 Patrick Silva 2021-10-25 19:53:40 UTC
Similar bug affects Yakuake, see bug 437163
Comment 6 guimarcalsilva 2021-10-25 20:06:32 UTC
On System Settings this bug doesn't happen because clicking on the hamburger menu focuses the window first and then you have to click again to activate it. Would it be possible to make the hamburger menu non-interactive if the window is unfocused?
Comment 7 Bug Janitor Service 2021-10-26 15:40:02 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kconfigwidgets/-/merge_requests/83
Comment 8 Nate Graham 2021-11-09 17:23:04 UTC
Git commit 82c40f18709484fd462643aa113a8ccf961b646a by Nate Graham, on behalf of Felix Ernst.
Committed on 09/11/2021 at 17:22.
Pushed by ngraham into branch 'master'.

Fix hamburger menu opening as a window on Wayland

Before this commit, if an app window is unfocused and the first
click on the window is the hamburger menu button, the menu would
appear displaced as a separate window on Wayland.

This commit fixes this by setting a sane transientParent for the
menu. This is slightly difficult because there can be any number
of hamburger buttons in any number of different windows so we need
to figure out spontaneously which button was pressed to open the
menu.

M  +24   -2    src/khamburgermenuhelpers.cpp
M  +1    -1    src/khamburgermenuhelpers_p.h

https://invent.kde.org/frameworks/kconfigwidgets/commit/82c40f18709484fd462643aa113a8ccf961b646a
Comment 9 Felix Ernst 2022-11-06 23:27:01 UTC
*** Bug 444355 has been marked as a duplicate of this bug. ***