Bug 379635 - popmenu at desktop doesn't disappear when lost focus.
Summary: popmenu at desktop doesn't disappear when lost focus.
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: 5.9.5
Platform: Fedora RPMs Linux
: VHI normal
Target Milestone: 1.0
Assignee: David Edmundson
URL: https://bugreports.qt.io/browse/QTBUG...
Keywords: wayland
: 377123 381125 382765 383485 383487 383904 385784 386298 398566 411683 417082 418415 422966 426654 426741 426991 426993 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-05-08 15:00 UTC by Robert Lu
Modified: 2020-10-06 05:10 UTC (History)
25 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.20


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Lu 2017-05-08 15:00:28 UTC
plasmashell 5.9.5, Wayland.

At desktop, right click the folder, or widget. there will be a popmenu, such as `configure desktop`. when you left click other area, the origin popmenu still exists.
Comment 1 Elvis Angelaccio 2017-06-12 21:58:34 UTC
*** Bug 381125 has been marked as a duplicate of this bug. ***
Comment 2 Christoph Feck 2017-08-02 11:32:24 UTC
*** Bug 382765 has been marked as a duplicate of this bug. ***
Comment 3 David Edmundson 2017-08-18 00:49:48 UTC
*** Bug 383485 has been marked as a duplicate of this bug. ***
Comment 4 Christoph Feck 2017-08-23 14:35:11 UTC
*** Bug 383487 has been marked as a duplicate of this bug. ***
Comment 5 David Edmundson 2017-10-16 22:36:21 UTC
*** Bug 385784 has been marked as a duplicate of this bug. ***
Comment 6 Nate Graham 2017-10-29 02:16:32 UTC
*** Bug 386298 has been marked as a duplicate of this bug. ***
Comment 7 Patrick Silva 2017-12-02 23:29:14 UTC
*** Bug 387526 has been marked as a duplicate of this bug. ***
Comment 8 Patrick Silva 2018-02-07 13:57:12 UTC
plasma 5.12 stable has the same bug on Arch Linux.
Comment 9 Patrick Silva 2018-05-19 23:07:22 UTC
Bug persists in plasma 5.13 beta.
Context menu of icons in desktop
remains open if I click on desktop background or press ESC.
The same happens with the context menu of any element in plasma panel (icon in system tray, task manager entry, pinned app icon, widget).
If I click on some window instead on desktop background, the conext menu is closed.
Comment 10 David Edmundson 2018-05-21 08:40:32 UTC
what Qt version?
Comment 11 Patrick Silva 2018-05-21 10:06:50 UTC
qt 5.11 rc2 on Arch Linux, qt 5.10 on neon dev unstable.
Comment 12 Michael D 2018-07-12 08:15:18 UTC
Same as Chapatin. If I click the desktop or switch virtual desktops, the menu remains. If I click an application, it disappears. I'm on Manjaro testing with Plasma 5.13.2 and Qt 5.11.1.
Comment 13 Patrick Silva 2018-09-13 12:41:55 UTC
*** Bug 398566 has been marked as a duplicate of this bug. ***
Comment 14 Andrius Štikonas 2018-09-14 17:19:13 UTC
Not sure if I understood correctly what is the patch from bug #398566 (as it has no context lines at all) but the patch that I tried improves situation but doesn't completely resolve it.

diff --git a/popup_input_filter.cpp b/popup_input_filter.cpp
index fc74540ed..c9e93c559 100644
--- a/popup_input_filter.cpp
+++ b/popup_input_filter.cpp
@@ -65,13 +65,9 @@ bool PopupInputFilter::pointerEvent(QMouseEvent *event, quint32 nativeButton)
             // filter out this press
             return true;
         }
-        if (pointerFocus && pointerFocus->isDecorated()) {
-            // test whether it is on the decoration
-            const QRect clientRect = QRect(pointerFocus->clientPos(), pointerFocus->clientSize()).translated(pointerFocus->pos());
-            if (!clientRect.contains(event->globalPos())) {
-                cancelPopups();
-                return true;
-            }
+        if (!m_popupClients.contains(pointerFocus)) {
+            cancelPopups();
+            return true;
         }
     }
     return false;
