[mutter] compositor: Split out a function to update the topmost window actor
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] compositor: Split out a function to update the topmost window actor
- Date: Wed, 18 May 2022 10:28:04 +0000 (UTC)
commit 0bc142ec1b0753416c6dca40103ebcc09b2bbafa
Author: Sebastian Keller <skeller gnome org>
Date: Thu May 12 17:39:56 2022 +0200
compositor: Split out a function to update the topmost window actor
This allows this to be used from outside the restacking code in the
follow-up commit.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2413>
src/compositor/compositor.c | 43 +++++++++++++++++++++++--------------------
1 file changed, 23 insertions(+), 20 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 1576ce551c..45c92d8cb6 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -757,12 +757,13 @@ sync_actor_stacking (MetaCompositor *compositor)
* this is to avoid offscreen windows that isn't actually part of the visible
* desktop (such as the UI frames override redirect window).
*/
-static MetaWindowActor *
-get_top_visible_window_actor (MetaCompositor *compositor)
+static void
+update_top_window_actor (MetaCompositor *compositor)
{
MetaCompositorPrivate *priv =
meta_compositor_get_instance_private (compositor);
GList *l;
+ MetaWindowActor *top_window_actor = NULL;
for (l = g_list_last (priv->windows); l; l = l->prev)
{
@@ -779,10 +780,27 @@ get_top_visible_window_actor (MetaCompositor *compositor)
&display_rect.width, &display_rect.height);
if (meta_rectangle_overlap (&display_rect, &buffer_rect))
- return window_actor;
+ {
+ top_window_actor = window_actor;
+ break;
+ }
}
- return NULL;
+ if (priv->top_window_actor == top_window_actor)
+ return;
+
+ g_clear_signal_handler (&priv->top_window_actor_destroy_id,
+ priv->top_window_actor);
+
+ priv->top_window_actor = top_window_actor;
+
+ if (priv->top_window_actor)
+ {
+ priv->top_window_actor_destroy_id =
+ g_signal_connect (priv->top_window_actor, "destroy",
+ G_CALLBACK (on_top_window_actor_destroyed),
+ compositor);
+ }
}
static void
@@ -805,7 +823,6 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
{
MetaCompositorPrivate *priv =
meta_compositor_get_instance_private (compositor);
- MetaWindowActor *top_window_actor;
GList *old_stack;
/* This is painful because hidden windows that we are in the process
@@ -889,21 +906,7 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
sync_actor_stacking (compositor);
- top_window_actor = get_top_visible_window_actor (compositor);
-
- if (priv->top_window_actor == top_window_actor)
- return;
-
- g_clear_signal_handler (&priv->top_window_actor_destroy_id,
- priv->top_window_actor);
-
- priv->top_window_actor = top_window_actor;
-
- if (priv->top_window_actor)
- priv->top_window_actor_destroy_id =
- g_signal_connect (priv->top_window_actor, "destroy",
- G_CALLBACK (on_top_window_actor_destroyed),
- compositor);
+ update_top_window_actor (compositor);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]