[mutter] clutter: Set event as current_event when going through event filters
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter: Set event as current_event when going through event filters
- Date: Thu, 21 Apr 2022 10:09:21 +0000 (UTC)
commit 4a865424cd3f0dc78aa652f966b35f5bd2b9f649
Author: Jonas Dreßler <verdre v0yd nl>
Date: Mon Mar 7 15:16:03 2022 +0100
clutter: Set event as current_event when going through event filters
With the introduction of untrottled event delivery to wayland clients,
we moved the _clutter_event_process_filters() call outside of
_clutter_process_event(). This also moved the processing of event
filters outside of the timespan where the event is added to Clutters
current_event stack, making Clutter.get_current_event() no longer
available to anything happening inside mutters event filter.
One thing that happens in mutters event filter is detecting and
triggering keybindings like the alt-tab switcher. Now the alt-tab
switcher has a special case where it finishes and activates a window
right when the keybinding gets activated, relying on the current event
time as the timestamp to activate the window.
Now since the current event time is no longer available from inside
mutters event filter, we'd pass 0 to meta_window_activate(), causing
mutter to send a notification instead of actually activating the window.
To fix this, also set a current_event for the ClutterContext when going
through event filters, this makes sure Clutter.get_current_event_time()
works when called inside keybinding handlers.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2327>
clutter/clutter/clutter-main.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index e066e5aebe..df872bd425 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -741,6 +741,7 @@ update_device_for_event (ClutterStage *stage,
void
clutter_do_event (ClutterEvent *event)
{
+ ClutterContext *context = _clutter_context_get_default();
ClutterActor *event_actor = NULL;
/* we need the stage for the event */
@@ -775,8 +776,17 @@ clutter_do_event (ClutterEvent *event)
event_actor = clutter_stage_get_event_actor (event->any.stage, event);
}
+ context->current_event = g_slist_prepend (context->current_event, event);
+
if (_clutter_event_process_filters (event, event_actor))
- return;
+ {
+ context->current_event =
+ g_slist_delete_link (context->current_event, context->current_event);
+
+ return;
+ }
+
+ context->current_event = g_slist_delete_link (context->current_event, context->current_event);
/* Instead of processing events when received, we queue them up to
* handle per-frame before animations, layout, and drawing.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]