Skip to content

Commit fa04053

Browse files
vogellaclaude
andcommitted
[GTK/Wayland] Fix DragDetect coordinates using mouseDown position
On Wayland, DragDetect was fired with the post-threshold motion coordinates instead of the original mouseDown position. This caused ctf.getItem() in Eclipse platform.ui's DnDInfo to return null when the cursor had drifted off the narrow tab label, silently aborting the drag. Fix: use the queued mouseDown event's x/y and button instead of the motion event values, matching the X11 behaviour. Fixes #3192 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d820f7e commit fa04053

File tree

1 file changed

+5
-5
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets

1 file changed

+5
-5
lines changed

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4143,14 +4143,14 @@ long gtk3_motion_notify_event (long widget, long event) {
41434143
int eventType = GDK.gdk_event_get_event_type(event);
41444144
if (eventType == GDK.GDK_3BUTTON_PRESS) return 0;
41454145

4146-
Point scaledEvent = new Point((int)eventX[0], (int) eventY[0]);
4147-
4148-
int [] eventButton = new int [1];
4146+
// Use the original mouseDown coordinates and button from the queued event,
4147+
// not the current motion event position (which is past the drag threshold
4148+
// and may be off the tab label, causing ctf.getItem() lookups to fail).
4149+
Event mouseDownEvent = dragDetectionQueue.getFirst();
41494150
int [] eventState = new int [1];
4150-
GDK.gdk_event_get_button(event, eventButton);
41514151
GDK.gdk_event_get_state(event, eventState);
41524152

4153-
if (sendDragEvent (eventButton[0], eventState[0], scaledEvent.x, scaledEvent.y, false)) {
4153+
if (sendDragEvent (mouseDownEvent.button, eventState[0], mouseDownEvent.x, mouseDownEvent.y, false)) {
41544154
return 1;
41554155
}
41564156
}

0 commit comments

Comments
 (0)