SystemBackground: cleanup (#1851)

Co-authored-by: Danielle Foré <danielle@elementary.io>
This commit is contained in:
Leo 2024-02-17 02:27:57 +09:00 committed by GitHub
parent 13018e4f5c
commit 61e51924d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 20 deletions

View File

@ -1,36 +1,20 @@
/*
* Copyright 2014 Tom Beckmann
* Copyright 2023 elementary, Inc. <https://elementary.io>
* Copyright 2023-2024 elementary, Inc. <https://elementary.io>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
public class Gala.SystemBackground : GLib.Object {
private const Clutter.Color DEFAULT_BACKGROUND_COLOR = { 0x2e, 0x34, 0x36, 0xff };
public Meta.BackgroundActor background_actor { get; construct; }
private static Meta.Background? system_background = null;
public SystemBackground (Meta.Display display) {
Object (background_actor: new Meta.BackgroundActor (display, 0));
}
construct {
if (system_background == null) {
system_background = new Meta.Background (background_actor.meta_display);
system_background.set_color (DEFAULT_BACKGROUND_COLOR);
}
var system_background = new Meta.Background (background_actor.meta_display);
system_background.set_color ({ 0x2e, 0x34, 0x36, 0xff });
((Meta.BackgroundContent) background_actor.content).background = system_background;
}
public static void refresh () {
// Meta.Background.refresh_all does not refresh backgrounds with the WALLPAPER style.
// (Last tested with mutter 3.28)
// As a workaround, re-apply the current color again to force the wallpaper texture
// to be rendered from scratch.
if (system_background != null) {
system_background.set_color (DEFAULT_BACKGROUND_COLOR);
}
}
}

View File

@ -155,7 +155,6 @@ namespace Gala {
unowned Meta.Display display = get_display ();
display.gl_video_memory_purged.connect (() => {
Meta.Background.refresh_all ();
SystemBackground.refresh ();
});
}