Commit Graph

23 Commits

Author SHA1 Message Date
Carlos Garnacho
ed34be8bb3 gtkgesturesingle: Fallback to GtkGesture handling on GDK_TOUCHPAD_SWIPE
There are GtkGestureSingle subclasses that can be made to handle multiple
fingers (GtkGestureSingle is a subclass of GtkGesture, and not the
opposite, after all). And GtkGestureSwipe already tries to handle
GDK_TOUCHPAD_SWIPE events, except this event handler silently ignores
those.

Falling back to the GtkGesture generic handler which already
handles touchpad gesture events fixes this.
2017-03-02 18:25:04 +01:00
Timm Bäder
c219bdbecc Gestures: Add some nullable annotations 2015-12-12 09:29:08 +01:00
Matthias Clasen
3077a7e025 gesture single: Convert to g_object_notify_by_pspec
This avoids pspec lookup overhead in g_object_notify.
2015-09-06 17:11:37 -04:00
Matthias Clasen
28b4599f9b gesture single: Use gtk_simulate_touchscreen
Instead of manual tests.
2015-07-31 13:46:35 -04:00
Carlos Garnacho
8bf5b175b1 gesturesingle: Ignore motion/updates from unhandled sequences
This used to do the right thing, practically ignoring those event
if they went all through the event handler, unless this motion event
triggered the cancellation of this gesture from the event handler
of another controllers.

In this case, the controller would be reset, but the motion event
would still go through its handler, setting again
current_button/sequence as the motion event has buttons in its
modifiers. This leaves GtkGestureSingle with inconsistent data
that may interfere with future runs.

https://bugzilla.gnome.org/show_bug.cgi?id=747469
2015-04-13 17:27:04 +02:00
Carlos Garnacho
dca2f4386d gesturesingle: check for the sequence being handled, not just the event
Checking the return value was valid for most gestures, but
GtkGestureLongPress, where the first press triggers internally an action,
but does nothing for the sequence to be claimed/denied, FALSE was eventually
returned, and the button/sequence functions would be incorrect when
::pressed is emitted.

So check that the sequence is being handled by the gesture, this is more
desirable than the return value as it's independent of sequence state,
and still will be FALSE for the cases we want to catch here.
2014-12-18 21:20:17 +01:00
Carlos Garnacho
cfaec2d2f5 gtkgesturesingle: Unset button/sequence if parent handle_event failed
There are legit reasons for GtkGesture::handle_event to return FALSE,
GtkGestureSingle objects should be unsetting the current button/sequence
if that happens, in order to avoid inconsistent states.

https://bugzilla.gnome.org/show_bug.cgi?id=738591
2014-10-17 21:16:56 +02:00
Ikey Doherty
6e1ef76480 Cleanup invalid comments (duplication of words)
https://bugzilla.gnome.org/show_bug.cgi?id=735301

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2014-08-26 19:55:38 -04:00
Matthias Clasen
e0af2ba7c7 GtkGestureSingle: Update declared defaults of properties
These should match the initial values, which were changed a
few commits ago. The defaultvalue test fails if there is a
mismatch, like here.
2014-08-15 13:12:15 -04:00
Carlos Garnacho
9ad4f1e62c gesturesingle: Change default values of button and touch-only properties
This now defaults to sane values on mice, so touch-only is set to FALSE,
and button is set to GDK_BUTTON_PRIMARY;

https://bugzilla.gnome.org/show_bug.cgi?id=734285
2014-08-15 13:49:39 +02:00
Matthias Clasen
34245515e5 Add a 'touchscreen' debug flag
This has the same effect as the GTK_TEST_TOUCHSCREEN environment
variable, but can be toggled at runtime.
2014-07-10 10:12:02 -04:00
Carlos Garnacho
6d8842ca96 gesturesingle: Implement GtkGesture::cancel better than GtkEventController:reset
The former can be called individually on each sequence, and the latter will
always call the former on all currently active sequences, so only implementing
resetting on cancel() works for both cases. Also, chain up on subclasses
implementing cancel.

This fixes clicking on nautilus' file list after popping up a menu, as broken
grabs are one of those situations where sequences get cancelled individually,
the "current button" wasn't properly reset, and further clicks with button != 3
were ignored.
2014-06-13 01:27:31 +02:00
Carlos Garnacho
20a59985fe gesturesingle: Ensure the current button stays set until after the touch/button release
This makes gtk_gesture_get_current_button() work properly on GtkGesture::end, and signals
spawn from there on subclasses.
2014-06-11 17:36:03 +02:00
Matthias Clasen
f195322254 GtkGestureSingle: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:31:03 -04:00
Matthias Clasen
0442431943 Docs: Cosmetic fixes 2014-05-23 19:54:33 +02:00
Matthias Clasen
aead8a360b Docs: Minor changes 2014-05-23 19:54:32 +02:00
Carlos Garnacho
0b3f4d5555 gesturesingle: Add an "exclusive" boolean property
All "exclusive" gestures listen for either pointer events, or
"pointer emulating" touch events, so only a single sequence at
a time can make these run.
2014-05-23 19:54:31 +02:00
Carlos Garnacho
3d34f26a6a gesture: Handle GdkEventGrabBroken
That may happen separately from grab-notify, and also due to external
reasons, so ensure all sequences are cancelled if a grab is taken
in some GdkWindows that would obscure events on the controller.
2014-05-23 19:54:30 +02:00
Matthias Clasen
42df9eda2d Prevent subclassing of gestures
For now, at least. We do this by hiding the instance and
class structures in private headers.
2014-05-23 19:54:28 +02:00
Carlos Garnacho
63dd7a568e gesturesingle: doc fixes 2014-05-23 19:54:28 +02:00
Carlos Garnacho
862f9d876e gesturesingle: Add missing documentation 2014-05-23 19:54:27 +02:00
Carlos Garnacho
cdb5ba9426 gesturesingle: check the current sequence before resetting the pressed button 2014-05-23 19:54:26 +02:00
Carlos Garnacho
d4d0f13c3a Add GtkGestureSingle
This is a GtkGesture subclass, specific to single-touch (or
mouse operated) gestures.
2014-05-23 19:54:22 +02:00