diff --git a/lib/Drawing/StyleManager.vala b/lib/Drawing/StyleManager.vala index f2447b6ff..b32e82697 100644 --- a/lib/Drawing/StyleManager.vala +++ b/lib/Drawing/StyleManager.vala @@ -33,7 +33,7 @@ public class Gala.Drawing.StyleManager : Object { private const uint8 ACCENT_COLOR_ALPHA = 64; private static GLib.Once instance; - public static StyleManager get_instance () { + public static unowned StyleManager get_instance () { return instance.once (() => new StyleManager ()); } diff --git a/src/Widgets/MultitaskingView/WindowClone.vala b/src/Widgets/MultitaskingView/WindowClone.vala index 3aab288b0..77bb1c436 100644 --- a/src/Widgets/MultitaskingView/WindowClone.vala +++ b/src/Widgets/MultitaskingView/WindowClone.vala @@ -42,8 +42,6 @@ public class Gala.WindowClone : ActorTarget, RootTarget { */ public bool active { set { - active_shape.update_color (); - active_shape.save_easing_state (); active_shape.set_easing_duration (Utils.get_animation_duration (FADE_ANIMATION_DURATION)); active_shape.opacity = value ? 255 : 0; @@ -127,8 +125,9 @@ public class Gala.WindowClone : ActorTarget, RootTarget { add_action (drag_action); } - active_shape = new ActiveShape (monitor_scale); - active_shape.opacity = 0; + active_shape = new ActiveShape (monitor_scale) { + opacity = 0 + }; bind_property ("monitor-scale", active_shape, "monitor-scale"); clone_container = new Clutter.Actor () { @@ -675,7 +674,7 @@ public class Gala.WindowClone : ActorTarget, RootTarget { */ private class ActiveShape : Clutter.Actor { private const int BORDER_RADIUS = 16; - private const double COLOR_OPACITY = 0.8; + private const uint8 COLOR_OPACITY = 204; public float monitor_scale { get; construct set; } @@ -687,10 +686,19 @@ public class Gala.WindowClone : ActorTarget, RootTarget { var rounded_corners_effect = new RoundedCornersEffect (BORDER_RADIUS, monitor_scale); bind_property ("monitor-scale", rounded_corners_effect, "monitor-scale"); add_effect (rounded_corners_effect); - } - public void update_color () { - background_color = Drawing.StyleManager.get_instance ().theme_accent_color; + unowned var style_manager = Drawing.StyleManager.get_instance (); + style_manager.bind_property ("theme-accent-color", this, "background-color", SYNC_CREATE, (binding, from_value, ref to_value) => { +#if !HAS_MUTTER47 + var new_color = (Clutter.Color) from_value; +#else + var new_color = (Cogl.Color) from_value; +#endif + new_color.alpha = COLOR_OPACITY; + + to_value.set_boxed (&new_color); + return true; + }); } } }