Skip to content

fix: Handle window drag by touch input#444

Merged
3v1n0 merged 1 commit intoubuntu:mainfrom
aleasto:touch
Apr 9, 2026
Merged

fix: Handle window drag by touch input#444
3v1n0 merged 1 commit intoubuntu:mainfrom
aleasto:touch

Conversation

@aleasto
Copy link
Copy Markdown
Contributor

@aleasto aleasto commented Mar 31, 2026

global.get_pointer() does not track touch input, so when initiating a drag via touchscreen we would be incorrectly tracking the mouse position instead.

Unfortunately, in GNOME 50 there is no API to get information on the touch point that is driving the window drag from Display::grab-op-begin. The best we can do is track global events happening before grab-op-begin and try to infer which touch point is driving the drag. Specifically, the global stage receives a LEAVE event from the device starting the window drag immediatly prior to Display::grab-op-begin.

For this implementation we use the Clutter.Sprite API which is new in GNOME 49, and specifically Cluter.Sprite::get_coords() which is new in GNOME 50, but we fall-back to global.get_pointer() to support older shell versions, where however the bug will not be fixed.

@aleasto aleasto force-pushed the touch branch 2 times, most recently from a1464fd to 52799bb Compare April 1, 2026 08:30
@vanvugt
Copy link
Copy Markdown
Contributor

vanvugt commented Apr 2, 2026

Unfortunately, in GNOME 50 there is no API to get information on the touch point that is driving the window drag

There might be an existing API hiding under the name of "cursor" or "sprite" as it's now called. Just get the current one relevant to the drag. Oh you already found that.

@aleasto
Copy link
Copy Markdown
Contributor Author

aleasto commented Apr 2, 2026

Yes but there's not enough information in the Display::grab-op-begin callback to query the right Sprite, so we have to go through other signals first.

@Leleat
Copy link
Copy Markdown
Collaborator

Leleat commented Apr 6, 2026

I don't know enough about GNOME Shell's/mutter's internals to really review this (nor do I have a touch device to test this). But since this doesn't seem to interfere with the existing behavior, I'll merge it.

Could you just please "disconnect" the global.stage signal in the destroy method?

global.get_pointer() does not track touch input, so when initiating a drag via
touchscreen we would be incorrectly tracking the mouse position instead.

Unfortunately, in GNOME 50 there is no API to get information on the touch
point that is driving the window drag from Display::grab-op-begin.
The best we can do is track global events happening before grab-op-begin and
try to infer which touch point is driving the drag. Specifically, the global
stage receives a LEAVE event from the device starting the window drag
immediatly prior to Display::grab-op-begin.

For this implementation we use the Clutter.Sprite API which is new in GNOME 49,
and specifically Cluter.Sprite::get_coords() which is new in GNOME 50, but we
fall-back to global.get_pointer() to support older shell versions, where
however the bug will not be fixed.
@3v1n0 3v1n0 merged commit 92bb7c6 into ubuntu:main Apr 9, 2026
3 checks passed
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.

4 participants