Skip to content

Commit 9d4e193

Browse files
committed
Fix rounded corners
1 parent 35f8d52 commit 9d4e193

File tree

1 file changed

+15
-34
lines changed

1 file changed

+15
-34
lines changed

src/BackgroundBlurEffect.vala

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -124,40 +124,6 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
124124

125125
round_clip_radius_location = round_pipeline.get_uniform_location ("clip_radius");
126126
round_actor_size_location = round_pipeline.get_uniform_location ("actor_size");
127-
128-
update_clip_radius ();
129-
update_actor_size ();
130-
131-
notify["monitor-scale"].connect (update_clip_radius);
132-
}
133-
134-
public override void set_actor (Clutter.Actor? new_actor) {
135-
if (actor != null) {
136-
actor.notify["width"].disconnect (update_actor_size);
137-
actor.notify["height"].disconnect (update_actor_size);
138-
}
139-
140-
base.set_actor (new_actor);
141-
142-
if (actor != null) {
143-
actor.notify["width"].connect (update_actor_size);
144-
actor.notify["height"].connect (update_actor_size);
145-
update_actor_size ();
146-
}
147-
}
148-
149-
private void update_clip_radius () {
150-
float[] _clip_radius = { clip_radius * monitor_scale };
151-
round_pipeline.set_uniform_float (round_clip_radius_location, 1, 1, _clip_radius);
152-
}
153-
154-
private void update_actor_size () {
155-
float[] actor_size = {
156-
actor.width,
157-
actor.height
158-
};
159-
160-
round_pipeline.set_uniform_float (round_actor_size_location, 2, 1, actor_size);
161127
}
162128

163129
private void update_actor_box (Clutter.PaintContext paint_context, ref Clutter.ActorBox source_actor_box) {
@@ -444,6 +410,21 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
444410
var blur_node = create_blur_nodes (node);
445411
paint_background (blur_node, paint_context, source_actor_box);
446412
add_actor_node (node);
413+
414+
update_uniforms ();
415+
}
416+
417+
private void update_uniforms () requires (round_texture != null || actor_texture != null) {
418+
float[] actor_size = {
419+
round_texture.get_width (),
420+
round_texture.get_height ()
421+
};
422+
round_pipeline.set_uniform_float (round_actor_size_location, 2, 1, actor_size);
423+
424+
float[] clip_vals = {
425+
(clip_radius * monitor_scale) / downscale_factor
426+
};
427+
round_pipeline.set_uniform_float (round_clip_radius_location, 1, 1, clip_vals);
447428
}
448429

449430
public override void paint (Clutter.PaintNode node, Clutter.PaintContext paint_context, Clutter.EffectPaintFlags flags) {

0 commit comments

Comments
 (0)