[mutter/wip/carlosg/grabs-pt1: 8/17] clutter: Propagate events only inside the grab
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/grabs-pt1: 8/17] clutter: Propagate events only inside the grab
- Date: Tue, 2 Nov 2021 22:27:49 +0000 (UTC)
commit 5c8ee9db83c22a7f9795339a7706e1e55920b7f5
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Oct 27 00:13:35 2021 +0200
clutter: Propagate events only inside the grab
The grab actor becomes the "root" of the events being handled, events
inside propagate normally, but become silenced when falling outside
the grab area.
clutter/clutter/clutter-main.c | 4 +++-
clutter/clutter/clutter-stage-private.h | 1 +
clutter/clutter/clutter-stage.c | 12 ++++++++++++
3 files changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index 9dc010b415..98f64eeb6e 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -683,7 +683,9 @@ emit_event_chain (ClutterEvent *event)
return;
}
- _clutter_actor_handle_event (event->any.source, NULL, event);
+ _clutter_actor_handle_event (event->any.source,
+ clutter_stage_get_grab_actor (event->any.stage),
+ event);
}
/*
diff --git a/clutter/clutter/clutter-stage-private.h b/clutter/clutter/clutter-stage-private.h
index e5e1c81fa4..6ce68d4623 100644
--- a/clutter/clutter/clutter-stage-private.h
+++ b/clutter/clutter/clutter-stage-private.h
@@ -133,6 +133,7 @@ void clutter_stage_set_actor_needs_immediate_relayout (ClutterStage *stage);
void clutter_stage_remove_device_entry (ClutterStage *self,
ClutterInputDevice *device,
ClutterEventSequence *sequence);
+ClutterActor * clutter_stage_get_grab_actor (ClutterStage *stage);
G_END_DECLS
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index d6ab02b787..8224179073 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -3726,3 +3726,15 @@ clutter_ungrab (ClutterStage *stage,
g_free (grab);
}
+
+ClutterActor *
+clutter_stage_get_grab_actor (ClutterStage *stage)
+{
+ ClutterStagePrivate *priv = stage->priv;
+
+ if (!priv->grabs)
+ return NULL;
+
+ /* Return active grab */
+ return priv->grabs->actor;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]