eclipse.platform.swt
eclipse.platform.swt copied to clipboard
[GTK] Incorrect screen coordinates reported (Wayland)
Describe the bug I'm running the latest Fedora 42 KDE (KDE Plasmal 6.3.4) with Wayland. Screen coordinates are reported relative to the snippet's shell left top corner of the client area. There is one SWT.Move event reported with the location (0, 0). Even moving the shell will not send any further SWT.Move events.
To Reproduce
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
public class MousePositions {
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
shell.addListener(SWT.MouseDown, event -> System.out.println("down: " + shell.toDisplay(event.x, event.y)));
shell.addListener(SWT.KeyDown, event -> System.out.println("pos " + display.getCursorLocation()));
shell.addListener(SWT.Move, event -> System.out.println("moved shell " + shell.getBounds()));
shell.setSize(400, 300);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
- click the mouse to get the screen coordinate logged from the SWT.MouseDown event
- press a key to get the screen coordinate logged from the display
- move the window to not see any move events (except of the initial one)
Expected behavior Get the coordinate from the screen.
Environment:
- Select the platform(s) on which the behavior is seen:
-
- [ ] All OS
-
- [ ] Windows
-
- [x] Linux
-
- [ ] macOS
- Additional OS info (e.g. OS version, Linux Desktop, etc) Fedora 42 KDE (latest updates)
Have you tried with other DE ? I didn't manage to reproduce it on Fedora 42 Gnome .
I only have another Manjaro XFCE machine (hence X11). On that I can't reproduce the problem either.
On Ubuntu 25.04 I see the same as you report:
moved shell Rectangle {26, 23, 400, 300}
and then no more move messages
With SWT_GTK4=1 I see very similar, but the coords are 0,0 instead:
moved shell Rectangle {0, 0, 400, 300}
with GDK_BACKEND=x11 it works, I see two messages initially:
moved shell Rectangle {0, 0, 400, 300}
moved shell Rectangle {3640, 536, 400, 300}
and then moving the window causes more move messages.
Have you tried with other DE ? I didn't manage to reproduce it on Fedora 42 Gnome .
I've now installed Fedora 41 Gnome on a different machine (not yet updated to Fedora 42) and see the exact behavior as on Fedora 42 KDE.