Commit Graph

38489 Commits

Author SHA1 Message Date
5369c77029 gesture: Simplify gesture/widget interaction public API
The propagation phase property/methods in GtkEventController are gone,
This is now set directly on the GtkWidget add/remove controller API,
which has been made private.

The only public bit now are the new functions gtk_gesture_attach() and
gtk_gesture_detach() that will use the private API underneath.

All callers have been updated.
2014-05-23 19:54:29 +02:00
f0940c962f widget: Keep a widget reference around _gtk_widget_run_controllers()
The widget may be destroyed within the loop, in reaction to the signals
sent by the controllers. Protect against that.
2014-05-23 19:54:29 +02:00
db55f8a4e5 gesture: Add explanatory note in GtkGesture::end
Explain that this signal may be triggered by an extra touch that causes
the gesture to surpass GtkGesture:n-points.
2014-05-23 19:54:29 +02:00
5c9f4bd078 gesture: Cancel sequences that make a gesture exceed the number of touches as they happen
This makes it possible to track those through gtk_gesture_handles_sequence(),
without guessing from last event type or sequence state.
2014-05-23 19:54:29 +02:00
134acf3fda widget: Change slightly the gesture cancellation policy in a same widget
Within a widget, if a gesture accepts a sequence, it would previously
cancel every other gesture that not in the same group. Change this to
only cancelling gestures that previously claimed the gesture, and let
gestures with state=NONE for that sequence remain like that.

This enables late recognition of gestures, even on the presence of
another gesture group that was more eager at claiming the gesture.

One usecase is user-defined panning gestures on scrolledwindows,
if ::capture-button-press is TRUE (eg. the default), the gesture is
claimed early in order to consume the button press, but that would
tipically make every other gesture group deny the sequence. With
this change, the pan gesture can keep state=NONE, and later claim
the sequence for itself if the panning gesture is recognized.

Also, do not propagate state=DENIED to every gesture in the widget,
that was unintended.
2014-05-23 19:54:29 +02:00
4589f0e0c8 rotate: Ensure delta is between [0..2π] 2014-05-23 19:54:29 +02:00
c34280d97b pan: make the direction factor less narrow in v/h directions 2014-05-23 19:54:29 +02:00
e080eafef8 gesture: Handle GDK_TOUCH_CANCEL events
The wayland windowing backend emits such events for instance, so
have gestures cancel the sequence as those events get through.
2014-05-23 19:54:29 +02:00
d9e6395ee9 gesture: Protect against odd window hierarchies
If no match is found with the gesture widget when poking the event
window parents, bail out safely instead of falling in an infinite
loop. This was seen on Mutter.
2014-05-23 19:54:29 +02:00
cbe47c02a1 swipe: Don't emit ::swipe if there are still active touches
Avoids sending spurious signals when an extra touch happens.
2014-05-23 19:54:28 +02:00
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
93b7883372 GtkSpinButton: Don't leak the gestures 2014-05-23 19:54:28 +02:00
c6c41262b6 GtkWindow: Don't leak the gesture 2014-05-23 19:54:28 +02:00
17088e4add GtkTreeView: Remove unused field 2014-05-23 19:54:28 +02:00
c63c1caac0 gtk3-demo: Don't leak the color chooser 2014-05-23 19:54:28 +02:00
3a752658ab GtkColorPlane: Actually add the long press gesture
This was missed because gtk_widget_remove_controller silently
does nothing on unowned controllers.
2014-05-23 19:54:28 +02:00
487ac50e93 GtkButton: Don't leak the gesture 2014-05-23 19:54:28 +02:00
616aac8d82 Forgotten file 2014-05-23 19:54:28 +02:00
0106099f5b GtkButton: Port to GtkGesture
Quick-and-dirty patch to use a GtkGestureSingle for both
button press/release and touch event handling.
2014-05-23 19:54:28 +02:00
f73f4d82e0 widget: remove GtkGesture-related signals
The utility of those signals is somewhat dubious now that there is
gtk_gesture_group(), so make that the only way to coordinate gestures.
The cooperation model offered by gtk_gesture_group() is flexible
enough,
2014-05-23 19:54:28 +02:00
bf6181a382 docs: Add missing GtkEventController functions 2014-05-23 19:54:28 +02:00
35bed1ac14 widget: Add docs for GtkGesture-related API 2014-05-23 19:54:28 +02:00
63dd7a568e gesturesingle: doc fixes 2014-05-23 19:54:28 +02:00
556eb398e5 zoom: doc fixes 2014-05-23 19:54:28 +02:00
ad2346f762 swipe: doc fixes 2014-05-23 19:54:28 +02:00
1f8cf3c322 rotate: doc fixes 2014-05-23 19:54:27 +02:00
135a653ee2 pan: doc fixes 2014-05-23 19:54:27 +02:00
24dc172b46 multipress: doc fixes 2014-05-23 19:54:27 +02:00
fa168e202e longpress: doc fixes 2014-05-23 19:54:27 +02:00
3cbd2b97b8 drag: doc fixes 2014-05-23 19:54:27 +02:00
ec50d776ce gesture: doc fixes 2014-05-23 19:54:27 +02:00
dbc7f011b3 eventcontroller: doc fixes 2014-05-23 19:54:27 +02:00
958efad71d docs: Add missing controller/gesture docs 2014-05-23 19:54:27 +02:00
a0e9de671b pan: Add missing documentation 2014-05-23 19:54:27 +02:00
c10998edb5 zoom: Add missing documentation 2014-05-23 19:54:27 +02:00
dc1e8454a7 rotate: Add missing documentation 2014-05-23 19:54:27 +02:00
2df48ba886 swipe: Add missing documentation 2014-05-23 19:54:27 +02:00
28237f80f5 drag: Add missing documentation 2014-05-23 19:54:27 +02:00
90b2f386e7 longpress: Add missing documentation 2014-05-23 19:54:27 +02:00
4602f34111 multipress: Add missing documentation 2014-05-23 19:54:27 +02:00
862f9d876e gesturesingle: Add missing documentation 2014-05-23 19:54:27 +02:00
ac8dcccb32 gesture: Add missing documentation 2014-05-23 19:54:27 +02:00
c60c0fe4c5 eventcontroller: Add missing documentation 2014-05-23 19:54:27 +02:00
48367b1432 enums: Add missing docs to controller/gesture enums 2014-05-23 19:54:27 +02:00
d768c2cb84 Remove GtkPressAndHold
This is replaced by GtkGestureLongPress, and all its callers have
been updated to use the replacement.
2014-05-23 19:54:26 +02:00
4401be22ad enums: Document GtkPropagationPhase 2014-05-23 19:54:26 +02:00
6296aa84b2 spinbutton: increase/decrease value on upwards/downwards touch swipes
This is somewhat analogous to scroll events on pointer devices, the
greater the velocity, the faster the spinbutton spins.
2014-05-23 19:54:26 +02:00
c7da5b54f5 Add GtkGesturePan
This gesture reports events on horizontal/vertical panning gestures.
2014-05-23 19:54:26 +02:00
75b6f4aa52 range: Replace GtkPressAndHold with GtkGestureLongPress 2014-05-23 19:54:26 +02:00
2166be96d2 swipe: Add function to retrieve the current velocity
This can be used to fetch the current velocity on update(), as opposed
to swipe() which happens after the sequence is finished.
2014-05-23 19:54:26 +02:00