[mutter] window-actor: Add API to get the topmost surface actor
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] window-actor: Add API to get the topmost surface actor
- Date: Fri, 7 Jan 2022 19:30:44 +0000 (UTC)
commit 8abe876d15047e70dcee6e8686a6702ee650d5b3
Author: Robert Mader <robert mader posteo de>
Date: Wed Jan 5 22:05:50 2022 +0100
window-actor: Add API to get the topmost surface actor
On Wayland a window actor may have more than one surface actor,
most importantly when subsurfaces are used.
Add a new function to request the one which is at the top -
it will be used in the next commit.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2211>
src/compositor/meta-window-actor-private.h | 4 ++++
src/compositor/meta-window-actor-wayland.c | 17 +++++++++++++++++
src/compositor/meta-window-actor.c | 15 +++++++++++++++
3 files changed, 36 insertions(+)
---
diff --git a/src/compositor/meta-window-actor-private.h b/src/compositor/meta-window-actor-private.h
index 035eebb080..0f465cdf42 100644
--- a/src/compositor/meta-window-actor-private.h
+++ b/src/compositor/meta-window-actor-private.h
@@ -17,6 +17,8 @@ struct _MetaWindowActorClass
ClutterFrameInfo *frame_info,
int64_t presentation_time);
+ MetaSurfaceActor * (*get_topmost_surface) (MetaWindowActor *actor);
+
void (*assign_surface_actor) (MetaWindowActor *actor,
MetaSurfaceActor *surface_actor);
@@ -80,6 +82,8 @@ void meta_window_actor_effect_completed (MetaWindowActor *actor,
MetaSurfaceActor *meta_window_actor_get_surface (MetaWindowActor *self);
+MetaSurfaceActor * meta_window_actor_get_topmost_surface (MetaWindowActor *self);
+
void meta_window_actor_assign_surface_actor (MetaWindowActor *self,
MetaSurfaceActor *surface_actor);
diff --git a/src/compositor/meta-window-actor-wayland.c b/src/compositor/meta-window-actor-wayland.c
index bdc5c5a531..468229751f 100644
--- a/src/compositor/meta-window-actor-wayland.c
+++ b/src/compositor/meta-window-actor-wayland.c
@@ -88,6 +88,22 @@ meta_window_actor_wayland_rebuild_surface_tree (MetaWindowActor *actor)
&traverse_data);
}
+static MetaSurfaceActor *
+meta_window_actor_wayland_get_topmost_surface (MetaWindowActor *actor)
+{
+ ClutterActor *child_actor;
+
+ for (child_actor = clutter_actor_get_last_child (CLUTTER_ACTOR (actor));
+ child_actor;
+ child_actor = clutter_actor_get_previous_sibling (child_actor))
+ {
+ if (META_IS_SURFACE_ACTOR_WAYLAND (child_actor))
+ return META_SURFACE_ACTOR (child_actor);
+ }
+
+ return NULL;
+}
+
static void
meta_window_actor_wayland_assign_surface_actor (MetaWindowActor *actor,
MetaSurfaceActor *surface_actor)
@@ -177,6 +193,7 @@ meta_window_actor_wayland_class_init (MetaWindowActorWaylandClass *klass)
MetaWindowActorClass *window_actor_class = META_WINDOW_ACTOR_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ window_actor_class->get_topmost_surface = meta_window_actor_wayland_get_topmost_surface;
window_actor_class->assign_surface_actor = meta_window_actor_wayland_assign_surface_actor;
window_actor_class->frame_complete = meta_window_actor_wayland_frame_complete;
window_actor_class->queue_frame_drawn = meta_window_actor_wayland_queue_frame_drawn;
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index b32df2010c..9cee56a371 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -107,6 +107,8 @@ static void meta_window_actor_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
+static MetaSurfaceActor * meta_window_actor_real_get_topmost_surface (MetaWindowActor *self);
+
static void meta_window_actor_real_assign_surface_actor (MetaWindowActor *self,
MetaSurfaceActor *surface_actor);
@@ -130,6 +132,7 @@ meta_window_actor_class_init (MetaWindowActorClass *klass)
object_class->get_property = meta_window_actor_get_property;
object_class->constructed = meta_window_actor_constructed;
+ klass->get_topmost_surface = meta_window_actor_real_get_topmost_surface;
klass->assign_surface_actor = meta_window_actor_real_assign_surface_actor;
/**
@@ -556,6 +559,18 @@ meta_window_actor_get_surface (MetaWindowActor *self)
return priv->surface;
}
+static MetaSurfaceActor *
+meta_window_actor_real_get_topmost_surface (MetaWindowActor *self)
+{
+ return meta_window_actor_get_surface (self);
+}
+
+MetaSurfaceActor *
+meta_window_actor_get_topmost_surface (MetaWindowActor *self)
+{
+ return META_WINDOW_ACTOR_GET_CLASS (self)->get_topmost_surface (self);
+}
+
/**
* meta_window_actor_is_destroyed:
* @self: a #MetaWindowActor
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]