https://bugs.kde.org/show_bug.cgi?id=485703

            Bug ID: 485703
           Summary: [wayland] Klipper popup menu position offset unless on
                    top display.
    Classification: Plasma
           Product: plasmashell
           Version: 6.0.4
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Clipboard
          Assignee: plasma-b...@kde.org
          Reporter: eamonn...@protonmail.com
  Target Milestone: 1.0

SUMMARY
Note that I believe this bug to be distinct from Bug 482076.

On a display layout where there are multiple displays (at least two) above and
below each other (at least one below), and at least one of those bottom
displays are offset to the side of a top display (such as a laptop offset to
the side of two displays above it), the Klipper popup menu appears offset from
the mouse position on the bottom displays, but displays correctly on the top
displays and occasionally displays correctly on the bottom display.

The offset varies greatly, and is seemingly random, as opening and closing the
popup after moving the mouse between displays can produce widely varied
results.

I took a look at the code, and this may be a result of the Klipper popup menu
using `QCursor::pos()` ('a' and 'b' links, I'm unsure which is relevant), which
I believe is unreliable under Wayland ('c' and 'd' links). I am by no means an
expert and all the information provided here could be wrong, but I figured I'd
post my findings of where I left off from investigating it myself.

A solution based on KDE documentation may be to use `event->globalPos()` for
this popup menu ('e' link), which I believe could count as a context menu(?). I
am highly unsure what event we could get the globalPos in these instances,
though. 
- In the `klipper.cpp` reference, I am not too sure. Perhaps it can come from
`connect`?
- In `klipperpopup.cpp`, perhaps `QShowEvent` has a reference to globalPos?

Some usages in Qt of `globalPos` are listed as deprecated for some event types
(link 'f'), but I'm not sure if that applies here.

I would test this and submit an MR myself, but I don't have an environment
setup for tinkering with Plasmashell.


STEPS TO REPRODUCE
1. Open the Klipper popup with the display configuration described
2. Observe offset mouse position on some displays, sometimes appearing 


OBSERVED RESULT
The Klipper popup menu will usually not display under the mouse.


EXPECTED RESULT
The Klipper popup menu should always display under the mouse. 


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 6.8.4 Linux Zen
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.3


ADDITIONAL INFORMATION
Links referenced: 
a.
https://invent.kde.org/plasma/plasma-workspace/-/blob/819633d13e6aecbd7cd6e9bac6aa4e52675df80c/klipper/klipperpopup.cpp#L202
b.
https://invent.kde.org/plasma/plasma-workspace/-/blob/819633d13e6aecbd7cd6e9bac6aa4e52675df80c/klipper/klipper.cpp#L352
c.
https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3774#note_852169
d.
https://invent.kde.org/plasma/plasma-workspace/-/blob/819633d13e6aecbd7cd6e9bac6aa4e52675df80c/shell/shellcorona.cpp#L1631
e.
https://community.kde.org/Guidelines_and_HOWTOs/Wayland_Porting_Notes#Context_Menu

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to