[mutter/wip/carlosg/grabs-pt1: 86/93] 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: 86/93] clutter: Propagate events only inside the grab
- Date: Tue, 7 Dec 2021 21:33:01 +0000 (UTC)
commit 53c9d8f4415d7777e50c7a6d450f2d3fc6b8e96a
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.c | 12 ++++++++++++
clutter/clutter/clutter-stage.h | 3 +++
3 files changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index 132576e67c..f80fbae9be 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.c b/clutter/clutter/clutter-stage.c
index e3fbeb3e95..8b29197579 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -3845,3 +3845,15 @@ clutter_grab_dismiss (ClutterGrab *grab)
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;
+}
diff --git a/clutter/clutter/clutter-stage.h b/clutter/clutter/clutter-stage.h
index b45c50ccd7..fc90f69104 100644
--- a/clutter/clutter/clutter-stage.h
+++ b/clutter/clutter/clutter-stage.h
@@ -274,6 +274,9 @@ CLUTTER_EXPORT
ClutterGrab * clutter_stage_grab (ClutterStage *stage,
ClutterActor *actor);
+CLUTTER_EXPORT
+ClutterActor * clutter_stage_get_grab_actor (ClutterStage *stage);
+
G_END_DECLS
#endif /* __CLUTTER_STAGE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]