Commit Graph

16 Commits

Author SHA1 Message Date
Matthias Clasen
12170acf46 Define GTK_CROSSING_ACTIVE
Document the different crossing event kinds that we use,
and add GTK_CROSSING_ACTIVE. We are going to use it in
the future when the active window changes.
2020-07-30 13:21:28 -04:00
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
Benjamin Otte
fc43ec0bbc gtk: Bubble drag events like motion events
Emit crossing events - with a new GTK_CROSSING_DROP type - like we do
for motion events. There is no more special casing for them.

Note that the gesture has not been updated yet, so some obscure behavior
may occur.
2020-02-22 07:33:40 +01: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
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
cd601ffb9e eventcontroller: Make the target widget available
Make it possible for event controllers to obtain
the target widget during handle_event.
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
d063b6b6cc Reinstate filtering for crossing events
The event propagation limit should apply to crossing events
as well.
2020-02-21 00:51:02 -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
Benjamin Otte
e01e9ce092 eventcontroller: Add vfuncs to (un)set widget
This is the first step towards refactoring how widgets deal with event
controllers.

In the future, the widget will treat controllers the same way it treats
child widgets:
1. The controllers will be created without a widget.
2. There will be gtk_widget_add/remove_controller() functions to add
   or remove controllers.
3. The widget will hold a reference to all its controllers.

This way we will ultimately be able to automate controllers with ui
files.
2018-04-26 17:59:41 +02:00
Carlos Garnacho
c02d0f3c0a eventcontroller: Drop event_mask API
This is unchecked, we can remove it entirely as well.
2017-09-19 18:39:03 +02:00
Carlos Garnacho
b24a865d9b GtkEventController: Add some comment describing the filter_event private vfunc
It might not be entirely clear what the boolean return value means.

https://bugzilla.gnome.org/show_bug.cgi?id=770026
2016-08-23 21:01:45 +02:00
Carlos Garnacho
3808322f80 eventcontroller: Add private ::filter method
This will be used right before handle_event() in order to filter
out events, useful to make the previous "no touchpad events" behavior
the default, and have gesture subclasses include manually the touchpad
events they handle.
2015-08-12 23:20:25 +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
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