Commit Graph

38306 Commits

Author SHA1 Message Date
Carlos Garnacho
60e15deb83 spinbutton: Avoid touch text handles to pop up
Those get in the middle more than help on these widgets, the widget
is already packed with clickable areas and having handles (and their
invisible clickable area around) hovering above don't help, plus the
purpose in most likely numeric values is a bit doubtful.

All touch events are either consumed by the up/down panels, or
the swipe gesture, all GtkEntry handling of touch events on the text
window is avoided, so handles to not appear anymore.
2014-05-23 19:54:33 +02:00
Carlos Garnacho
a4a122c8e8 colorswatch: Set gestures in GTK_PHASE_TARGET
That's the right phase for gestures replacing entirely event handlers.
2014-05-23 19:54:33 +02:00
Carlos Garnacho
d59c909663 spinbutton: Use GTK_PHASE_CAPTURE for touch swipes
The gesture must be able to catch first events for it to be seen
as recognized in event handlers.
2014-05-23 19:54:33 +02:00
Carlos Garnacho
01d74f86a0 widget: Flip execution order of GTK_PHASE_TARGET/BUBBLE
the "bubble" phase used to run before event handlers before GTK_PHASE_TARGET
was added, in order to keep phases in the expected order, move GTK_PHASE_BUBBLE
to be run (still invariably) after event handlers.

The only behavioral change should be wrt widgets wanting mixed event handler/
gesture handling, they could previously attach the gesture to the bubble phase
and check for gtk_gesture_is_active() in the event handler to bail out, they'll
have to use GTK_PHASE_CAPTURE for that purpose from now on.
2014-05-23 19:54:33 +02:00
Carlos Garnacho
ca1510177c texthandle: Mind the invisible area when moving the handle
The handle is still centered horizontally, but the extra vertical
space wasn't taken into account, leading to misplacing the dragging
point (and the handle) during motion events.
2014-05-23 19:54:33 +02:00
Carlos Garnacho
c9f54aef69 textview: Check first whether the sequence is handled, fetch later the event
And always unset/hide the selection popover if unhandled, that means the
sequence went grabbed/claimed somewhere else and cancelled here.
2014-05-23 19:54:33 +02:00
Carlos Garnacho
f54277204f entry: Check first whether the sequence is handled, fetch later the event
And always unset/hide the selection popover if unhandled, that means the
sequence went grabbed/claimed somewhere else and cancelled here.
2014-05-23 19:54:33 +02:00
Carlos Garnacho
485da90a2e gesture: Use GdkEventSequence GType in signals 2014-05-23 19:54:33 +02:00
Carlos Garnacho
7e61216105 gesture: Introspection fixes
Set annotations on return values for gtk_gesture_get_device() and
gtk_gesture_get_window().
2014-05-23 19:54:33 +02:00
Carlos Garnacho
03a3b2ccab eventcontroller: introspection fix
Set transfer annotation on gtk_event_controller_get_widget()
2014-05-23 19:54:33 +02:00
Carlos Garnacho
0d4e75f078 gdk: Make GdkEventSequence a boxed type
Not much to copy nor free, but this'll make bindings happy
2014-05-23 19:54:33 +02:00
Carlos Garnacho
5fdf07547f paned: Handle pointer events from touchscreen devices
GtkPaned may just capture pointer events because the child widget
doesn't happen to have GDK_TOUCH_MASK set, resort to checking the
device in that case.
2014-05-23 19:54:33 +02:00
Matthias Clasen
0442431943 Docs: Cosmetic fixes 2014-05-23 19:54:33 +02:00
Matthias Clasen
9f3f634c16 docs: Correct a reference 2014-05-23 19:54:33 +02:00
Matthias Clasen
70bccb38c3 Revert "docs: GtkEventController was dropped from public api"
This reverts commit eefac03b395a6b885fd61c100b48652200beb996.
2014-05-23 19:54:32 +02:00
Matthias Clasen
c83d3f054b Revert "docs: More GtkEventController removal"
This reverts commit 75f503fb1fc9068c9e1a0d02126c55addbe8eb3e.
2014-05-23 19:54:32 +02:00
Matthias Clasen
ae5f930d1b Docs: Add information about event propagation 2014-05-23 19:54:32 +02:00
Matthias Clasen
aead8a360b Docs: Minor changes 2014-05-23 19:54:32 +02:00
Matthias Clasen
729a3a98d9 Document gtk_gesture_set_state 2014-05-23 19:54:32 +02:00
Matthias Clasen
9917b15bd3 docs: gtk_gesture_cancel_sequence was made private 2014-05-23 19:54:32 +02:00
Matthias Clasen
01cd5cf382 docs: More GtkEventController removal 2014-05-23 19:54:32 +02:00
Matthias Clasen
6cc9744558 docs: GtkEventController was dropped from public api 2014-05-23 19:54:32 +02:00
Carlos Garnacho
681164564e paned: Use GtkGesture to handle handle dragging
Dragging is all handled by a GtkGesturePan now, matching the
paned orientation.

