Skip to content

Commit 8927073

Browse files
committed
Merge branch 'main' into leolost/window-list-model-full
2 parents f25da8f + 79c9ff1 commit 8927073

File tree

3 files changed

+35
-29
lines changed

3 files changed

+35
-29
lines changed

src/BackgroundBlurEffect.vala

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,6 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
224224
}
225225

226226
private bool update_actor_fbo (int width, int height, float downscale_factor) {
227-
if (width <= 0 || height <= 0) {
228-
return false;
229-
}
230-
231227
if (
232228
texture_width == width &&
233229
texture_height == height &&
@@ -344,7 +340,7 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
344340
var width = (int) actor_box.get_width ();
345341
var height = (int) actor_box.get_height ();
346342

347-
if (width < 0 || height < 0) {
343+
if (width <= 0 || height <= 0) {
348344
warning ("BackgroundBlurEffect: Couldn't update framebuffers, incorrect size");
349345
return false;
350346
}

src/BlurManager.vala

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,22 @@ public class Gala.BlurManager : Object {
3232

3333
public WindowManagerGala wm { get; construct; }
3434

35+
private bool framebuffer_is_logical = false;
3536
private GLib.HashTable<Meta.Window, BlurData?> blurred_windows = new GLib.HashTable<Meta.Window, BlurData?> (null, null);
3637

3738
private BlurManager (WindowManagerGala wm) {
3839
Object (wm: wm);
3940
}
4041

4142
construct {
43+
var experimental_features = new Settings ("org.gnome.mutter").get_strv ("experimental-features");
44+
for (var i = 0; i < experimental_features.length; i++) {
45+
if (experimental_features[i] == "scale-monitor-framebuffer") {
46+
framebuffer_is_logical = true;
47+
break;
48+
}
49+
}
50+
4251
wm.get_display ().window_created.connect ((window) => {
4352
window.notify["mutter-hints"].connect ((obj, pspec) => parse_mutter_hints ((Meta.Window) obj));
4453
parse_mutter_hints (window);
@@ -74,8 +83,17 @@ public class Gala.BlurManager : Object {
7483
var x_shadow_size = frame_rect.x - buffer_rect.x;
7584
var y_shadow_size = frame_rect.y - buffer_rect.y;
7685

77-
blur_data.actor.set_position (x_shadow_size + left, y_shadow_size + top);
78-
blur_data.actor.set_size (frame_rect.width - left - right, frame_rect.height - top - bottom);
86+
var monitor_scale = framebuffer_is_logical ? 1.0f : window.display.get_monitor_scale (window.get_monitor ());
87+
var inverse_monitor_scale = 1.0f / monitor_scale;
88+
89+
blur_data.actor.set_position (
90+
Utils.scale_to_int (x_shadow_size, inverse_monitor_scale) + left,
91+
Utils.scale_to_int (y_shadow_size, inverse_monitor_scale) + top
92+
);
93+
blur_data.actor.set_size (
94+
Utils.scale_to_int (frame_rect.width, inverse_monitor_scale) - left - right,
95+
Utils.scale_to_int (frame_rect.height, inverse_monitor_scale) - top - bottom
96+
);
7997
}
8098

8199
public void remove_blur (Meta.Window window) {

src/WindowManager.vala

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,59 +1079,50 @@ namespace Gala {
10791079
return;
10801080
}
10811081

1082-
var duration = AnimationDuration.HIDE;
1083-
10841082
kill_window_effects (actor);
10851083
minimizing.add (actor);
10861084

1087-
int width, height;
1088-
get_display ().get_size (out width, out height);
1089-
10901085
Mtk.Rectangle icon = {};
10911086
if (actor.get_meta_window ().get_icon_geometry (out icon)) {
10921087
// Fix icon position and size according to ui scaling factor.
1093-
float ui_scale = get_display ().get_monitor_scale (get_display ().get_monitor_index_for_rect (icon));
1088+
var ui_scale = get_display ().get_monitor_scale (get_display ().get_monitor_index_for_rect (icon));
10941089
icon.x = Utils.scale_to_int (icon.x, ui_scale);
10951090
icon.y = Utils.scale_to_int (icon.y, ui_scale);
10961091
icon.width = Utils.scale_to_int (icon.width, ui_scale);
10971092
icon.height = Utils.scale_to_int (icon.height, ui_scale);
10981093

1099-
float scale_x = (float)icon.width / actor.width;
1100-
float scale_y = (float)icon.height / actor.height;
1101-
float anchor_x = (float)(actor.x - icon.x) / (icon.width - actor.width);
1102-
float anchor_y = (float)(actor.y - icon.y) / (icon.height - actor.height);
1103-
actor.set_pivot_point (anchor_x, anchor_y);
1094+
actor.set_pivot_point (
1095+
(actor.x - icon.x) / (icon.width - actor.width),
1096+
(actor.y - icon.y) / (icon.height - actor.height)
1097+
);
11041098

11051099
actor.save_easing_state ();
11061100
actor.set_easing_mode (Clutter.AnimationMode.EASE_IN_EXPO);
1107-
actor.set_easing_duration (duration);
1108-
actor.set_scale (scale_x, scale_y);
1109-
actor.opacity = 0U;
1101+
actor.set_easing_duration (AnimationDuration.HIDE);
1102+
actor.set_scale (icon.width / actor.width, icon.height / actor.height);
1103+
actor.opacity = 0;
11101104
actor.restore_easing_state ();
11111105

1112-
ulong minimize_handler_id = 0UL;
1106+
ulong minimize_handler_id = 0;
11131107
minimize_handler_id = actor.transitions_completed.connect (() => {
11141108
actor.disconnect (minimize_handler_id);
11151109
minimize_completed (actor);
11161110
minimizing.remove (actor);
11171111
});
1118-
11191112
} else {
11201113
actor.set_pivot_point (0.5f, 1.0f);
11211114

11221115
actor.save_easing_state ();
11231116
actor.set_easing_mode (Clutter.AnimationMode.EASE_IN_EXPO);
1124-
actor.set_easing_duration (duration);
1125-
actor.set_scale (0.0f, 0.0f);
1126-
actor.opacity = 0U;
1117+
actor.set_easing_duration (AnimationDuration.HIDE);
1118+
actor.set_scale (0.0, 0.0);
1119+
actor.opacity = 0;
11271120
actor.restore_easing_state ();
11281121

1129-
ulong minimize_handler_id = 0UL;
1122+
ulong minimize_handler_id = 0;
11301123
minimize_handler_id = actor.transitions_completed.connect (() => {
11311124
actor.disconnect (minimize_handler_id);
11321125
actor.set_pivot_point (0.0f, 0.0f);
1133-
actor.set_scale (1.0f, 1.0f);
1134-
actor.opacity = 255U;
11351126
minimize_completed (actor);
11361127
minimizing.remove (actor);
11371128
});
@@ -1407,6 +1398,7 @@ namespace Gala {
14071398
}
14081399

14091400
if (!Meta.Prefs.get_gnome_animations ()) {
1401+
actor.opacity = 0;
14101402
destroy_completed (actor);
14111403

14121404
if (window.window_type == Meta.WindowType.NORMAL) {

0 commit comments

Comments
 (0)