Ignore gesture events when zoom gesture isn't active#544
Merged
arch1t3cht merged 1 commit intoTypesettingTools:masterfrom Feb 20, 2026
Merged
Ignore gesture events when zoom gesture isn't active#544arch1t3cht merged 1 commit intoTypesettingTools:masterfrom
arch1t3cht merged 1 commit intoTypesettingTools:masterfrom
Conversation
Contributor
Author
|
I also got a minimal example that reproduces the bug: #include <wx/wx.h>
class MyApp : public wxApp {
public:
virtual bool OnInit() {
auto frame = new wxFrame(NULL, wxID_ANY, "Zoom Gesture Test", wxDefaultPosition, wxSize(300, 200));
auto myControl = new wxControl(frame, wxID_ANY);
myControl->EnableTouchEvents(wxTOUCH_ZOOM_GESTURE);
myControl->Bind(wxEVT_GESTURE_ZOOM, [](auto &event) {
wxLogDebug("Zoom Gesture%s at (%d, %d) zoom factor %f",
event.IsGestureStart() ? " Start" : event.IsGestureEnd() ? " End" : "",
event.GetPosition().x, event.GetPosition().y, event.GetZoomFactor());
});
myControl->Bind(wxEVT_CONTEXT_MENU, [myControl](auto &) {
wxMenu menu;
menu.Append(wxID_ANY, "Menu Item");
myControl->PopupMenu(&menu);
});
frame->Show();
return true;
}
};
wxIMPLEMENT_APP(MyApp); |
Contributor
Author
|
And I found the culprit: g_signal_connect (m_zoom_gesture, "begin",
G_CALLBACK(zoom_gesture_begin_callback), win);
g_signal_connect (m_zoom_gesture, "scale-changed",
G_CALLBACK(zoom_gesture_callback), win);
g_signal_connect (m_zoom_gesture, "end",
G_CALLBACK(zoom_gesture_end_callback), win);
g_signal_connect (m_zoom_gesture, "cancel",
G_CALLBACK(zoom_gesture_end_callback), win);wxWidgets treats |
Member
|
Thanks for debugging this. In that case I'd like to report this upstream first so that the relevant github issue can be linked in a code comment (so future developer can more easily tell whether the issue is still present or has since been fixed). I'll do that soon unless you want to do it yourself. |
Contributor
Author
On wxGTK+Wayland, right-clicking sends the last GestureEnd event again, which was not caught by the existing workaround. Instead of trying to pattern-match the false events, let's ignore all events unless we received a GestureStart event first.
6cf2f4b to
d6e4a1c
Compare
Contributor
Author
|
Rebased and added the link to the comment. |
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On wxGTK+Wayland, right-clicking sends the last GestureEnd event again, which was not caught by the existing workaround.
Instead of trying to pattern-match the false events, let's ignore all events unless we received a GestureStart event first.
(This has a merge conflict with #542. If you merge #542 first, you can use 5548e10. If you merge this first, I will rebase #542.)