Skip to content

Commit 099cd69

Browse files
authored
ActiveShape: use more opaque accent color (#2604)
This got overlooked in #2590 While we're here let's use bind_property instead of syncing accent color on demand
1 parent 3458e11 commit 099cd69

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

lib/Drawing/StyleManager.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class Gala.Drawing.StyleManager : Object {
3333
private const uint8 ACCENT_COLOR_ALPHA = 64;
3434

3535
private static GLib.Once<StyleManager> instance;
36-
public static StyleManager get_instance () {
36+
public static unowned StyleManager get_instance () {
3737
return instance.once (() => new StyleManager ());
3838
}
3939

src/Widgets/MultitaskingView/WindowClone.vala

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
4242
*/
4343
public bool active {
4444
set {
45-
active_shape.update_color ();
46-
4745
active_shape.save_easing_state ();
4846
active_shape.set_easing_duration (Utils.get_animation_duration (FADE_ANIMATION_DURATION));
4947
active_shape.opacity = value ? 255 : 0;
@@ -127,8 +125,9 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
127125
add_action (drag_action);
128126
}
129127

130-
active_shape = new ActiveShape (monitor_scale);
131-
active_shape.opacity = 0;
128+
active_shape = new ActiveShape (monitor_scale) {
129+
opacity = 0
130+
};
132131
bind_property ("monitor-scale", active_shape, "monitor-scale");
133132

134133
clone_container = new Clutter.Actor () {
@@ -675,7 +674,7 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
675674
*/
676675
private class ActiveShape : Clutter.Actor {
677676
private const int BORDER_RADIUS = 16;
678-
private const double COLOR_OPACITY = 0.8;
677+
private const uint8 COLOR_OPACITY = 204;
679678

680679
public float monitor_scale { get; construct set; }
681680

@@ -687,10 +686,19 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
687686
var rounded_corners_effect = new RoundedCornersEffect (BORDER_RADIUS, monitor_scale);
688687
bind_property ("monitor-scale", rounded_corners_effect, "monitor-scale");
689688
add_effect (rounded_corners_effect);
690-
}
691689

692-
public void update_color () {
693-
background_color = Drawing.StyleManager.get_instance ().theme_accent_color;
690+
unowned var style_manager = Drawing.StyleManager.get_instance ();
691+
style_manager.bind_property ("theme-accent-color", this, "background-color", SYNC_CREATE, (binding, from_value, ref to_value) => {
692+
#if !HAS_MUTTER47
693+
var new_color = (Clutter.Color) from_value;
694+
#else
695+
var new_color = (Cogl.Color) from_value;
696+
#endif
697+
new_color.alpha = COLOR_OPACITY;
698+
699+
to_value.set_boxed (&new_color);
700+
return true;
701+
});
694702
}
695703
}
696704
}

0 commit comments

Comments
 (0)