Bug 429338 - Context menus shown in wrong locations on Wayland
Summary: Context menus shown in wrong locations on Wayland
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Usability-Menus (show other bugs)
Version: 7.1.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-19 09:16 UTC by Chris Lane
Modified: 2022-11-01 13:07 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In: 7.4.0


Attachments
Menus open in wrong location if left most monitor isn't at 0,0 (3.59 MB, video/mp4)
2021-03-13 15:08 UTC, Schlaefer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Lane 2020-11-19 09:16:05 UTC
SUMMARY
When attempting to open any right click context menus or menu bar menus, none are visible unless digiKam was opened with Xwayland.

STEPS TO REPRODUCE
1. Open digiKam
2. Attempt to open right click context menus or attempt to open any menu bar menu

OBSERVED RESULT
- When I test this on my laptop monitor, the context menus show on my external monitor (positioned to the right).
- When I test this on my external monitor, I don't see context menus at all.
- When I test this on my laptop with no external monitor, I don't see context menus at all.

EXPECTED RESULT
Context menus are always positioned within the same window, touching the pointer.

SOFTWARE/OS VERSIONS
Linux: Arch Linux 5.9.8-arch1-1
Sway WM: sway version 1.5-f5ca4c26 (Nov 18 2020, branch 'master') 
Qt Version: 5.15.1-3

ADDITIONAL INFORMATION
- I originally created the following issue for my window manager:
https://github.com/swaywm/sway/issues/5826
- The issue is exacerbated by my window manager config which sets the output scaling and position.
- The issue _should_ be fixed by specifying the parent for a context menu. See the following link for more info: https://community.kde.org/Guidelines_and_HOWTOs/Wayland_Porting_Notes
Comment 1 Maik Qualmann 2020-11-19 20:29:40 UTC
I cannot reproduce the problem here on a full Plasma Wayland session with KWin (openSUSE). Except for the splash screen, all context menus open on the correct monitor, in the correct position. QSplashScreen seems to have a bug, even with added QScreen as parent it opens incorrectly. But otherwise everything is ok. When I look over the source code, we have set a parent almost everywhere, in any case all menus in the menu bar.
Can the problem only be reproduced with digiKam or do Dolphin, Krita or Gwenview show the same problem?

Maik
Comment 2 Chris Lane 2020-11-19 21:48:45 UTC
(In reply to Maik Qualmann from comment #1)
> I cannot reproduce the problem here on a full Plasma Wayland session with
> KWin (openSUSE). Except for the splash screen, all context menus open on the
> correct monitor, in the correct position. QSplashScreen seems to have a bug,
> even with added QScreen as parent it opens incorrectly. But otherwise
> everything is ok. When I look over the source code, we have set a parent
> almost everywhere, in any case all menus in the menu bar.
> Can the problem only be reproduced with digiKam or do Dolphin, Krita or
> Gwenview show the same problem?
> 
> Maik

Were you trying with screen scaling and position adjustments? I'll try to reproduce on a different WM too
Comment 3 Chris Lane 2020-11-20 10:17:40 UTC
I've been told that this issue will only occur when the top-left output is not at (0, 0). Since Weston doesn't seem to have output repositioning options, I can't test using the reference implementation.
Comment 4 Schlaefer 2021-03-13 15:08:29 UTC
Created attachment 136646 [details]
Menus open in wrong location if left most monitor isn't at 0,0


I experience the same issue not only in digikam but all apps. If the left most monitor isn't at 0,0 the menus are off. See attached video showing Dolphin and Konsole.

Operating System: EndeavourOS
KDE Plasma Version: 5.21.2
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2
Kernel Version: 5.11.6-zen1-1-zen
Graphics Processor: Radeon RX 5500 XT Wayland
Comment 5 Marco Rebhan 2021-05-18 08:25:04 UTC
This seems to be a problem with not only KDE applications, although not all Qt applications. I can reproduce with the Qt app I'm writing right now (doesn't use any KDE code), KeePassXC (not KDE), Dolphin, Okular, KMail. But not MultiMC, Mumble, QOwnNotes or qjackctl, which are all also Qt applications.

I'm pretty sure in Okular this same issue breaks dragging the document up/down above a certain position (instead of dragging properly, it will scroll downwards very fast) because it happens at the same cutoff point (which I'm guessing is how far away the leftmost monitor is vertically from y=0) that context menus start appearing at.

Good to know the workaround for it though.

Operating System: Gentoo
KDE Plasma Version: 5.21.90
KDE Frameworks Version: 5.82.0
Qt Version: 5.15.2
Kernel Version: 5.12.4-gentoo (64-bit)
Graphics Platform: Wayland
Graphics Processor: Radeon RX Vega
Comment 6 Chris Lane 2021-07-12 09:53:30 UTC
I just had a bunch of my KDE packages update including digiKam to 7.3.0 and kwayland to 5.84.0.
This issue seems to be resolved for me! 🎉

If some others are able to confirm that this is fixed for them with the versions listed above, I think this should be marked as resolved.

Thanks so much for the hard work devs!
Comment 7 caulier.gilles 2021-07-15 14:22:33 UTC
Ok i mark this file as fixed...

Reopen if necessary

Gilles Caulier
Comment 8 David Marzal 2022-07-05 21:46:35 UTC
I have the same issue that Schlaefer, exactly as shown in the video. Setting the left monitor to 0.0 fix the issue, but is an impractical workaround to change monitors with the cursor.

Operating System: Arch Linux
KDE Plasma Version: 5.25.2
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.5
Kernel Version: 5.18.9-hardened1-1-hardened (64-bit)
Graphics Platform: Wayland
Graphics Processor: AMD Radeon RX 580 Series

I have looked at this other bugs, but the video of this one (429338) is the more accurate.
https://bugs.kde.org/show_bug.cgi?id=453532
https://bugs.kde.org/show_bug.cgi?id=451168
https://bugs.kde.org/show_bug.cgi?id=448498
https://bugs.kde.org/show_bug.cgi?id=404799
https://bugs.kde.org/show_bug.cgi?id=395177

Should I open a new bug?
Comment 9 Anders Piniesjö 2022-11-01 13:07:40 UTC
(In reply to David Marzal from comment #8)
> I have the same issue that Schlaefer, exactly as shown in the video. Setting
> the left monitor to 0.0 fix the issue, but is an impractical workaround to
> change monitors with the cursor.
> 
> Operating System: Arch Linux
> KDE Plasma Version: 5.25.2
> KDE Frameworks Version: 5.95.0
> Qt Version: 5.15.5
> Kernel Version: 5.18.9-hardened1-1-hardened (64-bit)
> Graphics Platform: Wayland
> Graphics Processor: AMD Radeon RX 580 Series
> 
> I have looked at this other bugs, but the video of this one (429338) is the
> more accurate.
> https://bugs.kde.org/show_bug.cgi?id=453532
> https://bugs.kde.org/show_bug.cgi?id=451168
> https://bugs.kde.org/show_bug.cgi?id=448498
> https://bugs.kde.org/show_bug.cgi?id=404799
> https://bugs.kde.org/show_bug.cgi?id=395177
> 
> Should I open a new bug?

This also happens to me when using a desktop setup with two monitors, left one in landscape mode and the right monitor in portait mode. When I run Wayland and klicks any menubar title, then the menu is shown 1-2 decimeters below the expected vertical position. I get the feeling that the taller right screen causes it to wrongly calculate positions.