Skip to content

Commit 65e369f

Browse files
authored
Use org.gnome.desktop.interface enable-animations (#2288)
1 parent 9f63c52 commit 65e369f

18 files changed

+54
-81
lines changed

data/gala.gschema.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
<key type="b" name="enable-animations">
206206
<default>true</default>
207207
<summary>Enable Animations</summary>
208-
<description>Whether animations should be displayed. Note: This is a global key, it changes the behaviour of the window manager, the panel etc.</description>
208+
<description>DEPRECATED: This key is deprecated and ignored.</description>
209209
</key>
210210
</schema>
211211

lib/AnimationsSettings.vala

Lines changed: 0 additions & 32 deletions
This file was deleted.

lib/Utils.vala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,5 +456,12 @@ namespace Gala {
456456
regions.remove (window);
457457
X.Fixes.destroy_region (xdisplay, region);
458458
}
459+
460+
/**
461+
* Utility that returns the given duration or 0 if animations are disabled.
462+
*/
463+
public static uint get_animation_duration (uint duration) {
464+
return Meta.Prefs.get_gnome_animations () ? duration : 0;
465+
}
459466
}
460467
}

lib/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
gala_lib_sources = files(
22
'ActivatableComponent.vala',
3-
'AnimationsSettings.vala',
43
'App.vala',
54
'AppCache.vala',
65
'AppSystem.vala',

plugins/pip/PopupWindow.vala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,15 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
137137
opacity = 0;
138138

139139
save_easing_state ();
140-
set_easing_duration (AnimationsSettings.get_animation_duration (200));
140+
set_easing_duration (Utils.get_animation_duration (200));
141141
opacity = 255;
142142
restore_easing_state ();
143143
}
144144

