mirror of
https://github.com/elementary/gala.git
synced 2024-08-18 03:20:46 +03:00
SystemBackground: cleanup (#1851)
Co-authored-by: Danielle Foré <danielle@elementary.io>
This commit is contained in:
parent
13018e4f5c
commit
61e51924d0
@ -1,36 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Tom Beckmann
|
* 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
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Gala.SystemBackground : GLib.Object {
|
public class Gala.SystemBackground : GLib.Object {
|
||||||
private const Clutter.Color DEFAULT_BACKGROUND_COLOR = { 0x2e, 0x34, 0x36, 0xff };
|
|
||||||
|
|
||||||
public Meta.BackgroundActor background_actor { get; construct; }
|
public Meta.BackgroundActor background_actor { get; construct; }
|
||||||
|
|
||||||
private static Meta.Background? system_background = null;
|
|
||||||
|
|
||||||
public SystemBackground (Meta.Display display) {
|
public SystemBackground (Meta.Display display) {
|
||||||
Object (background_actor: new Meta.BackgroundActor (display, 0));
|
Object (background_actor: new Meta.BackgroundActor (display, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
construct {
|
construct {
|
||||||
if (system_background == null) {
|
var system_background = new Meta.Background (background_actor.meta_display);
|
||||||
system_background = new Meta.Background (background_actor.meta_display);
|
system_background.set_color ({ 0x2e, 0x34, 0x36, 0xff });
|
||||||
system_background.set_color (DEFAULT_BACKGROUND_COLOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
((Meta.BackgroundContent) background_actor.content).background = system_background;
|
((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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,6 @@ namespace Gala {
|
|||||||
unowned Meta.Display display = get_display ();
|
unowned Meta.Display display = get_display ();
|
||||||
display.gl_video_memory_purged.connect (() => {
|
display.gl_video_memory_purged.connect (() => {
|
||||||
Meta.Background.refresh_all ();
|
Meta.Background.refresh_all ();
|
||||||
SystemBackground.refresh ();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user