Skip to content

Commit cbd5b64

Browse files
committed
ActiveShape: use more opaque accent color
1 parent 81a3a00 commit cbd5b64

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-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: 18 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 ();
131-
active_shape.opacity = 0;
128+
active_shape = new ActiveShape () {
129+
opacity = 0
130+
};
132131

133132
clone_container = new Clutter.Actor () {
134133
pivot_point = { 0.5f, 0.5f }
@@ -672,14 +671,25 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
672671
*/
673672
private class ActiveShape : Clutter.Actor {
674673
private const int BORDER_RADIUS = 16;
675-
private const double COLOR_OPACITY = 0.8;
674+
private const uint8 COLOR_OPACITY = 204;
676675

677676
construct {
678677
add_effect (new RoundedCornersEffect (BORDER_RADIUS, 1.0f));
679-
}
680678

681-
public void update_color () {
682-
background_color = Drawing.StyleManager.get_instance ().theme_accent_color;
679+
unowned var style_manager = Drawing.StyleManager.get_instance ();
680+
style_manager.bind_property ("theme-accent-color", this, "background-color", SYNC_CREATE, (binding, from_value, ref to_value) => {
681+
#if !HAS_MUTTER47
682+
var new_color_ptr = (Clutter.Color*) from_value.get_boxed ();
683+
#else
684+
var new_color_ptr = (Cogl.Color*) from_value.get_boxed ();
685+
#endif
686+
687+
var new_color = *new_color_ptr;
688+
new_color.alpha = COLOR_OPACITY;
689+
690+
to_value = new_color;
691+
return true;
692+
}, null);
683693
}
684694
}
685695
}

0 commit comments

Comments
 (0)