Commit Graph

38285 Commits

Author SHA1 Message Date
Carlos Garnacho
5f24d1a519 gesture: Only recognize gestures with as many interacting touches as those handled
If a gesture has denied sequences (so those are presumably handled above/below
the widget), it shouldn't attempt to handle extra touches, even if those end
up matching the expected number of touches.
2014-05-23 19:54:23 +02:00
Carlos Garnacho
b5c319b56f gesture: Limit API calls to non-denied sequences
Gestures do track those internally, but information about those
shouldn't be leaked on calls.
2014-05-23 19:54:23 +02:00
Carlos Garnacho
2285157c7d gesture: Require BUTTON_PRESS/TOUCH_BEGIN for sequences to be initiated.
Gestures should always receive one of such events in order to be activated,
and the propagation mechanism will ensure they do so if the original event
was caught up the widget hierarchy by another gesture that is now declining
the sequence.
2014-05-23 19:54:23 +02:00
Carlos Garnacho
d89e810bd9 gesture: Only track non denied sequences in get_last_updated_sequence() 2014-05-23 19:54:23 +02:00
Carlos Garnacho
b7435a0290 gesture: cancel all ongoing sequences on reset() 2014-05-23 19:54:23 +02:00
Carlos Garnacho
d2c9b9c2aa gesture: Skip non-device events early. 2014-05-23 19:54:23 +02:00
Carlos Garnacho
25ece22013 gesture: Add gtk_gesture_[sg]et_window()
This can be used to restrict a gesture to an specific GdkWindow,
all events will be checked to happen on/within that window.
2014-05-23 19:54:22 +02:00
Carlos Garnacho
7f787e1d3b docs: Add GtkGestureSingle to docs 2014-05-23 19:54:22 +02:00
Carlos Garnacho
c4944b0376 gesture: Remove the touch-only property
This is handled in GtkGestureSingle.
2014-05-23 19:54:22 +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
Matthias Clasen
49e9ba122a ...and add the right include instead 2014-05-23 19:54:22 +02:00
Matthias Clasen
a1aeaa6b07 Remove a doubled line 2014-05-23 19:54:22 +02:00
Carlos Garnacho
8d2f81cca4 scrolledwindow: Use gesture button/touch press synthesization
This makes scrolled window fully compatible again wrt the
GtkScrolledWindow::capture-button-press property.
2014-05-23 19:54:22 +02:00
Carlos Garnacho
36106c19d4 widget: Propagate touch/button press events when a sequence is denied
If the captured touch begin or button press event have been consumed
for the given sequence, propagate it upwards if the sequence goes from
claimed to denied, so the widgets on the way to the event widget receive
a coherent event stream now that they're going to receive events.
2014-05-23 19:54:22 +02:00
Carlos Garnacho
83dd050ab2 gesture: Add private getter to know whether a touch begin was handled
If GDK_TOUCH_BEGIN was handled/consumed for a sequence, or GDK_BUTTON_PRESS was
handled for the mouse gesture, this function will return TRUE.
2014-05-23 19:54:22 +02:00
Carlos Garnacho
a9fa0151f1 widget: Implement hierarchy-level mechanism to claim/deny sequences
The policy of sequence states has been made tighter on GtkGesture,
so gestures can never return to a "none" state, nor get out of a
"denied" state, a "claimed" sequence can go "denied" though.

The helper API at the widget level will first emit
GtkWidget::sequence-state-changed on the called widget, and then
notify through the same signal to every other widget in the captured
event chain. So the effect of that signal is twofold, on one hand
it lets the original widget set the state on its attached controllers,
and on the other hand it lets the other widgets freely adapt to the
sequence state changing elsewhere in the event widget chain.

By default, that signal updates every controller on the first usecase,
and propagates the default gesture policy to every other widget in the
chain on the second. This means that, by default:

1) Sequences start out on the "none" state, and get propagated through
   all the event widget chain.
2) If a widget in the chain denies the sequence, all other widgets are
   unaffected.
3) If a widget in the chain claims the sequence, then:
  3.1) Every widget below the claiming widget (ie. towards the event widget)
       will get the sequence cancelled.
  3.2) Every widget above the claiming widget that had the sequence as "none"
       will remain as such, if it was claimed it will go denied, but that should
       rarely happen.

This behavior can be tweaked through the GtkWidget::sequence-state-changed and
GtkGesture::event-handled vmethods, although this should be very rarely done.
2014-05-23 19:54:22 +02:00
Carlos Garnacho
4ec1fafe2f docs: Add GtkWidget gesture functions 2014-05-23 19:54:22 +02:00
Carlos Garnacho
83ef067ae1 scrolledwindow: port to GtkGesture
The kinetic scrolling feature is now implemented using a
GtkGestureDrag and a GtkGestureSwipe, plus a GtkGestureLongPress
in order to denying the sequence, so it is possibly handled
underneath.
2014-05-23 19:54:22 +02:00
Carlos Garnacho
76213ab209 widget: Add widget-level handling of touch sequence state.
These functions ATM do nothing but proxying the controller(s) state
with the given sequence.
2014-05-23 19:54:22 +02:00
Carlos Garnacho
f1bb0283dd widget: Hook GtkEventController to widget event processing.
A controller can be optionally hooked on the capture or the bubble
phase, so the controller will automatically receive and handle events
as they arrive without further interaction.
2014-05-23 19:54:22 +02:00
Carlos Garnacho
d0da82fed6 gtk: Remove propagation limit of captured events on the grab widget
Now, all captured events run from the toplevel to the deepmost widget,
regardless of GTK+ grabs. This makes captured events more useful to
event controllers if used together in the hierarchy with widgets doing
old fashioned event handling and GTK+ grabs.
2014-05-23 19:54:22 +02:00
Carlos Garnacho
71e382cf42 gtk-demo: Add simple gestures demo 2014-05-23 19:54:22 +02:00
Carlos Garnacho
73c2964e85 hook GtkGesture* into docs generation 2014-05-23 19:54:21 +02:00
Carlos Garnacho
450c754c7c Add GtkGestureMultiPress
This gesture handles any number of clicks, ensuring multiple presses
stay within thresholds and timeouts. When anything of that happens,
the gesture is reset and press count starts from 1 again.

