Commit Graph

9 Commits

Author SHA1 Message Date
Emmanuele Bassi
f28aa1ba02 Restructure the GdkEvent type hierarchy
GdkEvent has been a "I-can't-believe-this-is-not-OOP" type for ages,
using a union of sub-types. This has always been problematic when it
comes to implementing accessor functions: either you get generic API
that takes a GdkEvent and uses a massive switch() to determine which
event types have the data you're looking for; or you create namespaced
accessors, but break language bindings horribly, as boxed types cannot
have derived types.

The recent conversion of GskRenderNode (which had similar issues) to
GTypeInstance, and the fact that GdkEvent is now a completely opaque
type, provide us with the chance of moving GdkEvent to GTypeInstance,
and have sub-types for GdkEvent.

The change from boxed type to GTypeInstance is pretty small, all things
considered, but ends up cascading to a larger commit, as we still have
backends and code in GTK trying to access GdkEvent structures directly.
Additionally, the naming of the public getter functions requires
renaming all the data structures to conform to the namespace/type-name
pattern.
2020-04-16 19:54:02 +01:00
Matthias Clasen
a2a194f71e eventcontroller: Fix signal marshallers
GdkEvent is no longer a GObject. Any signals taking
events as arguments need to have their marshallers
fixed. Thankfully, we have few of these left.
2020-04-15 14:36:04 -04: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
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
d3c45cb979 docs: Miscellaneous doc fixes
Additions and correction all over the place,
in GDK and GTK docs.
2019-02-24 16:53:12 -05:00
Timm Bäder
0b4ee06f8e eventcontrollerlegact: Fix ::event docs
As discussed in !388.
2018-11-08 05:48:14 +01:00
Carlos Garnacho
0f4a6bfbf8 gtkeventcontrollerlegacy: Make public
And move ::event into it, dropping the GtkWidget::event signal.
2018-10-15 17:39:04 +02:00
Benjamin Otte
6fb92a0ab9 legacycontroller: Port to new API model
We no longer set the widget on construction, but instead require an
explicit call to gtk_widget_add_controller().

This way, the reference handling becomes explicit and bindable.

Because gtk_widget_add_controller() is (transfer: full), we don't
even need to unref the controller after adding it.
And we don't need to keep track of it, because controllers get cleaned
up by GtkWidget.
2018-04-26 17:59:41 +02:00
Carlos Garnacho
8c350459ae gtk: Run GtkWidgetClass event signals inside a GtkEventController
This will allow further cleanups and optimizations in capture/target/bubble
event delivery. For simplicity, ATM every widget will receive its own
GtkEventControllerLegacy, it could be desirable to add finer control over
this in the future, so widgets that fully use event controllers for input
management can do away without this legacy piece.
2017-09-19 18:39:03 +02:00