On touch events, a wider area is listened for, so touch events
don't need to be as accurate to initiate dragging, if no dragging
is truly initiated in this case, events are just forwarded for
child widgets to handle.
2014-05-23 19:54:32 +02:00
Carlos Garnacho
8f20780fb9 switch: Use GtkGesture to handle input events
A pan gesture is used to handle switch dragging, which is only triggered
by horizontal panning movements. A multipress gesture handles the cases
where clicking without dragging happens, just toggling the switch.
2014-05-23 19:54:32 +02:00
Matthias Clasen
a47d0406a7 inspector: Add more complete gesture support
Add a dedicated tab that shows how gestures are grouped,
and allows changing the propagation phase.
2014-05-23 19:54:32 +02:00
Matthias Clasen
1c5f14a9e4 inspector: Minimal support for gestures
We're just showing them as objects in the tree, for now.
2014-05-23 19:54:32 +02:00
Matthias Clasen
a727c41e4a Add back a private api to list controllers
This will let us show them in the inspector.
2014-05-23 19:54:32 +02:00
Carlos Garnacho
2ba89256f4 texthandle: Make a bigger hit area around texthandles
The hit area now extends to all sides around the handle, instead
of just towards where the text is. This makes it easier to grab
handles once shown.
2014-05-23 19:54:32 +02:00
Carlos Garnacho
f322e55e19 gesture: Declare GtkGesture:window as an object property 2014-05-23 19:54:32 +02:00
Carlos Garnacho
f81f00ed6b widget: 3-way merge ate my g_object_ref()
Move it to the right place.
2014-05-23 19:54:32 +02:00
Carlos Garnacho
d351c52114 scrolledwindow: Handle directional cancellation if there is a single scroll direction
A pan gesture is optionally attached if there is only one scrolling direction, the pan
gesture orientation is changed so movements tangential to the scroll direction get
scrolling cancelled (The pan gesture is automatically denied when that happens, and
that state change spreads to the others gestures in the group). If the pan direction
happens in the expected directions, no cancellation happens, and scrolling eventually
takes place.
2014-05-23 19:54:32 +02:00
Carlos Garnacho
57eca4f445 widget: remove check on whether the controller was already added
Multiple calls are supposedly allowed to change the phase (although
unlikely to happen), so remove the g_return_if_fail() checking whether
the controller was already added.
2014-05-23 19:54:31 +02:00
Carlos Garnacho
bd68db4b25 pan: Remove wrong check
From the very early days where there were a NONE=0 GtkPanOrientation
value. This makes vertical pan operations work as expected.
2014-05-23 19:54:31 +02:00
Carlos Garnacho
e70e3963dd entry: Ensure the cursor text handle is shown after touching to reposition cursor. 2014-05-23 19:54:31 +02:00
Carlos Garnacho
cf7bb9a3bf popover: Hide widget first when disposing
In order to ensure invariants are kept.
2014-05-23 19:54:31 +02:00
Carlos Garnacho
15f7170358 entry: Obey implementations' frame when placing handles/popovers around
Y=0 was assumed in a few places, not necessarily right on eg. vertical
spinbuttons.
2014-05-23 19:54:31 +02:00
Carlos Garnacho
10c47fa6d6 entry: Improve touch popover interaction
Presses alternatively show and dismiss the popover, the popover is still
always shown invariably after any dragging happens (either text selection,
or dragging a text handle)
2014-05-23 19:54:31 +02:00
Carlos Garnacho
bd5fb3a09f textview: Show the magnifier popover a bit farther from the touch position
Somewhat arbitrary at the moment, would be nice to have minimal units
support for this, or at least hidpi support.
2014-05-23 19:54:31 +02:00
Carlos Garnacho
b2d56c588a textview: Improve touch popover interaction
Presses alternatively show and dismiss the popover, the popover is still
always shown invariably after any dragging happens (either text selection,
or dragging a text handle)
2014-05-23 19:54:31 +02:00
Carlos Garnacho
e580c29f07 entry: Use gestures to handle pointer/touch events
Similarly to GtkTextView, a GtkGestureMultiPress gesture handles
button/touch presses to initiate one selection mode or other, and
a GtkGestureDrag is used to handle text selection and DnD checks.

