Skip to content

Commit 4b87bf9

Browse files
mtwebsterclefebvre
authored andcommitted
wayland: Fix desktop background
- Disable X11BackgroundActor in wayland - wayland compositor: Identify background windows created by csd-background and stack them correctly in the bottom_window_group.
1 parent bc10efe commit 4b87bf9

File tree

2 files changed

+42
-33
lines changed

2 files changed

+42
-33
lines changed

src/compositor/compositor.c

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -600,15 +600,19 @@ meta_compositor_manage (MetaCompositor *compositor)
600600
priv->top_window_group = meta_window_group_new (display);
601601
priv->bottom_window_group = meta_window_group_new (display);
602602
priv->feedback_group = meta_window_group_new (display);
603-
priv->background_actor = meta_x11_background_actor_new_for_display (display);
603+
604+
if (!meta_is_wayland_compositor ())
605+
{
606+
priv->background_actor = meta_x11_background_actor_new_for_display (display);
607+
clutter_actor_add_child (priv->window_group, priv->background_actor);
608+
}
609+
610+
clutter_actor_add_child (priv->window_group, priv->bottom_window_group);
604611

605612
// This needs to remain stacked just above the background actor in the window group.
606613
// So sync_actor_stacking() has to be able to reference it. The deskletManager
607614
// will take this and finish setting it up.
608615
priv->desklet_container = clutter_actor_new ();
609-
610-
clutter_actor_add_child (priv->window_group, priv->background_actor);
611-
clutter_actor_add_child (priv->window_group, priv->bottom_window_group);
612616
clutter_actor_add_child (priv->window_group, priv->desklet_container);
613617
clutter_actor_add_child (priv->stage, priv->window_group);
614618
clutter_actor_add_child (priv->stage, priv->top_window_group);
@@ -954,7 +958,7 @@ sync_actor_stacking (MetaCompositor *compositor)
954958
}
955959
}
956960

957-
g_list_free (children);
961+
g_clear_pointer (&children, g_list_free);
958962

959963
if (!reordered)
960964
{
@@ -989,6 +993,31 @@ sync_actor_stacking (MetaCompositor *compositor)
989993
// Then the bottom window group (which META_WINDOW_DESKTOP windows like nemo-desktop's get placed in).
990994
clutter_actor_set_child_below_sibling (priv->window_group, priv->bottom_window_group, NULL);
991995

996+
if (meta_is_wayland_compositor ())
997+
{
998+
children = clutter_actor_get_children (priv->bottom_window_group);
999+
for (tmp = children; tmp != NULL; tmp = tmp->next)
1000+
{
1001+
MetaWindowActor *child = tmp->data;
1002+
MetaWindow *mw = meta_window_actor_get_meta_window (child);
1003+
1004+
if (mw != NULL)
1005+
{
1006+
// CsdBackground manager sets _NET_WM_STATE_BELOW (gtk_window_set_keep_below)
1007+
// This sets its stack layer to META_LAYER_BOTTOM, so we can keep these below
1008+
// the nemo-desktop, etc..
1009+
MetaStackLayer layer = meta_window_get_default_layer (mw);
1010+
1011+
if (layer == META_LAYER_BOTTOM)
1012+
{
1013+
clutter_actor_set_child_below_sibling (priv->bottom_window_group, CLUTTER_ACTOR (child), NULL);
1014+
}
1015+
}
1016+
}
1017+
1018+
g_list_free (children);
1019+
}
1020+
9921021
// and finally backgrounds..
9931022

9941023
/* we prepended the backgrounds above so the last actor in the list
@@ -1719,6 +1748,11 @@ meta_get_x11_background_actor_for_display (MetaDisplay *display)
17191748
MetaCompositorPrivate *priv =
17201749
meta_compositor_get_instance_private (display->compositor);
17211750

1751+
if (meta_is_wayland_compositor ())
1752+
{
1753+
return NULL;
1754+
}
1755+
17221756
return priv->background_actor;
17231757
}
17241758

src/x11/meta-x11-background-actor.c

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,9 @@ meta_x11_background_actor_new_for_display (MetaDisplay *display)
534534

535535
g_return_val_if_fail (META_IS_DISPLAY (display), NULL);
536536

537+
if (meta_is_wayland_compositor ())
538+
return NULL;
539+
537540
self = g_object_new (META_TYPE_X11_BACKGROUND_ACTOR, NULL);
538541
priv = self->priv;
539542

@@ -567,7 +570,6 @@ meta_x11_background_actor_update (MetaDisplay *display)
567570
{
568571
MetaX11Display *x11_display;
569572
MetaDisplayBackground *background;
570-
MetaCompositor *compositor;
571573
Atom type;
572574
int format;
573575
gulong nitems;
@@ -577,7 +579,6 @@ meta_x11_background_actor_update (MetaDisplay *display)
577579

578580
x11_display = meta_display_get_x11_display (display);
579581
background = meta_display_background_get (display);
580-
compositor = meta_display_get_compositor (display);
581582

582583
root_pixmap_id = None;
583584
if (!XGetWindowProperty (meta_x11_display_get_xdisplay (x11_display),
@@ -666,29 +667,3 @@ meta_x11_background_actor_screen_size_changed (MetaDisplay *x11_display)
666667

667668
update_wrap_mode (background);
668669
}
669-
670-
static MetaDisplayBackground *
671-
display_background_get (MetaDisplay *display)
672-
{
673-
MetaDisplayBackground *background;
674-
675-
background = g_object_get_data (G_OBJECT (display), "meta-display-background");
676-
if (background == NULL)
677-
{
678-
ClutterActor *stage;
679-
680-
background = g_new0 (MetaDisplayBackground, 1);
681-
682-
background->x11_display = meta_display_get_x11_display (display);
683-
g_object_set_data_full (G_OBJECT (display), "meta-screen-background",
684-
background, (GDestroyNotify) free_display_background);
685-
686-
stage = meta_get_stage_for_display (display);
687-
g_signal_connect (stage, "notify::background-color",
688-
G_CALLBACK (on_notify_stage_color), background);
689-
690-
meta_x11_background_actor_update (display);
691-
}
692-
693-
return background;
694-
}

0 commit comments

Comments
 (0)