[mutter/gbsneto/cleanup-x11-from-window-actor: 10/10] window-actor: Move some code to MetaCompositor
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/cleanup-x11-from-window-actor: 10/10] window-actor: Move some code to MetaCompositor
- Date: Sat, 22 Dec 2018 15:14:14 +0000 (UTC)
commit 2dece745213531fccdffb38b9ea59c2515567299
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sat Dec 22 12:21:34 2018 -0200
window-actor: Move some code to MetaCompositor
MetaWindowActor breaks layering isolation by accessing
and injecting itself into compositor->windows. This is
a bad practice, and effecticely makes returning the
new actor useless, since we doesn't even use the return
value.
Move this code to under MetaCompositor and stop violating
(too badly) the resposabilities of each component.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/368
src/compositor/compositor.c | 16 +++++++++++++++-
src/compositor/meta-window-actor.c | 15 ---------------
2 files changed, 15 insertions(+), 16 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index a378ed805..3d9bd895a 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -660,11 +660,25 @@ void
meta_compositor_add_window (MetaCompositor *compositor,
MetaWindow *window)
{
+ MetaWindowActor *window_actor;
+ ClutterActor *window_group;
MetaDisplay *display = compositor->display;
meta_x11_error_trap_push (display->x11_display);
- meta_window_actor_new (window);
+ window_actor = meta_window_actor_new (window);
+
+ if (window->layer == META_LAYER_OVERRIDE_REDIRECT)
+ window_group = compositor->top_window_group;
+ else
+ window_group = compositor->window_group;
+
+ clutter_actor_add_child (window_group, CLUTTER_ACTOR (window_actor));
+
+ /* Initial position in the stack is arbitrary; stacking will be synced
+ * before we first paint.
+ */
+ compositor->windows = g_list_append (compositor->windows, window_actor);
sync_actor_stacking (compositor);
meta_x11_error_trap_pop (display->x11_display);
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 45c7f37d2..2c3077508 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -1238,10 +1238,7 @@ MetaWindowActor *
meta_window_actor_new (MetaWindow *window)
{
MetaWindowActorPrivate *priv;
- MetaDisplay *display = meta_window_get_display (window);
- MetaCompositor *compositor = display->compositor;
MetaWindowActor *self;
- ClutterActor *window_group;
GType window_type;
switch (window->client_type)
@@ -1281,20 +1278,8 @@ meta_window_actor_new (MetaWindow *window)
/* Hang our compositor window state off the MetaWindow for fast retrieval */
meta_window_set_compositor_private (window, G_OBJECT (self));
- if (window->layer == META_LAYER_OVERRIDE_REDIRECT)
- window_group = compositor->top_window_group;
- else
- window_group = compositor->window_group;
-
- clutter_actor_add_child (window_group, CLUTTER_ACTOR (self));
-
clutter_actor_hide (CLUTTER_ACTOR (self));
- /* Initial position in the stack is arbitrary; stacking will be synced
- * before we first paint.
- */
- compositor->windows = g_list_append (compositor->windows, self);
-
return self;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]