Skip to content

Commit 9684c3f

Browse files
authored
Merge branch 'main' into lenemter/windowswicher-scale-icons
2 parents b35f705 + 099cd69 commit 9684c3f

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
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/Tooltip.vala

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88
* Clutter actor to display text in a tooltip-like component.
99
*/
1010
public class Gala.Tooltip : Clutter.Actor {
11-
/**
12-
* Actor to display the Tooltip text.
13-
*/
11+
public float monitor_scale { get; construct set; }
12+
1413
private Gala.Text text_actor;
1514

15+
public Tooltip (float monitor_scale) {
16+
Object (monitor_scale: monitor_scale);
17+
}
18+
1619
construct {
1720
text_actor = new Gala.Text () {
1821
margin_left = 6,
@@ -28,7 +31,9 @@ public class Gala.Tooltip : Clutter.Actor {
2831
layout_manager = new Clutter.BinLayout ();
2932
background_color = Drawing.Color.TOOLTIP_BACKGROUND;
3033

31-
add_effect (new RoundedCornersEffect (3, 1.0f));
34+
var rounded_corners_effect = new RoundedCornersEffect (3, monitor_scale);
35+
bind_property ("monitor-scale", rounded_corners_effect, "monitor-scale");
36+
add_effect (rounded_corners_effect);
3237
}
3338

3439
public void set_text (string new_text) {

src/Widgets/MultitaskingView/WindowClone.vala

Lines changed: 18 additions & 9 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,15 +125,17 @@ 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 () {
135134
pivot_point = { 0.5f, 0.5f }
136135
};
137136

138-
window_title = new Tooltip ();
137+
window_title = new Tooltip (monitor_scale);
138+
bind_property ("monitor-scale", window_title, "monitor-scale");
139139

140140
close_button = new Gala.CloseButton (monitor_scale) {
141141
opacity = 0
@@ -674,7 +674,7 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
674674
*/
675675
private class ActiveShape : Clutter.Actor {
676676
private const int BORDER_RADIUS = 16;
677-
private const double COLOR_OPACITY = 0.8;
677+
private const uint8 COLOR_OPACITY = 204;
678678

679679
public float monitor_scale { get; construct set; }
680680

@@ -686,10 +686,19 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
686686
var rounded_corners_effect = new RoundedCornersEffect (BORDER_RADIUS, monitor_scale);
687687
bind_property ("monitor-scale", rounded_corners_effect, "monitor-scale");
688688
add_effect (rounded_corners_effect);
689-
}
690689

691-
public void update_color () {
692-
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+
});
693702
}
694703
}
695704
}

0 commit comments

Comments
 (0)