145145
public override void hide () {
146146
opacity = 255;
147147

148-
var duration = AnimationsSettings.get_animation_duration (200);
148+
var duration = Utils.get_animation_duration (200);
149149
save_easing_state ();
150150
set_easing_duration (duration);
151151
opacity = 0;
@@ -167,7 +167,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
167167
#else
168168
public override bool enter_event (Clutter.CrossingEvent event) {
169169
#endif
170-
var duration = AnimationsSettings.get_animation_duration (300);
170+
var duration = Utils.get_animation_duration (300);
171171

172172
close_button.save_easing_state ();
173173
close_button.set_easing_duration (duration);
@@ -187,7 +187,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
187187
#else
188188
public override bool leave_event (Clutter.CrossingEvent event) {
189189
#endif
190-
var duration = AnimationsSettings.get_animation_duration (300);
190+
var duration = Utils.get_animation_duration (300);
191191

192192
close_button.save_easing_state ();
193193
close_button.set_easing_duration (duration);
@@ -309,7 +309,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
309309
}
310310

311311
private void on_close_click_clicked () {
312-
var duration = AnimationsSettings.get_animation_duration (FADE_OUT_TIMEOUT);
312+
var duration = Utils.get_animation_duration (FADE_OUT_TIMEOUT);
313313

314314
save_easing_state ();
315315
set_easing_duration (duration);
@@ -433,7 +433,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
433433
var screen_limit_start_y = workarea_rect.y + SCREEN_MARGIN;
434434
var screen_limit_end_y = workarea_rect.y + workarea_rect.height - SCREEN_MARGIN - height;
435435

436-
var duration = AnimationsSettings.get_animation_duration (300);
436+
var duration = Utils.get_animation_duration (300);
437437

438438
save_easing_state ();
439439
set_easing_mode (Clutter.AnimationMode.EASE_OUT_BACK);
@@ -446,7 +446,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
446446
private bool place_window_off_screen () {
447447
off_screen = false;
448448

449-
var duration = AnimationsSettings.get_animation_duration (300);
449+
var duration = Utils.get_animation_duration (300);
450450

451451
save_easing_state ();
452452
set_easing_mode (Clutter.AnimationMode.EASE_OUT_BACK);

src/Background/BackgroundManager.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class Gala.BackgroundManager : Meta.BackgroundGroup, Gala.BackgroundManag
6161
return;
6262
}
6363

64-
if (animate && AnimationsSettings.get_enable_animations ()) {
64+
if (animate && Meta.Prefs.get_gnome_animations ()) {
6565
var transition = new Clutter.PropertyTransition ("opacity");
6666
transition.set_from_value (255);
6767
transition.set_to_value (0);

src/Gestures/GestureController.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public class Gala.GestureController : Object {
141141
direction_multiplier = -1;
142142
}
143143

144-
if (snap && !AnimationsSettings.get_enable_animations ()) {
144+
if (snap && !Meta.Prefs.get_gnome_animations ()) {
145145
prepare ();
146146
finish (0, progress + direction_multiplier);
147147
recognizing = false;
@@ -231,7 +231,7 @@ public class Gala.GestureController : Object {
231231
return;
232232
}
233233

234-
if (!AnimationsSettings.get_enable_animations ()) {
234+
if (!Meta.Prefs.get_gnome_animations ()) {
235235
progress = clamped_to;
236236
target.propagate (END, action, calculate_bounded_progress ());
237237
return;

src/Gestures/GesturePropertyTransition.vala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public class Gala.GesturePropertyTransition : Object {
167167

168168
actor.save_easing_state ();
169169
actor.set_easing_mode (EASE_OUT_QUAD);
170-
actor.set_easing_duration (AnimationsSettings.get_animation_duration (calculated_duration));
170+
actor.set_easing_duration (Utils.get_animation_duration (calculated_duration));
171171
actor.set_property (property, value_from_float (target_value));
172172
actor.restore_easing_state ();
173173

@@ -179,14 +179,14 @@ public class Gala.GesturePropertyTransition : Object {
179179
}
180180
};
181181

182-
if (with_gesture && AnimationsSettings.get_enable_animations ()) {
182+
if (with_gesture && Meta.Prefs.get_gnome_animations ()) {
183183
gesture_tracker.connect_handlers (on_animation_begin, on_animation_update, on_animation_end);
184184
} else {
185185
on_animation_begin (0);
186186
if (overshoot_upper_clamp < 1) {
187187
actor.save_easing_state ();
188188
actor.set_easing_mode (EASE_OUT_QUAD);
189-
actor.set_easing_duration (AnimationsSettings.get_animation_duration (gesture_tracker.min_animation_duration));
189+
actor.set_easing_duration (Utils.get_animation_duration (gesture_tracker.min_animation_duration));
190190
actor.set_property (property, value_from_float ((float) overshoot_upper_clamp * (to_value_float - from_value_float) + from_value_float));
191191
actor.restore_easing_state ();
192192

src/NotificationStack.vala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class Gala.NotificationStack : Object {
6262
var window_rect = window.get_frame_rect ();
6363
window.stick ();
6464

65-
if (AnimationsSettings.get_enable_animations ()) {
65+
if (Meta.Prefs.get_gnome_animations ()) {
6666
// Don't flicker at the beginning of the animation
6767
notification.opacity = 0;
6868
notification.rotation_angle_x = 90;
@@ -131,7 +131,7 @@ public class Gala.NotificationStack : Object {
131131
continue;
132132
}
133133

134-
if (AnimationsSettings.get_enable_animations ()) {
134+
if (Meta.Prefs.get_gnome_animations ()) {
135135
actor.save_easing_state ();
136136
actor.set_easing_mode (Clutter.AnimationMode.EASE_OUT_BACK);
137137
actor.set_easing_duration (200);
@@ -140,7 +140,7 @@ public class Gala.NotificationStack : Object {
140140

141141
move_window (actor, -1, (int)y);
142142

143-
if (AnimationsSettings.get_enable_animations ()) {
143+
if (Meta.Prefs.get_gnome_animations ()) {
144144
actor.restore_easing_state ();
145145
}
146146

@@ -161,7 +161,7 @@ public class Gala.NotificationStack : Object {
161161
}
162162

163163
public void destroy_notification (Meta.WindowActor notification) {
164-
if (AnimationsSettings.get_enable_animations ()) {
164+
if (Meta.Prefs.get_gnome_animations ()) {
165165
notification.save_easing_state ();
166166
notification.set_easing_duration (100);
167167
notification.set_easing_mode (Clutter.AnimationMode.EASE_IN_QUAD);

src/Widgets/IconGroup.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public class Gala.IconGroup : CanvasActor {
168168
if (animate) {
169169
icon.save_easing_state ();
170170
icon.set_easing_mode (Clutter.AnimationMode.LINEAR);
171-
icon.set_easing_duration (AnimationsSettings.get_animation_duration (200));
171+
icon.set_easing_duration (Utils.get_animation_duration (200));
172172
icon.opacity = 0;
173173
icon.restore_easing_state ();
174174

0 commit comments

Comments
 (0)