Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wxGesture on touchscreen only: missing mouse move and click events when enabling touch events #19265

Closed
wxtrac opened this issue Sep 21, 2021 · 3 comments

Comments

@wxtrac
Copy link
Collaborator

@wxtrac wxtrac commented Sep 21, 2021

Issue migrated from trac ticket # 19265

component: wxGTK | priority: normal | resolution: fixed | keywords: gesture, mouse

2021-09-21 11:17:21: tbultel created the issue


On this setup:
Ubuntu 21.04 on RPI 4

When using a touchscreen (UPERFECT Ui06) without an additional mouse,
and enabling either wxTOUCH_ZOOM_GESTURE, or wxTOUCH_PRESS_GESTURE,
mouse events that were caught with a callback like EVT_MOUSE_EVENTS(MyFrame::MouseEvent)
do not report neither MouseMove events, nor LeftDown/LeftUp events anymore.

Since wxTOUCH_PAN_GESTURE only work horizontally or vertically,
it is impossible to perform a diagonal scroll on a map, for instance.

Moreover, when some logics in the application requires an action on
LeftDown for instance (no LongPress), it is not possible to trig it anymore.

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Sep 22, 2021

2021-09-22 18:45:09: tbultel commented


At first analysis, the usage of the touch_callback

g_signal_connect (widget, "touch-event",
                  G_CALLBACK(touch_callback), win);

... hides the motion-notify-event
Instead, motion events are reported through the GDK_TOUCH_UPDATE
type in gdk_event->type in the touch_callback

But the current implementation does not forward a motion event in this case...

Additionnaly ,'simple touch', that is to say a touch that is not long,
correctly leads to a GDK_TOUCH_BEGIN followed by a GDK_TOUCH_END,
and press events are masked.

As far as I understand, the fix would consists in the following things:
-> forwarding motion event. (A dirty fix that consists in calling
gtk_window_motion_notify_callback inthe GTK_TOUCH_UPDATE case works fine)

-> faking a LeftDown event upon GDK_TOUCH_BEGIN
-> faking a LeftUp event upon GDK_TOUCH_END

I can work on a patch for this but any comments are welcome !

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Sep 24, 2021

2021-09-24 14:57:08: @vadz commented


Sorry, I can't even test this code as touch display on my Linux notebook has stopped working a couple of years ago and I don't have any other device running wxGTK with touch support (hmm, GTK for Android, anyone?), so it's difficult for me to say anything useful about this problem.

But your explanation looks convincing and if you can actually test that your patch implementing it works as expected, I'd be glad to apply it, thanks in advance!

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Oct 2, 2021

2021-10-02 15:06:51: @vadz changed status from new to closed

2021-10-02 15:06:51: @vadz set resolution to fixed

2021-10-02 15:06:51: @vadz commented

In 746da37:
Fix missing mouse events when using gesture events in wxGTK

When touch events were enabled, normal mouse move and click events were
not generated any longer. Fix this by doing the following two things:

First, emulate the LeftDown, LeftUp, and Motion events, that are no
longer triggered when using the "touch-event".

In addition, remove GDK_BUTTON1_MASK in the press callback, that is
never set when using a mouse, but that is set for some reason by GTK
when using a touchscreen.

See #2539

Closes #19265.

Signed-off-by: Thierry Bultel tbultel@free.fr

@wxtrac wxtrac closed this Oct 2, 2021
vvs31415 pushed a commit to vvs31415/wxWidgets that referenced this issue Jan 16, 2022
When touch events were enabled, normal mouse move and click events were
not generated any longer. Fix this by doing the following two things:

First, emulate the LeftDown, LeftUp, and Motion events, that are no
longer triggered when using the "touch-event".

In addition, remove GDK_BUTTON1_MASK in the press callback, that is
never set when using a mouse, but that is set for some reason by GTK
when using a touchscreen.

See wxWidgets#2539

Closes wxWidgets#19265.

Signed-off-by: Thierry Bultel <tbultel@free.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant