[mutter/wip/carlosg/grabs-pt2: 100/102] clutter: Add docs and introspection annotations to grabs
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/grabs-pt2: 100/102] clutter: Add docs and introspection annotations to grabs
- Date: Tue, 7 Dec 2021 21:36:43 +0000 (UTC)
commit 8ce190a7e21b89a7fba09b302b5c0203aa2c13bb
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Nov 17 23:17:14 2021 +0100
clutter: Add docs and introspection annotations to grabs
Since we want these accessed from bindings this must be a boxed
type. Since we want a explicit start/end lifetime, this cannot be
refcounted, so make these functions shallow.
clutter/clutter/clutter-grab.h | 10 +++++++++
clutter/clutter/clutter-stage.c | 50 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+)
---
diff --git a/clutter/clutter/clutter-grab.h b/clutter/clutter/clutter-grab.h
index 5cb86baa57..0a883cba9c 100644
--- a/clutter/clutter/clutter-grab.h
+++ b/clutter/clutter/clutter-grab.h
@@ -30,12 +30,22 @@
#include <glib-object.h>
+#define CLUTTER_TYPE_GRAB (clutter_grab_get_type ())
typedef struct _ClutterGrab ClutterGrab;
+CLUTTER_EXPORT
+GType clutter_grab_get_type (void) G_GNUC_CONST;
+
CLUTTER_EXPORT
void clutter_grab_dismiss (ClutterGrab *grab);
CLUTTER_EXPORT
ClutterGrabState clutter_grab_get_windowing_state (ClutterGrab *grab);
+CLUTTER_EXPORT
+ClutterGrab * clutter_grab_ref (ClutterGrab *grab);
+
+CLUTTER_EXPORT
+void clutter_grab_unref (ClutterGrab *grab);
+
#endif /* CLUTTER_GRAB_H */
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index 7924b72ced..4506be95a8 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -3733,6 +3733,31 @@ clutter_stage_notify_grab (ClutterStage *stage,
clutter_stage_notify_grab_on_key_focus (stage, cur_actor, old_actor);
}
+ClutterGrab *
+clutter_grab_ref (ClutterGrab *grab)
+{
+ return grab;
+}
+
+void
+clutter_grab_unref (ClutterGrab *grab)
+{
+}
+
+G_DEFINE_BOXED_TYPE (ClutterGrab, clutter_grab,
+ clutter_grab_ref, clutter_grab_unref)
+
+/**
+ * clutter_stage_grab:
+ * @stage: The #ClutterStage
+ * @actor: The actor grabbing input
+ *
+ * Grabs input onto a certain actor. Events will be propagated as
+ * usual inside its hierarchy.
+ *
+ * Returns: (transfer none): (nullable): an opaque #ClutterGrab handle, drop
+ * with clutter_grab_dismiss()
+ **/
ClutterGrab *
clutter_stage_grab (ClutterStage *stage,
ClutterActor *actor)
@@ -3815,6 +3840,13 @@ clutter_stage_unlink_grab (ClutterStage *stage,
grab->prev = NULL;
}
+/**
+ * clutter_grab_dismiss:
+ * @grab: Grab to undo
+ *
+ * Removes a grab. If this grab is effective, crossing events
+ * will be generated to indicate the change in event redirection.
+ **/
void
clutter_grab_dismiss (ClutterGrab *grab)
{
@@ -3824,6 +3856,16 @@ clutter_grab_dismiss (ClutterGrab *grab)
g_free (grab);
}
+/**
+ * clutter_grab_get_windowing_state:
+ * @grab: a Grab handle
+ *
+ * Returns the windowing-level state of the
+ * grab, the devices that are guaranteed to be
+ * grabbed.
+ *
+ * Returns: The state of the grab.
+ **/
ClutterGrabState
clutter_grab_get_windowing_state (ClutterGrab *grab)
{
@@ -3832,6 +3874,14 @@ clutter_grab_get_windowing_state (ClutterGrab *grab)
return grab->stage->priv->grab_state;
}
+/**
+ * clutter_stage_get_grab_actor:
+ * @stage: a #ClutterStage
+ *
+ * Gets the actor that currently holds a grab.
+ *
+ * Returns: (transfer none): The grabbing actor
+ **/
ClutterActor *
clutter_stage_get_grab_actor (ClutterStage *stage)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]