Comment 15 Andrius Štikonas 2018-09-14 17:21:14 UTC
(In reply to Andrius Štikonas from comment #14)
> Not sure if I understood correctly what is the patch from bug #398566 (as it
> has no context lines at all) but the patch that I tried improves situation
> but doesn't completely resolve it.
> 
> diff --git a/popup_input_filter.cpp b/popup_input_filter.cpp
> index fc74540ed..c9e93c559 100644
> --- a/popup_input_filter.cpp
> +++ b/popup_input_filter.cpp
> @@ -65,13 +65,9 @@ bool PopupInputFilter::pointerEvent(QMouseEvent *event,
> quint32 nativeButton)
>              // filter out this press
>              return true;
>          }
> -        if (pointerFocus && pointerFocus->isDecorated()) {
> -            // test whether it is on the decoration
> -            const QRect clientRect = QRect(pointerFocus->clientPos(),
> pointerFocus->clientSize()).translated(pointerFocus->pos());
> -            if (!clientRect.contains(event->globalPos())) {
> -                cancelPopups();
> -                return true;
> -            }
> +        if (!m_popupClients.contains(pointerFocus)) {
> +            cancelPopups();
> +            return true;
>          }
>      }
>      return false;

Sorry, I just noticed the lines are specified there. I'll try that patch again.
Comment 16 Andrius Štikonas 2018-09-14 17:35:57 UTC
Well, even with full patch, popups don't work as well as on X11.

I sometimes still can open both popup at window titlebar and taskbar simultaneously.

Also if I open popup on chromium  (via XWayland) titlebar and then right click on the webpage, I can see both kwin popup menu and chromium popup menu simultaneously.

