Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Drawing/StyleManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class Gala.Drawing.StyleManager : Object {
private const uint8 ACCENT_COLOR_ALPHA = 64;

private static GLib.Once<StyleManager> instance;
public static StyleManager get_instance () {
public static unowned StyleManager get_instance () {
return instance.once (() => new StyleManager ());
}

Expand Down
24 changes: 16 additions & 8 deletions src/Widgets/MultitaskingView/WindowClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 () {
Expand Down Expand Up @@ -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; }

Expand All @@ -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;
});
}
}
}