Commit Graph

1238 Commits

Author SHA1 Message Date
Carlos Garnacho
8ab35016a6 gesture: make gtk_gesture_cancel_sequence() private 2014-05-23 19:54:29 +02:00
Carlos Garnacho
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
Carlos Garnacho
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
Carlos Garnacho
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
Carlos Garnacho
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
Carlos Garnacho
35bed1ac14 widget: Add docs for GtkGesture-related API 2014-05-23 19:54:28 +02:00
Carlos Garnacho
7a71c16317 widget: refactor gesture integration
Listen for notify::sequence-state-changed on the controller, so the
only way to manipulate a sequence state are gtk_gesture_set_sequence_state()
and gtk_gesture_set_state().

Also, make use of gesture groups, so the sequence state is set at once
on all gestures pertaining to a single group. Within a widget, if a sequence
is claimed on one group, it is made to be denied on every other group.
2014-05-23 19:54:25 +02:00
Carlos Garnacho
38e40a55f4 widget: Add gtk_widget_set_gesture_state()
This helper function ensures the state is propagated for
all the active sequences in the given gesture.
2014-05-23 19:54:24 +02:00
Carlos Garnacho
8e1d5f98de widget: Improve button press emulation on sequence denied
Ensure that state being set on pointer emulating touches actually
gets propagated properly on widgets with gestures that only handle
pointer events.
2014-05-23 19:54:24 +02:00
Carlos Garnacho
a56a9e4a62 widget: Reset gestures on grab-notify
If it is determined that the gesture will stop receiving
events, reset the gesture altogether.
2014-05-23 19:54:23 +02:00
Carlos Garnacho
997f05d99b widget: Make helper gesture API take GtkGestures
GtkEventController may be certainly useful to keep event
handling self-contained in other places than gestures, but
the current widget API is highly related to gestures, so
just using GtkGesture as the argument there will be quite
more convenient. The other places where GtkEventController
make sense as a base object will better provide their own
hooks.
2014-05-23 19:54:23 +02:00
Carlos Garnacho
026b5014e8 Add: GTK_PHASE_NONE value to GtkCapturePhase.
Gestures attached with this phase will expect callers to have it
receive events through gtk_event_controller_handle_event(), but
the gesture will still be notified of sequence state changes,
grabs, etc...
2014-05-23 19:54:23 +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
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
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
Matthias Clasen
49cf5142ba Deprecate GdkColor
It has been replaced by GdkRGBA. Time to make it official.
http://bugzilla.gnome.org/show_bug.cgi?id=636695
2014-05-22 09:09:55 -04:00
Matthias Clasen
70cb91a827 docs: syntax fix
It is just 'Deprecated:' in doc comments, not '@Deprecated:'.
2014-05-20 09:55:29 -04:00
Benjamin Otte
d260694a37 widget: Untagle if statements
Reduces the number of nested ifs and makes the code clearer.
2014-05-19 04:25:10 +02:00
Benjamin Otte
3cb5e58b1a API: Deprecate gtk_widget_region_intersect()
It's unused and would become disambiguous once we split between
allocation and draw region.
2014-05-18 02:29:56 +02:00
Benjamin Otte
2a99584c68 API: Deprecate gtk_widget_reparent() 2014-05-17 23:36:57 +02:00
Matthias Clasen
93204d3ba8 Don't lie about baselines so much
Let g_object_get (w, "valign",...) report the truth, so that the
inspector can show it without special cases.
2014-05-15 08:43:43 -04:00
Matthias Clasen
3f224a7165 Add private GtkWidget api for action groups
Similar to the just-added action muxer api for enumerating
action prefixes and for getting the action group for a
prefix.

https://bugzilla.gnome.org/show_bug.cgi?id=730095
2014-05-14 21:28:53 -04:00
Owen W. Taylor
8f9e50de80 GtkPopover: inherit actions from the relative_to widget
Make the relative_to widget the parent for a GtkPopover's
GtkActionGroup. This, for example, makes the menu model of a
GtkMenuButton find action groups attached to the button.

https://bugzilla.gnome.org/show_bug.cgi?id=729915
2014-05-12 16:39:44 -04:00
Matthias Clasen
5cd5db1f57 Remove a redundant check
gtk_widget_show/_hide already check the widget's visibility.