Nevertheless, it feels better than without this patch.
Comment 17 Nate Graham 2018-09-14 17:39:24 UTC
Awesome, wanna submit that patch for review?
Comment 18 Vlad Zahorodnii 2018-09-14 17:40:30 UTC
(In reply to Nate Graham from comment #17)
> Awesome, wanna submit that patch for review?

See Roman's comment https://phabricator.kde.org/D15480#325325
Comment 19 Nate Graham 2018-09-14 17:42:28 UTC
Darn.
Comment 20 Andrius Štikonas 2018-09-14 17:43:42 UTC
(In reply to Nate Graham from comment #19)
> Darn.

To make it slightly less, darn, this patch seems to break some minor things too (sometimes popup doesn't open when it should), it wasn't perfect anyway.
Comment 21 Vlad Zahorodnii 2018-09-14 17:46:44 UTC
(In reply to Andrius Štikonas from comment #20)
> To make it slightly less, darn, this patch seems to break some minor things
> too (sometimes popup doesn't open when it should), it wasn't perfect anyway.

When exactly?
Comment 22 Andrius Štikonas 2018-09-14 17:49:26 UTC
(In reply to Vlad Zagorodniy from comment #21)
> (In reply to Andrius Štikonas from comment #20)
> > To make it slightly less, darn, this patch seems to break some minor things
> > too (sometimes popup doesn't open when it should), it wasn't perfect anyway.
> 
> When exactly?

1) Right click on the desktop.
2) Press Ctrl+F2 (to switch to another Virtual desktop)
3) Right click on Plasma panel, popup doesn't open
Comment 23 Andrius Štikonas 2018-09-14 17:52:49 UTC
(In reply to Andrius Štikonas from comment #22)
> (In reply to Vlad Zagorodniy from comment #21)
> > (In reply to Andrius Štikonas from comment #20)
> > > To make it slightly less, darn, this patch seems to break some minor things
> > > too (sometimes popup doesn't open when it should), it wasn't perfect anyway.
> > 
> > When exactly?
> 
> 1) Right click on the desktop.
> 2) Press Ctrl+F2 (to switch to another Virtual desktop)
> 3) Right click on Plasma panel, popup doesn't open

Ok, I partially take it back. It's not a regression of the patch. It seems to be  another issue which is present even without your patch.
Comment 24 Andrius Štikonas 2018-09-14 17:59:00 UTC
(In reply to Andrius Štikonas from comment #22)
> (In reply to Vlad Zagorodniy from comment #21)
> > (In reply to Andrius Štikonas from comment #20)
> > > To make it slightly less, darn, this patch seems to break some minor things
> > > too (sometimes popup doesn't open when it should), it wasn't perfect anyway.
> > 
> > When exactly?
> 
> 1) Right click on the desktop.
> 2) Press Ctrl+F2 (to switch to another Virtual desktop)
> 3) Right click on Plasma panel, popup doesn't open

Opened another bug for this issue https://bugs.kde.org/show_bug.cgi?id=398628.
Comment 25 Patrick Silva 2018-09-28 11:57:48 UTC
*** Bug 377123 has been marked as a duplicate of this bug. ***
Comment 26 Patrick Silva 2018-10-13 15:19:28 UTC
Bug persists.

Operating System: Arch Linux 
KDE Plasma Version: 5.14.0
Qt Version: 5.11.2
KDE Frameworks Version: 5.50.0
Comment 27 Patrick Silva 2019-01-17 16:43:05 UTC
bug persists in plasma 5.15 beta :(

Operating System: Arch Linux 
KDE Plasma Version: 5.14.90
KDE Frameworks Version: 5.54.0
Qt Version: 5.12.0
Comment 28 Patrick Silva 2019-05-16 17:18:39 UTC
This bug persists with plasma 5.16 beta.

Operating System: Arch Linux 
KDE Plasma Version: 5.15.90
KDE Frameworks Version: 5.58.0
Qt Version: 5.13.0 beta3
Comment 29 Matej Mrenica 2019-05-16 18:09:14 UTC
This bug does persist, but only with folders, not widgets (at least not with analog clock)

Operating System: Arch Linux 
KDE Plasma Version: 5.15.90
KDE Frameworks Version: 5.58.0
Qt Version: 5.13.0 beta3
Comment 30 Patrick Silva 2019-09-08 01:29:46 UTC
*** Bug 411683 has been marked as a duplicate of this bug. ***
Comment 31 Patrick Silva 2020-01-18 11:04:46 UTC
Context menu of window decoration is also affected.

Operating System: Arch Linux 
KDE Plasma Version: 5.17.90
KDE Frameworks Version: 5.66.0
Qt Version: 5.14.0
Comment 32 Nate Graham 2020-02-05 20:31:13 UTC
*** Bug 383904 has been marked as a duplicate of this bug. ***
Comment 33 Nate Graham 2020-02-05 20:31:22 UTC
*** Bug 417082 has been marked as a duplicate of this bug. ***
Comment 34 Patrick Silva 2020-03-03 23:40:11 UTC
*** Bug 418415 has been marked as a duplicate of this bug. ***
Comment 35 tromzy 2020-05-04 10:57:41 UTC
I've recently noticed that the bug only occurs if the desktop is in "Desktop" mode (i.e. no icons on the desktop), it does not happen if the desktop is in "Folder view" mode (with icons on the desktop).
Comment 36 Andrius Štikonas 2020-05-04 11:23:24 UTC
(In reply to tromzy from comment #35)
> I've recently noticed that the bug only occurs if the desktop is in
> "Desktop" mode (i.e. no icons on the desktop), it does not happen if the
> desktop is in "Folder view" mode (with icons on the desktop).

The bug is also visible on other Plasma surfaces (e.g. taskbar), I don't think this would be affected by the desktop mode. In any case, Vlad has a reproducer app that he attached to Qt bug.
Comment 37 Nate Graham 2020-05-04 13:31:22 UTC
Thanks for adding a reference to that Qt bug, Vlad. Is this purely an upstream issue, or something we can work around on the KDE side?
Comment 38 Patrick Silva 2020-06-15 12:24:16 UTC
*** Bug 422966 has been marked as a duplicate of this bug. ***
Comment 39 Patrick Silva 2020-09-18 00:02:59 UTC
*** Bug 426654 has been marked as a duplicate of this bug. ***
Comment 40 Patrick Silva 2020-09-27 15:27:12 UTC
*** Bug 426993 has been marked as a duplicate of this bug. ***
Comment 41 Nate Graham 2020-09-28 13:28:06 UTC
Tons and tons of dupes, and this becomes more obvious as Wayland gains users due to its improved stability these days. Raising priority.
Comment 42 Nate Graham 2020-09-28 17:23:08 UTC
*** Bug 426991 has been marked as a duplicate of this bug. ***
Comment 43 Nate Graham 2020-09-28 17:24:15 UTC
Is this purely a Qt issue that we need to wait for a fix for, or is there anything we can do on the Plasma or KWin side?
Comment 44 Vlad Zahorodnii 2020-10-02 16:43:39 UTC
Git commit 6689abaffb076515085f2912028a1e3e3deaf36f by Vlad Zahorodnii.
Committed on 02/10/2020 at 16:42.
Pushed by vladz into branch 'master'.

[Shell Corona] Work around popup dismissal bug on Wayland

A popup needs to grab the keyboard and the pointer in order to dismiss
itself when another window is clicked. It works perfectly on X11.

On Wayland though, the compositor is responsible for dismissing popups
if some surface of another application has been clicked. Note that I
said "of another application." If user clicks some surface of the same
application, the compositor won't dismiss the popup.

If the application uses only QtWidgets, then the popup will be closed
as expected in both cases. But if the application uses both Qt Quick and
Qt Widgets, e.g. plasmashell, then the popup won't be dismissed if a
QQuickItem has been clicked.

It is a Qt bug, but for the time being, this change introduces an event
filter that monitors Qt::MouseButtonPress events and when needed closes
the active popup widget. This is a workaround.

M  +95   -0    shell/shellcorona.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/6689abaffb076515085f2912028a1e3e3deaf36f
Comment 45 Vlad Zahorodnii 2020-10-02 16:44:33 UTC
Git commit 329db2a68c6e70722bce7058af8b5ec31238b07b by Vlad Zahorodnii.
Committed on 02/10/2020 at 16:44.
Pushed by vladz into branch 'Plasma/5.20'.

[Shell Corona] Work around popup dismissal bug on Wayland

A popup needs to grab the keyboard and the pointer in order to dismiss
itself when another window is clicked. It works perfectly on X11.

On Wayland though, the compositor is responsible for dismissing popups
if some surface of another application has been clicked. Note that I
said "of another application." If user clicks some surface of the same
application, the compositor won't dismiss the popup.

If the application uses only QtWidgets, then the popup will be closed
as expected in both cases. But if the application uses both Qt Quick and
Qt Widgets, e.g. plasmashell, then the popup won't be dismissed if a
QQuickItem has been clicked.

It is a Qt bug, but for the time being, this change introduces an event
filter that monitors Qt::MouseButtonPress events and when needed closes
the active popup widget. This is a workaround.


(cherry picked from commit 6689abaffb076515085f2912028a1e3e3deaf36f)

M  +95   -0    shell/shellcorona.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/329db2a68c6e70722bce7058af8b5ec31238b07b
Comment 46 Nate Graham 2020-10-02 17:21:29 UTC
If from a user perspective the problem is effectively fixed now, should this bug report be closed?
Comment 47 David Edmundson 2020-10-05 09:56:31 UTC
>If from a user perspective the problem is effectively fixed now, should this bug report be closed?

If a bug exists and a user doesn't see it.. sounds like the start of a philosophical question.

In general /a/ report needs to stay open so we can eventually do things properly. In this case we do have the upstream report. I think that will suffice.
Comment 48 Andrius Štikonas 2020-10-05 09:57:51 UTC
(In reply to David Edmundson from comment #47)
> >If from a user perspective the problem is effectively fixed now, should this bug report be closed?
> 
> If a bug exists and a user doesn't see it.. sounds like the start of a
> philosophical question.
> 

If I understand correctly, this was a workaround in plasmashell. Are there any other apps that we ship that are affected by that Qt bug?
Comment 49 Patrick Silva 2020-10-05 11:23:51 UTC
Context menu of window decoration is still affected after this workaround.
Comment 50 David Edmundson 2020-10-05 11:25:58 UTC
>Are there any other apps that we ship that are affected by that Qt bug?

Not many, it requires both QtQuick with QWidget context menus.
Comment 51 Andrius Štikonas 2020-10-05 11:29:00 UTC
(In reply to Patrick Silva from comment #49)
> Context menu of window decoration is still affected after this workaround.

I can reproduce that but not reliably (happens maybe 50% of time if I right-click on window decoration and then right click on desktop).
Comment 52 Christoph Feck 2020-10-06 05:10:24 UTC
*** Bug 426741 has been marked as a duplicate of this bug. ***