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>
This commit is contained in:
parent
5523242eb9
commit
8abe876d15
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user