Bug 366609

Summary: Context menu do not close when discarded on Wayland
Product: [Plasma] kwin Reporter: Matthias Fauconneau <matthias.fauconneau>
Component: inputAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: 2112871, balalic.enver, bugseforuns, itl964.biz, mgraesslin, monkeyboyted, plasma-bugs, rudyrolly, subdiff, tromzy
Priority: NOR Flags: mgraesslin: Wayland+
Version: git master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
URL: https://phabricator.kde.org/D5177
Latest Commit: Version Fixed In: 5.10

Description Matthias Fauconneau 2016-08-10 20:25:52 UTC
After opening a context menu, clicking elsewhere does not close the menu.
The context menus can be closed by opening and closing the Application menu.
Also affects other Plasma context menus but they can be closed with right click on Plasma (not left click, or any click outside Plasma).
Context menus in other applications works fine.

Reproducible: Always
Comment 1 Eike Hein 2016-08-11 02:53:35 UTC
Reassigning as the component is in frameworks.
Comment 2 Martin Flöser 2016-08-27 14:03:45 UTC
This is a known limitation in KWin currently. KWin does not (yet) handle popups correctly and doesn't dismiss them when clicking somewhere else.
Comment 3 Martin Flöser 2016-10-18 06:24:07 UTC
*** Bug 370926 has been marked as a duplicate of this bug. ***
Comment 4 Martin Flöser 2016-12-28 08:02:35 UTC
*** Bug 374236 has been marked as a duplicate of this bug. ***
Comment 5 Martin Flöser 2017-03-02 19:18:53 UTC
*** Bug 377101 has been marked as a duplicate of this bug. ***
Comment 6 Martin Flöser 2017-03-15 15:49:22 UTC
*** Bug 377527 has been marked as a duplicate of this bug. ***
Comment 7 Martin Flöser 2017-03-20 06:09:46 UTC
*** Bug 377821 has been marked as a duplicate of this bug. ***
Comment 8 Martin Flöser 2017-03-25 17:50:09 UTC
I'm very happy to tell that I just implemented basic support for popup windows: https://phabricator.kde.org/D5177
Comment 9 Martin Flöser 2017-04-07 14:25:15 UTC
Git commit 1193b0da771a5d1042bf2aed0a2727f89ddf488e by Martin Gräßlin.
Committed on 07/04/2017 at 14:14.
Pushed by graesslin into branch 'master'.

Initial support for popup window handling

Summary:
So far KWin did not properly handle popup windows. That is when a popup
surface got created and a click outside the surface happened KWin did not
send out the popupDone Wayland event.

This change makes KWin aware of whether a surface is a popup and tracks
through a new PopupInputFilter whether there are popup windows. In case
there are popups the new filter waits for mouse press events and cancels
the popups if the press does not happen on any surface belonging to the
same client. To quote the relevant section of the Wayland documentation:

    The popup grab continues until the window is destroyed or a mouse
    button is pressed in any other client's window. A click in any of the
    client's surfaces is reported as normal, however, clicks in other
    clients' surfaces will be discarded and trigger the callback.

So far the support is still incomplete. Not yet implemented are:
 * support xdg_shell popup windows
 * verifying whether the popup is allowed to be a popup
 * cancel the popup on more global interactions like screen lock or
   kwin effect
FIXED-IN: 5.10

Test Plan: Auto test and manual testing with QtWayland client

Reviewers: #plasma, #kwin

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5177

M  +1    -0    CMakeLists.txt
M  +81   -0    autotests/integration/pointer_input.cpp
M  +2    -0    input.cpp
M  +0    -1    pointer_input.cpp
A  +80   -0    popup_input_filter.cpp     [License: GPL (v2/3)]
A  +50   -0    popup_input_filter.h     [License: GPL (v2/3)]
M  +16   -0    shell_client.cpp
M  +3    -0    shell_client.h
M  +26   -0    toplevel.h

https://commits.kde.org/kwin/1193b0da771a5d1042bf2aed0a2727f89ddf488e
Comment 10 Patrick Silva 2017-08-30 14:23:39 UTC
duplicate?
https://bugs.kde.org/show_bug.cgi?id=379635

This bug is still valid for context menus from task manager and tray icons on plasma 5.10.5.
Comment 11 Martin Flöser 2017-08-30 14:54:14 UTC
(In reply to Dr. Chapatin from comment #10)
> duplicate?
> https://bugs.kde.org/show_bug.cgi?id=379635
> 
> This bug is still valid for context menus from task manager and tray icons
> on plasma 5.10.5.

No that is not a duplicate. It's a bug in Qt.