Expose BackgroundManager to the library (#1859)

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

View File

@ -0,0 +1,8 @@
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* SPDX-FileCopyrightText: 2024 elementary, Inc. (https://elementary.io)
*/
public interface Gala.BackgroundManagerInterface : Meta.BackgroundGroup {
public abstract Meta.BackgroundActor newest_background_actor { get; }
}

View File

@ -3,6 +3,7 @@ gala_lib_sources = files(
'App.vala',
'AppCache.vala',
'AppSystem.vala',
'BackgroundManager.vala',
'CloseButton.vala',
'Constants.vala',
'DragDropAction.vala',

View File

@ -4,7 +4,7 @@
* 2014 Tom Beckmann
*/
public class Gala.BackgroundManager : Meta.BackgroundGroup {
public class Gala.BackgroundManager : Meta.BackgroundGroup, Gala.BackgroundManagerInterface {
private const double DIM_OPACITY = 0.55;
private const int FADE_ANIMATION_TIME = 1000;
@ -13,6 +13,11 @@ public class Gala.BackgroundManager : Meta.BackgroundGroup {
public WindowManager wm { get; construct; }
public int monitor_index { get; construct; }
public bool control_position { get; construct; }
public Meta.BackgroundActor newest_background_actor {
get {
return (new_background_actor != null) ? new_background_actor : background_actor;
}
}
private BackgroundSource background_source;
private Meta.BackgroundActor background_actor;
@ -64,15 +69,14 @@ public class Gala.BackgroundManager : Meta.BackgroundGroup {
transition.remove_on_complete = true;
transition.completed.connect (() => {
old_background_actor.destroy ();
changed ();
});
old_background_actor.add_transition ("fade-out", transition);
} else {
old_background_actor.destroy ();
changed ();
}
changed ();
}
private void update_background_actor (bool animate = true) {