Bug 492018 - Wrong mouse position in popup menus in Java apps using AWT/Swing
Summary: Wrong mouse position in popup menus in Java apps using AWT/Swing
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: X11 Integration (show other bugs)
Version: git master
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-22 03:18 UTC by Jin Liu
Modified: 2024-08-22 03:20 UTC (History)
0 users

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


Attachments
screenshot (562.63 KB, image/png)
2024-08-22 03:20 UTC, Jin Liu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jin Liu 2024-08-22 03:18:21 UTC
SUMMARY
kwin has a change in when `ConfigureNotify` is sent:
https://invent.kde.org/plasma/kwin/-/commit/7b486e215d44bbd9fdeb8f1180c76fb16ec6a311

The above change conforms to ICCCM, but it breaks Java apps using Swing: after maximizing the app window, in popup menus, the app considers the mouse cursor to be at a different position than it visually is, as if the app window is in the position before maximizing.

We suspect this is caused by AWT special-casing `ConfigureNotify` behavior on a WM whitelist:
https://github.com/openjdk/jdk/blob/88ccbb60919e4523064b0da17184eedcd9efa087/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java#L772
And `kwin` is not in the list. Making `kwin` disguise as `mutter` fixes the problem, which confirms the theory.

Upstream bug report:
https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8338752

STEPS TO REPRODUCE
1. Start KDE Plasma 6.2-dev.
2. Start the Java app `jdownloader2`, unmaximized.
3. Move the app window to the screen center.
4. Maximize the app window.
5. Right click to show the popup menu.

OBSERVED RESULT
Mouse is considered to be to the top-left of its actual position.

EXPECTED RESULT
Mouse works alright in the menu.
Comment 1 Jin Liu 2024-08-22 03:20:02 UTC
Created attachment 172838 [details]
screenshot