Commit Graph

18 Commits

Author SHA1 Message Date
Matthias Clasen
bd56bc9055 Add gtk_event_controller_get_current_event[_state]
For now these are private, to replace internal uses
of gtk_get_current_event[_state], but we may want to
make them public.
2020-04-11 17:29:27 -04:00
Matthias Clasen
77aed615e8 Keep more event controller api private
We don't want to expose the GtkCrossingData struct, and manually
feeding events to event controllers is not something we want to
encourage, going forward.
2020-02-21 00:51:03 -05:00
Matthias Clasen
89c3a7ab24 wip: Add more information to crossing events
Add fields for direct descendents to GtkCrossingData,
and populate them when emitting focus change events.

Also add accessors for these fields to GtkEventControllerKey,
and verify that they are set properly in the focus test.

Not done yet: Do the same for pointer crossing events.
2020-02-21 00:51:03 -05:00
Matthias Clasen
31bf9da63a Strip const from GdkEvent
Events are refcounted structs, and we generally don't
pass these as const.
2020-02-21 00:51:02 -05:00
Matthias Clasen
e54e48f6d1 Explicitly pass the target to handle_event
Pass the event propagation target explicitly down to
the event controllers. This is a step towards getting
rid of gdk_event_set_target.
2020-02-21 00:51:02 -05:00
Matthias Clasen
e3158a1bfb Make crossing events handled the same way 2020-02-21 00:50:59 -05:00
Matthias Clasen
23c67f8c67 New focus change handling
Instead of relying on gdk's antiquated crossing events,
create a new GtkCrossingData struct that contains the
actual widgets, and a new event controller vfunc that
expects this struct. This also saves us from making sense
of X's crossing modes and details, and makes for a
generally simpler api.

The ::focus-in and ::focus-out signals of GtkEventControllerKey
have been replaced by a single ::focus-change signal that
takes GtkCrossingData as an argument. All callers have
been updated.
2020-02-21 00:47:53 -05:00
Matthias Clasen
dd251d85c4 Pass translated coordinates outside the event
We want to make events readonly, so stop translating
their coordinates and instead pass the translated
coordinates separately, when propagating events.
2020-02-21 00:47:53 -05:00
Matthias Clasen
955ae40cd6 event controller: Add a name property
This helps identifying controllers in the inspector.
2019-06-20 22:48:33 -04:00
Matthias Clasen
2606ca0bd1 Introduce event controller propagation limits
Limit event handlers by default to only handle
events targeting the same surface as their widget.
2019-05-28 20:25:13 +00:00
Benjamin Otte
8ddba5ffcd eventcontroller: Move declaration
This is in preparation for exposing APIs in gtkwidget.c
2018-04-26 17:59:41 +02:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Carlos Garnacho
d05a9f9a7b gesture: Replace gtk_gesture_attach/detach with event controller API
Event controllers now auto-attach, and the GtkCapturePhase only determines
when are events dispatched, but all controllers are managed by the widget wrt
grabs.

All callers have been updated.
2014-05-27 17:47:12 +02:00
Carlos Garnacho
2e903243c6 eventcontroller: Make the event-mask property and methods private.
This will rarely have any use if no subclassing is allowed, so just make it
private for our own.
2014-05-27 17:47:12 +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
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
759705d3e6 eventcontroller: Add propagation-phase property
This is so we don't have to specify the capture phase for
every controller. The default "bubble" value will be sane
on most situations.
2014-05-23 19:54:25 +02:00
Carlos Garnacho
e2b8ef8c66 Add GtkEventController
This is a basic abstract type that handles GdkEvents.
2014-05-23 19:54:21 +02:00