Optionally, the gesture can be given a rectangle, used in in presses > 1
to ensure the consecutive presses happen on user imposed areas.
2014-05-23 19:54:21 +02:00
Carlos Garnacho
8026bc3651 Add GtkGestureDrag
This gesture interprets and reports drags as an offset to the drag
start point.
2014-05-23 19:54:21 +02:00
Carlos Garnacho
9db3c2d893 Add GtkGestureZoom
This gesture interprets and reports relative scale differences when fed
with events from two different GdkEventSequences.
2014-05-23 19:54:21 +02:00
Carlos Garnacho
2495b518c1 Add GtkGestureRotate
This gesture implementation recognizes rotations when fed with
events from two different GdkEventSequences
2014-05-23 19:54:21 +02:00
Carlos Garnacho
8733e2a918 Add GtkGestureSwipe
This gesture implementation recognices swipes on any direction.
The "swipe" signal has the X/Y velocity vector components, so
those can be used for direction guessing and velocity thresholds.
2014-05-23 19:54:21 +02:00
Carlos Garnacho
88d554d3ba Add GtkGestureLongPress
This gesture interprets long presses with variable delays
and thresholds
2014-05-23 19:54:21 +02:00
Carlos Garnacho
8f113e07fd Add GtkGesture
This a more specific abstract type that handles one or multiple
streams of pointer/touch events.
2014-05-23 19:54:21 +02:00
Carlos Garnacho
e2b8ef8c66 Add GtkEventController
This is a basic abstract type that handles GdkEvents.
2014-05-23 19:54:21 +02:00
Benjamin Otte
6c49ffe916 themingbackground: Outset shadows require border box
They are drawn relative to the border box, not relative to the padding
box.
2014-05-23 19:29:27 +02:00
Benjamin Otte
fa22218973 css: Make getter function a real getter
Initialize the passed-in value, don't treat it as an in-out parameter.
2014-05-23 19:29:27 +02:00
Matthias Clasen
486c82ae8f testsuite: Add more icon names
These were found by looking over the GTK+ sources and ui files.
2014-05-23 12:17:56 -04:00
Matthias Clasen
7caecf3979 Add more icons to check-icon-names
These are icons which are used as GtkArrow replacement, and
icons used for the volume button.
2014-05-23 11:52:12 -04:00
Matthias Clasen
28c04f4be3 testsuite: Run reftests with GTK_DEBUG=icontheme
This will hopefully help to track down some hard-to-squash
failures that only happen in gnome-continuous.
2014-05-23 11:38:24 -04:00
Benjamin Otte
74b6f5fba8 testsuite: Add a test for icon names
This test just checks that all the icon names that GTK uses are present
in the default icon theme.

As icon names are not checked programmatically and we do not want to run
into missing-icon icons in the code, this test seems necessary.

For now, it's just a stub that tests stock icons.
2014-05-23 17:12:32 +02:00
Matthias Clasen
d769f338f2 GtkButton: tighten code a bit
Make it so we only use GtkMisc in one place.
2014-05-22 23:15:08 -04:00
Matthias Clasen
2df80d7a4d inspector: Repeat the keybinding warning
Show the confirmation dialog every time the keybinding is used,
until the user clicks OK.
2014-05-22 18:37:43 -04:00
Matthias Clasen
372e551a66 inspector: avoid a warning on destroy
We are only hiding the window now, so a memory management
error has crept into the destroy path.
2014-05-22 18:37:43 -04:00
Benjamin Otte
e012dfab2c Revert "Fix crash"
This reverts commit 024c11dd66.

It's not a crash fix to cause a return_val_if_fail() to happen.
2014-05-22 22:35:39 +02:00
Benjamin Otte
0eb62c1629 reftests: Fix icon-vfuncs reftest
The reftest broke when font size lead to labels > 16px.
2014-05-22 22:35:08 +02:00
Behdad Esfahbod
024c11dd66 Fix crash 2014-05-22 15:52:01 -04:00
Matthias Clasen
b26da6ed4f docs: Include input handling overview
Now that it is not entirely empty anymore, lets include it.
2014-05-22 15:46:42 -04:00
Matthias Clasen
e491da532a Some more input handling docs 2014-05-22 15:45:31 -04:00
Matthias Clasen
3d981069ab Fill in some content in the input handling overview 2014-05-22 15:16:37 -04:00
Jasper St. Pierre
65022c4078 gdkwindow-x11: Rearrange a tiny bit 2014-05-22 15:01:36 -04:00
Jasper St. Pierre
0d3f162d6b gdkwindow-x11: Fix build 2014-05-22 15:01:23 -04:00
Jasper St. Pierre
084576f214 gdkwindow-x11: Ungrab the implicit grab before showing the window menu
Otherwise, the WM cannot take a grab on the pointer device, since we'll
still have the implicit grab.
2014-05-22 14:47:55 -04:00
Jasper St. Pierre
76e18de811 reftests: Remove the css-match-style-property-order test
It was testing -GtkWidget-focus-line-width, which is a dead property
we don't use anymore.
2014-05-22 14:47:55 -04:00