Bug 444529 - [Wayland] Menus sometimes open at the wrong horizontal position on dual-monitor setups
Summary: [Wayland] Menus sometimes open at the wrong horizontal position on dual-monit...
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (other bugs)
Version First Reported In: 5.23.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL: https://bugreports.qt.io/browse/QTBUG...
Keywords: wayland-only
Depends on:
Blocks:
 
Reported: 2021-10-28 10:01 UTC by Berengal
Modified: 2022-01-19 19:14 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Demonstration of the wrong menu position (830.67 KB, image/jpeg)
2021-10-28 10:03 UTC, Berengal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Berengal 2021-10-28 10:01:39 UTC
SUMMARY
On a dual-monitor setup where the left monitor is smaller than the right, menus opened on the right monitor have the wrong horizontal position if the window coordinate of the click is outside the range of possible screen coordinates of the left monitor.

The range of possible coordinates take into account the vertical position relative to the right monitor, so if for example the top of the left monitor is set to 100px below the top of the right monitor, the vertical span of the left monitor is 100-1180 (on a 1080p monitor). The horizontal coordinate seems to always start at 0.

It's the window coordinate of the open window that matters, not the screen coordinate on the right screen. This makes the bug very noticeable if the left monitor isn't top-aligned vertically since every menubar menu opens on the far right and is very hard to use. But the bug still appears when clicking to the right or below the left monitor size. You just need a large enough window and a reason to open a menu in those extreme positions.

The vertical position is correct, but the horizontal position is set equal to the max horizontal position of the left monitor.

STEPS TO REPRODUCE
1. Have two monitors with different resolutions (scaling works)
2. Put the smallest monitor left of the larger in the display configuration system setting. It's easiest to see if the top of the left monitor is below the top of the right monitor.
3. Open Kate (or another KDE program) on the right monitor and open a menu (from the menubar, right-click or dropdown) in different positions on the window

OBSERVED RESULT
The opened menu sometimes opens far to the right, at the max horizontal position of the left monitor.

EXPECTED RESULT
The opened menu always appears under or right next to the mouse.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Archlinux (5.14.14-arch1-1)
KDE Plasma Version: 5.23.2
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
This doesn't happen on X11. Most programs have this issue, but not all of them. Every KDE app I've tried has this bug, but firefox and KeePassXC doesn't, and right-clicking on the desktop also works as expected.
Comment 1 Berengal 2021-10-28 10:03:31 UTC
Created attachment 142961 [details]
Demonstration of the wrong menu position
Comment 2 Vlad Zahorodnii 2022-01-19 19:14:34 UTC
It's a Qt bug.