mirror of
https://github.com/elementary/gala.git
synced 2024-07-14 18:30:28 +03:00
Background: respect animations key (#1779)
Co-authored-by: Danielle Foré <danielle@elementary.io>
This commit is contained in:
parent
5a917dec1a
commit
86293d44c1
@ -20,14 +20,14 @@ namespace Gala {
|
||||
public signal void changed ();
|
||||
public signal void show_background_menu (int x, int y);
|
||||
|
||||
public Meta.Display display { get; construct; }
|
||||
public WindowManager wm { get; construct; }
|
||||
|
||||
public BackgroundContainer (Meta.Display display) {
|
||||
Object (display: display);
|
||||
public BackgroundContainer (WindowManager wm) {
|
||||
Object (wm: wm);
|
||||
}
|
||||
|
||||
construct {
|
||||
unowned var monitor_manager = display.get_context ().get_backend ().get_monitor_manager ();
|
||||
unowned var monitor_manager = wm.get_display ().get_context ().get_backend ().get_monitor_manager ();
|
||||
monitor_manager.monitors_changed.connect (update);
|
||||
|
||||
reactive = true;
|
||||
@ -43,7 +43,7 @@ namespace Gala {
|
||||
}
|
||||
|
||||
~BackgroundContainer () {
|
||||
unowned var monitor_manager = display.get_context ().get_backend ().get_monitor_manager ();
|
||||
unowned var monitor_manager = wm.get_display ().get_context ().get_backend ().get_monitor_manager ();
|
||||
monitor_manager.monitors_changed.disconnect (update);
|
||||
}
|
||||
|
||||
@ -54,8 +54,8 @@ namespace Gala {
|
||||
|
||||
destroy_all_children ();
|
||||
|
||||
for (var i = 0; i < display.get_n_monitors (); i++) {
|
||||
var background = new BackgroundManager (display, i);
|
||||
for (var i = 0; i < wm.get_display ().get_n_monitors (); i++) {
|
||||
var background = new BackgroundManager (wm, i);
|
||||
|
||||
add_child (background);
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace Gala {
|
||||
|
||||
public signal void changed ();
|
||||
|
||||
public Meta.Display display { get; construct; }
|
||||
public WindowManager wm { get; construct; }
|
||||
public int monitor_index { get; construct; }
|
||||
public bool control_position { get; construct; }
|
||||
|
||||
@ -30,12 +30,12 @@ namespace Gala {
|
||||
private Meta.BackgroundActor background_actor;
|
||||
private Meta.BackgroundActor? new_background_actor = null;
|
||||
|
||||
public BackgroundManager (Meta.Display display, int monitor_index, bool control_position = true) {
|
||||
Object (display: display, monitor_index: monitor_index, control_position: control_position);
|
||||
public BackgroundManager (WindowManager wm, int monitor_index, bool control_position = true) {
|
||||
Object (wm: wm, monitor_index: monitor_index, control_position: control_position);
|
||||
}
|
||||
|
||||
construct {
|
||||
background_source = BackgroundCache.get_default ().get_background_source (display);
|
||||
background_source = BackgroundCache.get_default ().get_background_source (wm.get_display ());
|
||||
background_actor = create_background_actor ();
|
||||
|
||||
destroy.connect (on_destroy);
|
||||
@ -66,7 +66,7 @@ namespace Gala {
|
||||
if (old_background_actor == null)
|
||||
return;
|
||||
|
||||
if (animate) {
|
||||
if (animate && wm.enable_animations) {
|
||||
var transition = new Clutter.PropertyTransition ("opacity");
|
||||
transition.set_from_value (255);
|
||||
transition.set_to_value (0);
|
||||
@ -125,6 +125,8 @@ namespace Gala {
|
||||
}
|
||||
|
||||
private Meta.BackgroundActor create_background_actor () {
|
||||
unowned var display = wm.get_display ();
|
||||
|
||||
var background = background_source.get_background (monitor_index);
|
||||
var background_actor = new Meta.BackgroundActor (display, monitor_index);
|
||||
|
||||
|
@ -41,7 +41,7 @@ namespace Gala {
|
||||
construct {
|
||||
reactive = true;
|
||||
|
||||
background = new BackgroundManager (display, monitor, false);
|
||||
background = new BackgroundManager (wm, monitor, false);
|
||||
|
||||
var scale = display.get_monitor_scale (monitor);
|
||||
|
||||
|
@ -27,14 +27,18 @@ namespace Gala {
|
||||
private int last_width;
|
||||
private int last_height;
|
||||
|
||||
public FramedBackground (Meta.Display display) {
|
||||
Object (display: display, monitor_index: display.get_primary_monitor (), control_position: false);
|
||||
public FramedBackground (WindowManager wm) {
|
||||
Object (
|
||||
wm: wm,
|
||||
monitor_index: wm.get_display ().get_primary_monitor (),
|
||||
control_position: false
|
||||
);
|
||||
}
|
||||
|
||||
construct {
|
||||
pipeline = new Cogl.Pipeline (Clutter.get_default_backend ().get_cogl_context ());
|
||||
var primary = display.get_primary_monitor ();
|
||||
var monitor_geom = display.get_monitor_geometry (primary);
|
||||
var primary = wm.get_display ().get_primary_monitor ();
|
||||
var monitor_geom = wm.get_display ().get_monitor_geometry (primary);
|
||||
|
||||
var effect = new ShadowEffect (40) {
|
||||
css_class = "workspace"
|
||||
@ -175,7 +179,7 @@ namespace Gala {
|
||||
background_click_action.clicked.connect (() => {
|
||||
selected (true);
|
||||
});
|
||||
background = new FramedBackground (display);
|
||||
background = new FramedBackground (wm);
|
||||
background.add_action (background_click_action);
|
||||
|
||||
window_container = new WindowCloneContainer (wm, gesture_tracker, scale_factor);
|
||||
|
@ -238,7 +238,7 @@ namespace Gala {
|
||||
stage.remove_child (window_group);
|
||||
ui_group.add_child (window_group);
|
||||
|
||||
background_group = new BackgroundContainer (display);
|
||||
background_group = new BackgroundContainer (this);
|
||||
((BackgroundContainer)background_group).show_background_menu.connect (on_show_background_menu);
|
||||
window_group.add_child (background_group);
|
||||
window_group.set_child_below_sibling (background_group, null);
|
||||
|
Loading…
Reference in New Issue
Block a user