The code from button press/release, motion, and grab_notify handlers
has been shuffled into the actions triggered by those gestures.
2014-05-23 19:54:31 +02:00
Carlos Garnacho
d559cade42 spinbutton: Attach "swipe to spin" controllers to the bubble phase
It is unnecessary to have those process events manually, just attach
those to the bubble phase.
2014-05-23 19:54:31 +02:00
Carlos Garnacho
70ea24b9e8 colorplane: Fully port to GtkGesture
A GtkGestureDrag is used for color selection, removing also the
need to track the pointer state in widget data. The GDK grab performed
just to set the crosshair cursor has been replaced by a call
to gdk_window_set_device_cursor(), which will be unset if the
drag operation is finished, or cancelled due to the implicit grab
being broken.
2014-05-23 19:54:31 +02:00
Carlos Garnacho
a6526eb820 gdk: Lookup both device and global cursor when checking up the hierarchy
When the pointer cursor is updated on CSW, lookup for either a device
cursor, or a global one. It would previously lookup for windows with
a global cursor, and then check if it had a device cursor, which would
skip windows with only device cursors set, and unexpectedly set the
global cursor.
2014-05-23 19:54:31 +02:00
Carlos Garnacho
ced7e7c08d button: Make multipress gesture exclusive
We only want actions to be triggered by a single sequence there,
so buttons trigger no actions on further simultaneous touches
happening.
2014-05-23 19:54:31 +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
fd9925141b button: Use GtkGestureMultiPress for signal emission
It is now useful for that purpose with a ::release signal, so replace
the custom GtkGestureSingle with one of these.
2014-05-23 19:54:31 +02:00
Carlos Garnacho
e638ff7974 drag: Allow gtk_gesture_get_start_point/offset() to be called on ::drag-end 2014-05-23 19:54:30 +02:00
Carlos Garnacho
d2db31ee5e multipress: Add matching ::released signal
This signal will always be paired with a ::pressed signal, unless
the sequence is cancelled, or the controller is reset. the n_press
argument in the signal always matches the ::press signal one, even
if GtkGestureMultiPress::stopped was emitted in between.
2014-05-23 19:54:30 +02:00
Carlos Garnacho
04c8b4c705 multipress: Protect against fleeting touches mistriggering events
The current sequence (as per gtk_gesture_single_get_current_sequence)
is used to find out the coordinates. And only emit ::pressed if the
gesture began through a GDK_BUTTON_PRESS/TOUCH_BEGIN (eg. not due to
an extra touch being lifted)
2014-05-23 19:54:30 +02:00
Carlos Garnacho
24f20864b4 textview: Set up controllers on the GTK_PHASE_TARGET propagation phase
This way events are managed by gestures in the event handlers themselves,
respecting the execution order already assumed by subclasses around.
2014-05-23 19:54:30 +02:00