https://bugzilla.gnome.org/show_bug.cgi?id=728135
2014-05-11 11:56:22 -04:00
Cosimo Cecchi
b0ace67712 widget: deprecate focus-line-width style property
Nothing in GTK uses it anymore.
2014-05-09 11:02:46 -07:00
Cosimo Cecchi
e8c906966e widget: deprecate focus-line-pattern style property
Nothing in GTK uses it.
2014-05-09 11:02:44 -07:00
Cosimo Cecchi
a2decd1f2f widget: deprecate focus-padding style property
There's no use left inside GTK.
2014-05-09 11:02:44 -07:00
Cosimo Cecchi
b03c22e0c9 widget: deprecate interior-focus style property
Nothing uses it anymore inside GTK.
2014-05-09 11:02:42 -07:00
Matthias Clasen
d495ab1ca0 Small documentation update
Don't show an example that doesn't work anymore.
2014-05-05 09:41:06 -04:00
Matthias Clasen
456dffcbfd GtkWidget: Mark deprecated properties as such
The ::style, ::margin-left and ::margin-right properties are all
deprecated.
2014-05-02 19:25:27 -04:00
Benjamin Otte
db791ba3f5 widget: Remove unneeded checks
Size vfuncs always get non-null out variables passed, so no need to
check for NULL.
2014-05-01 14:51:27 +02:00
Marcus Karlsson
3d956db500 docs: fix GtkWidget::size-allocate description
The documentation for the GtkWidget::size-allocate signal is missing the
description of the "allocation" parameter. Add the missing description
to the parameter.

https://bugzilla.gnome.org/show_bug.cgi?id=726179
2014-04-13 14:43:47 -07:00
Matthias Clasen
fee33b1a81 Clean up private headers
This commit adds a few missing private headers, and cleans up
some irregularities in the existing ones
2014-04-05 02:06:29 -04:00
Bastien Nocera
f71f7215ab all: Name more idles and timeouts
Following up from 438cd857c4,
name more timeouts and idles.

The original grep was missing checking for gdk_threads_add_*()
functions (at least for some of the files).

https://bugzilla.gnome.org/show_bug.cgi?id=726870
2014-03-26 20:09:30 -04:00
Benjamin Otte
fbf99febf3 docs: Add more information to gtk_widget_set_realized()
It's important to point out that widgets should only be marked as
realized very late in the process. Even GTK widgets don't get this
right.

https://bugzilla.gnome.org/show_bug.cgi?id=726717
2014-03-20 14:34:31 +01:00
Matthias Clasen
ac96c35230 Update documentation about link styling
The ::link-color and ::visited-link-color style properties
are ignored now. Document that.
2014-03-17 15:00:45 -04:00
Owen W. Taylor
2f43800aa3 _gtk_widget_get_device_window: Fix for keyboard devices
Avoid a warning by returning NULL for keyboard devices, which can
never have an active pointer for a widget.
2014-03-13 10:31:08 -04:00
Owen W. Taylor
40b6d907bf Use GDK's current window tracking when synthesizing events in GTK+
Add gdk_device_get_last_event_window(), and use to implement the window
tracking we need for synthesizing crossing events for sensitivity changes
and gtk grabs, rather than keeping the information in qdata and updating
it based when GTK+ gets events.

https://bugzilla.gnome.org/show_bug.cgi?id=726187
2014-03-12 23:03:53 -04:00
Matthias Clasen
2ffeb591b1 Fix up signal deprecation 2014-03-03 23:31:48 -05:00
Matthias Clasen
7fae042208 Deprecate GdkEventVisibility and ::visibility-notify-event
These don't really work anymore in a composited world.
Lets make it official.
https://bugzilla.gnome.org/show_bug.cgi?id=481073
2014-03-03 21:39:03 -05:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
Matthias Clasen
e79842d64c Document gtk_widget_get_scale_factor 2014-02-19 01:03:36 -05:00
Matthias Clasen
c779b42476 Docs: use // for comments in examples
Without sgml mode, we can't escape /* as /* anymore,
so just switch to // for comments in examples.
2014-02-14 23:34:22 -05:00
William Jon McCann
37a8ee6e95 docs: fully break lines in examples
Try to do a better job of keeping example content
from being too wide. It is often rendered as <pre>
text so the only time we can wrap it is in the source.

It is best to full break lines at all punctuation and
to try to keep the width under 70 chars or so.
2014-02-12 18:42:50 -05:00
Matthias Clasen
3459a0a273 Revert "Introduce API to get the preferred visual"
This reverts commit 2b95d1a34e.

Conflicts:
	gdk/gdkscreen.c
2014-02-10 22:15:28 -05:00
Matthias Clasen
d326507978 Revert "Use gdk_screen_get_preferred_visual()"
This reverts commit 30fa1426cf.

See the bugs
https://bugzilla.gnome.org/show_bug.cgi?id=724067
https://bugzilla.gnome.org/show_bug.cgi?id=723740
for the issues that are the reason for this revert.
2014-02-10 22:12:53 -05:00
Matthias Clasen
7f6a964c47 Docs: Remove all entities and turn off sgml mode
With all element markup gone, it is time to turn off
sgml mode, and get rid of entities as well.
2014-02-09 17:58:07 -05:00
Matthias Clasen
c823498b4c Fix margin-start/end property implementation
The properties are declared read-write, but only the setter
was hooked up. This was leading to criticals in test apps using
the prop-editor.c code. Complete the implementation by adding the
getter side too.
2014-02-07 20:27:30 -05:00
William Jon McCann
13998c55e7 docs: use proper quotations instead of '*' 2014-02-07 14:22:39 -05:00