Bug 436249 - "open klipper at mouse position" shows a menu inside a regular window on Wayland
Summary: "open klipper at mouse position" shows a menu inside a regular window on Wayland
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Unclassified
Component: Clipboard (show other bugs)
Version: 5.21.5
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: wayland
: 435013 437624 450793 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-04-27 03:09 UTC by Henrique Sant'Anna
Modified: 2022-05-09 14:46 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.25
hsantanna: Wayland+


Attachments
Klipper menu inside a regular window (35.93 KB, image/png)
2021-04-27 03:09 UTC, Henrique Sant'Anna
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Henrique Sant'Anna 2021-04-27 03:09:40 UTC
Created attachment 137949 [details]
Klipper menu inside a regular window

SUMMARY

On Wayland, pressing shortcut to "open klipper at mouse position" will open a menu inside a window (with title-bar and borders) if Klipper was started by/inside notification area on Latte (dock / panel). 


STEPS TO REPRODUCE

1. Start KDE Plasma Wayland session;
2. Start Latte dock with an layout containing notification area widget inside a latte dock / latte panel;
(be sure that isn't any other notification area widget on another plasma panel or another instance of klipper running besides the one started inside latte dock)
3. Press shortcut to "open Klipper at mouse position"


OBSERVED RESULT

A Window will be opened (with tittle-bar and borders) containing a menu listing clipboard contents.


EXPECTED RESULT

A menu should be opened (without title-bar or borders) listing clipboard contents on this menu.


SOFTWARE/OS VERSIONS

Platform: Linux (Arch Linux)
QT: 5.15.2+kde+r180-1
Desktop: KDE Plasma 5.21.4 (Wayland)


ADDITIONAL INFORMATION

If not using Latte dock, but regular plasma panel, pressing shortcut to "open klipper at mouse position" will open a menu at mouse position, without title-bar or borders.
Comment 1 Henrique Sant'Anna 2021-04-27 03:10:24 UTC
May be related to Bug #430662
Comment 2 Nate Graham 2021-05-04 19:16:08 UTC
Confirmed. It probably needs a transient parent set.
Comment 3 Patrick Silva 2021-05-17 00:29:06 UTC
bug 435013 is related
Comment 4 Henrique Sant'Anna 2021-05-18 19:12:11 UTC
Tested from git master:

This bug also affects klipper on default Plasma panel, not only Latte dock.

If any window is focused, pressing "open klipper at mouse position" shortcut will open klipper with window decorations AND AT WRONG POSITION (not at mouse position) as reported by Bug 435013.

If desktop is focused (e.g. click at desktop first), klipper will open once without window decoration and at the correct mouse position but, interspersed, closing klipper list and pressing shortcut again will than open klipper once at the wrong position and with window decorations.

The expected behavior is:

- When pressing the shortcut, klipper will always open without window decoration and always at the mouse position, not mattering if the focus is at some window or at desktop.
Comment 5 Nate Graham 2021-05-26 18:36:57 UTC
*** Bug 437624 has been marked as a duplicate of this bug. ***
Comment 6 Oded Arbel 2021-06-06 10:22:14 UTC
Regarding comment 4: From my testing, opening the klipper menu after clicking the desktop works repeatedly.

I've seen a similar alternating menu/window behavior - as was reported in the comment - in gwenview's tag editor combo box, where opening it once will show a menu and opening it a second time will show a window. This was documented in bug #438153.
Comment 7 Bug Janitor Service 2022-03-07 14:02:31 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1527
Comment 8 Nate Graham 2022-03-20 15:06:09 UTC
*** Bug 450793 has been marked as a duplicate of this bug. ***
Comment 9 David Edmundson 2022-04-28 13:15:57 UTC
*** Bug 435013 has been marked as a duplicate of this bug. ***
Comment 10 David Redondo 2022-05-06 12:12:16 UTC
Git commit 338772ca404e35ee54d98ba6c8c8f5b9224b6d0f by David Redondo.
Committed on 06/05/2022 at 07:27.
Pushed by davidre into branch 'master'.

Open Klipper under mouse also on wayland

On Wayland if Plasma had no focus when the shortcut was invoked
- the menu window is  created as toplevel because it has no parent and
  there is no current focusWindow
- the application can't know the currrent cursor position
We use a newly introduced request on plasma_surface to open under the cursor.
As it can only be called before mapping a buffer to a surface, the menu is hidden
before being shown again.
FIXED-IN:5.25

M  +1    -0    klipper/CMakeLists.txt
M  +34   -1    klipper/klipper.cpp
M  +11   -0    klipper/klipper.h

https://invent.kde.org/plasma/plasma-workspace/commit/338772ca404e35ee54d98ba6c8c8f5b9224b6d0f
Comment 11 David Redondo 2022-05-06 12:12:24 UTC
Git commit 0521870150184769045e6bcec460ff87313d10c8 by David Redondo.
Committed on 06/05/2022 at 07:27.
Pushed by davidre into branch 'master'.

klipper: Set FramelessWindowHint

When Plasma does not have focus on Wayland, we can't avoid Qt creating a xdg_toplevel.
It will get a decoration by default by KWin. Setting the flag avoids this.

M  +1    -0    klipper/klipper.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/0521870150184769045e6bcec460ff87313d10c8
Comment 12 Nate Graham 2022-05-09 14:46:16 UTC
This causes Plasma to crash when I invoke the menu using Meta+V. See Bug 453578.