Fix wxGTK gesture handling (PR #26241)

11 views
Skip to first unread message

filip-hejsek

unread,
Feb 24, 2026, 11:37:00 AM (yesterday) Feb 24
to wx-...@googlegroups.com, Subscribed

This PR fixes several issues with gesture handling in wxGTK. The most severe issue is #26211, which is that gesture cancellation can result in spurious gesture end events. Another issue is that gesture handling used several global variables, even though there can be multiple independent gestures of the same type active in different windows.

I have tested the changes with both a touchpad and a touchscreen and everything seems to work perfectly. Since I don't have an actual touchscreen, I did the testing by configuring my system to recognize my touchpad as a touchscreen. I have tested:

  • GNOME Wayland and XWayland with touchpad and touchscreen
  • Weston Wayland and XWayland with touchscreen (Weston doesn't seem to support touchpad gestures)
  • Xorg with touchpad and touchscreen

I was able to trigger two pan gestures at once in Weston by modifying the sample to open two windows, and using a touchscreen in one window and a mouse in the other. The existing code was horribly broken in this scenario, this PR fixes it.


You can view, comment on, or merge this pull request online at:

  https://github.com/wxWidgets/wxWidgets/pull/26241

Commit Summary

  • ed9b5ea Fix wxGTK gesture handling

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26241@github.com>

VZ

unread,
Feb 24, 2026, 11:54:30 AM (yesterday) Feb 24
to wx-...@googlegroups.com, Subscribed

@vadz approved this pull request.

Thanks, I'm unable to test this (if anybody else can, please leave a comment!), but the changes look good to me.

Ideal would be to split this into several commits, e.g. one for moving gs_xxx into wxWindowGesturesData, maybe another one for the angle confusion fix and then the other changes, so perhaps I'll try doing this when applying it. But if I fail to do it quickly, I'll just apply this as is as it seems important to have it in 3.3.2.

Thanks again!


In src/gtk/window.cpp:

>      wxRotateGestureEvent event(win->GetId());
 
     event.SetEventObject(win);
     event.SetPosition(wxPoint(wxRound(x), wxRound(y)));
     event.SetGestureStart();
+    event.SetRotationAngle(0);

Not very important, but this is the default, why call it explicitly?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26241/review/3849238083@github.com>

filip-hejsek

unread,
Feb 24, 2026, 11:58:29 AM (yesterday) Feb 24
to wx-...@googlegroups.com, Subscribed

@filip-hejsek commented on this pull request.


In src/gtk/window.cpp:

>      wxRotateGestureEvent event(win->GetId());
 
     event.SetEventObject(win);
     event.SetPosition(wxPoint(wxRound(x), wxRound(y)));
     event.SetGestureStart();
+    event.SetRotationAngle(0);

To make it extra clear that the value is the same as what we assign to m_lastAngleDelta. Fell free to remove this (along with event.SetZoomFactor(1); in the zoom callback).


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26241/review/3849276947@github.com>

filip-hejsek

unread,
Feb 24, 2026, 2:58:42 PM (yesterday) Feb 24
to wx-...@googlegroups.com, Push

@filip-hejsek pushed 4 commits.

  • 5f8b8dd Fix incorrectly named parameters in angle-changed callback in wxGTK
  • f009677 Move global gesture variables in wxGTK into wxWindowGesturesData
  • 737c533 Fix rotate gesture start callback not setting last angle in wxGTK
  • e8bf4b6 Fix spurious GestureEnd events from cancel signal in wxGTK


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26241/before/ed9b5ea368814a3d0799657d8763528f13700654/after/e8bf4b6bc5ab7c5c3a85af03600875c24b46587c@github.com>

filip-hejsek

unread,
Feb 24, 2026, 2:59:19 PM (yesterday) Feb 24
to wx-...@googlegroups.com, Subscribed

@filip-hejsek commented on this pull request.


In src/gtk/window.cpp:

>      wxRotateGestureEvent event(win->GetId());
 
     event.SetEventObject(win);
     event.SetPosition(wxPoint(wxRound(x), wxRound(y)));
     event.SetGestureStart();
+    event.SetRotationAngle(0);

Removed now.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26241/review/3850226685@github.com>

filip-hejsek

unread,
Feb 24, 2026, 3:02:04 PM (yesterday) Feb 24
to wx-...@googlegroups.com, Subscribed
filip-hejsek left a comment (wxWidgets/wxWidgets#26241)

Ideal would be to split this into several commits, e.g. one for moving gs_xxx into wxWindowGesturesData, maybe another one for the angle confusion fix and then the other changes, so perhaps I'll try doing this when applying it. But if I fail to do it quickly, I'll just apply this as is as it seems important to have it in 3.3.2.

I did the extra work to separate the changes. I didn't at all test the intermediate states this created though.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26241/c3954421734@github.com>

VZ

unread,
Feb 24, 2026, 6:11:12 PM (yesterday) Feb 24
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26241)

Nice, thanks a lot for doing this! Will merge soon but probably not today.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26241/c3955244847@github.com>

Reply all
Reply to author
Forward
0 new messages