Skip to content

[GTK/Wayland] Fix DragDetect coordinates using mouseDown position#3193

Open
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
vogella:dnd
Open

[GTK/Wayland] Fix DragDetect coordinates using mouseDown position#3193
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
vogella:dnd

Conversation

@vogella
Copy link
Copy Markdown
Contributor

@vogella vogella commented Apr 3, 2026

Fixes #3192

Root cause

On Wayland, drag detection is deferred to gtk3_motion_notify_event() because Wayland cannot deliver mouse events during the button-press handler. The original MouseDown is queued in dragDetectionQueue. When the drag threshold is exceeded, sendDragEvent() was called with the current motion event coordinates (8-12px past the click origin) instead of the original mouseDown coordinates.

This caused DragDetectEvent.x/y to be off-target. Eclipse platform.ui's DnDInfo.update() calls ctf.getItem(localPos) using those coordinates — if the cursor drifted off the narrow tab label, the lookup returned null and the drag silently aborted.

X11 is unaffected (drag detection runs inside the button-press handler and uses press coordinates directly).

Fix

In gtk3_motion_notify_event(), use dragDetectionQueue.getFirst() for the x/y coordinates and button number instead of reading from the motion event. The state mask still comes from the motion event (valid for modifier keys). This matches X11 behaviour.

Co-Authored-By: Claude Sonnet 4.6 [email protected]

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 eclipse-platform#3192

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Apr 3, 2026

Fix patch fixes the DnD for me.

@vogella vogella marked this pull request as ready for review April 3, 2026 14:36
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

Test Results (linux)

   85 files   -  3     85 suites   - 3   15m 0s ⏱️ +56s
4 556 tests  -  1  4 335 ✅  -  2  220 💤 ±0  1 ❌ +1 
3 238 runs   - 37  3 170 ✅  - 36   67 💤  - 2  1 ❌ +1 

For more details on these failures, see this check.

Results for commit 296eaeb. ± Comparison against base commit d820f7e.

This pull request removes 1 test.
org.eclipse.swt.tests.gtk.snippets.Bug336238_ShellSetBoundFailTest ‑ testSetBounds

@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Apr 3, 2026

Test_org_eclipse_swt_custom_BusyIndicator fail unrelated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drag and drop of views to other stacks is "harder"

1 participant