Commit Graph

61112 Commits

Author SHA1 Message Date
Matthias Clasen
7bb6abb1d4 win32: Remove some leftover event struct access
And leftover old event api calls.
2020-02-21 00:51:03 -05:00
Matthias Clasen
de91e10a1b wayland: Fix a release build warning 2020-02-21 00:51:03 -05:00
Matthias Clasen
4098653974 Update the focus test
This needs an update to handle the new focus-change signal.
2020-02-21 00:51:03 -05:00
Matthias Clasen
71b3f47909 Update event docs section 2020-02-21 00:51:03 -05:00
Matthias Clasen
1ef30c110f Clean up GdkEventType docs 2020-02-21 00:51:03 -05:00
Matthias Clasen
6fd913b361 Some event struct packing improvements
Rearrange a few things, and move some booleans
into the Any struct, by using a bitfield there.

Some more cleanup could be done - the flags field
with its PENDING and FLUSHED members appears
entirely unused. Nobody is setting those flags.
2020-02-21 00:51:03 -05:00
Matthias Clasen
84edce3732 Streamline event structs
Use proper types (GdkModifierType, double), and drop
some unused fields (send_event, display).
2020-02-21 00:51:03 -05:00
Matthias Clasen
2cce508b33 x11: Remove some leftover event struct access 2020-02-21 00:51:03 -05:00
Matthias Clasen
56d44b4cec x11: Stop using the send_event event field
The only use of this field is printing it out in a
debug message. We are going to drop it.
2020-02-21 00:51:03 -05:00
Matthias Clasen
563dd65530 Always deliver focus events to toplevels
Its was GTK expects. This change gets rid of the "Ignoring an
unexpected focus event from GDK on a non-toplevel surface."
warning.
2020-02-21 00:51:03 -05:00
Matthias Clasen
0fc2505ed6 Drop gtk_widget_event from API
We don't want events to be injected randomly from
the outside. Plus, there's no way to create such
events from the outside now.
2020-02-21 00:51:03 -05:00
Matthias Clasen
b1eaa502df events: reorganize getters
Restructure the getters for event fields to
be more targeted at particular event types.

Update all callers, and replace all direct
event struct access with getters.

As a side-effect, this drops some unused getters.
2020-02-21 00:51:03 -05:00
Matthias Clasen
f1cf0eb3fc Drop gdk_set/get_show_events
We don't need a separate api to turn on debugging
for events.
2020-02-21 00:51:02 -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
1026bfb1ac events: Drop all setters
GdkEvent is now truly readonly.
2020-02-21 00:51:02 -05:00
Matthias Clasen
92288205d4 events: Drop target and related target
GTK no longer uses this, so we can drop it.
2020-02-21 00:51:02 -05:00
Matthias Clasen
e5223b1cee main: Stop calling gdk_event_set_target
GTK is no longer relying on this.
2020-02-21 00:51:02 -05:00
Matthias Clasen
2416b4e2a0 Stop using gdk_event_get_target
We can now get the target widget from the gesture
that we are using to find the event in the first
place.
2020-02-21 00:51:02 -05:00
Matthias Clasen
2bac066a63 gesture: Keep the target widget for events
We already store the events; keep the target widget
in addition. This is a step towards getting rid of
gdk_event_get_target.
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
b38869b3aa Stop looking at the related target for filtering
We are now sending crossing events (which are the only ones
where a related target makes sense) via handle_crossing.
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
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
9402e335d0 wip: scrolledwindow stop using targets 2020-02-21 00:47:53 -05:00
Matthias Clasen
64b9c6aaaa main: Drop gtk_get_event_target
This is no longer used.
2020-02-21 00:47:53 -05:00
Matthias Clasen
61c32f3651 tooltip: stop using gtk_get_event_target 2020-02-21 00:47:53 -05:00
Matthias Clasen
1b2289ad9b Stop using gtk_get_event_target
This is just a thin wrapper around gdk_event_get_target,
so use that directly.
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
cd2b58574d Drop GDK_NOTHING
Events of type GDK_NOTHING are good for nothing.
2020-02-21 00:47:53 -05:00
Matthias Clasen
3830e13b98 Make GdkEvent a boxed type 2020-02-21 00:47:53 -05:00
Matthias Clasen
c343031a0e Stop using g_object_ref/unref on events
Use gdk_event_ref/unref instead of g_object_ref/unref.
Events will stop being object soon.
2020-02-21 00:47:53 -05:00
Matthias Clasen
835556c270 Drop gdk_event_new and gdk_event_copy
These functions are no longer used outside of gdkevents.c.
2020-02-21 00:47:52 -05:00
Matthias Clasen
59cc216985 display: Stop using gdk_event_copy
Events are effectively readonly in GDK now, so we can just
take a reference, no need for a copy.
2020-02-21 00:47:52 -05:00
Matthias Clasen
fe21223d48 win32: Use event constructors 2020-02-21 00:47:52 -05:00
Matthias Clasen
f11b1d258b x11: Pass the right surface to the dnd filter 2020-02-21 00:47:52 -05:00
Matthias Clasen
e45711e727 x11: Remove an unnecessary check
We are not creating GDK_NOTHING events anymore. Yay
2020-02-21 00:47:52 -05:00
Matthias Clasen
79b4510c6d x11: change event translator interface
Make the event translator return a new event, instead of
filling in a half-constructed one.

Update the two implementation in GdkX11Display and
GdkDeviceManagerXI2.
2020-02-21 00:47:51 -05:00
Matthias Clasen
15501afdbb x11: Change the wm protocols filter api
Instead of passing a half-constructed event and expect
it to be filled in, pass the surface as in argument, and
add an out argument for a newly constructed GdkEvent.
2020-02-21 00:40:52 -05:00
Matthias Clasen
94fe0944cc x11: Don't pass a GdkEvent to shape cache filters
The filter functions never look at that event, and
we want to get out of the business of passing half-
constructed events around.
2020-02-21 00:40:52 -05:00
Matthias Clasen
9c4f19e8ed x11: Don't pass a GdkEvent to xsettings filters
The filter functions never look at that event, and
we want to get out of the business of passing half-
constructed events around.
2020-02-21 00:40:52 -05:00
Matthias Clasen
9a1497f582 events: Drop GDK_DESTROY
No backend is emitting GDK_DESTROY events anymore, so no
need to carry this around.
2020-02-21 00:40:52 -05:00
Matthias Clasen
7db8be93f4 gtk: Stop handling GDK_DESTROY differently from GDK_DELETE
We don't have child windows anymore, so there is no difference.
2020-02-21 00:40:52 -05:00
Matthias Clasen
047c18844c x11: Don't generate GDK_DESTROY events
GTK does not differentiate between GDK_DESTROY and GDK_DELETE
anyway.
2020-02-21 00:40:52 -05:00
Matthias Clasen
30740f0e2c x11: use event constructors
This is not quite complete and only handles the
simple cases.
2020-02-21 00:40:52 -05:00
Matthias Clasen
c9d9ccdb8c broadway: Use event constructors
Convert all of Broadways event handling to use the new
constructors.
2020-02-21 00:40:52 -05:00
Matthias Clasen
4cf63f3eb3 wip: Use event constructors in the testsuite
This doesn't work because the constructors aren't exported,
so remove the gestures text temporarily, until we figure
out how to deal with it.
2020-02-21 00:40:52 -05:00
Matthias Clasen
c4a2cf03b2 textview: Stop using gdk_event_copy 2020-02-21 00:40:52 -05:00
Matthias Clasen
495de0b78b main: Use constructors instead of gdk_event_copy + rewriting 2020-02-21 00:40:52 -05:00