Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use org.gnome.desktop.interface enable-animations #2288

Merged
merged 4 commits into from
Mar 8, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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 data/gala.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
<key type="b" name="enable-animations">
<default>true</default>
<summary>Enable Animations</summary>
<description>Whether animations should be displayed. Note: This is a global key, it changes the behaviour of the window manager, the panel etc.</description>
<description>DEPRECATED: This key is deprecated and ignored.</description>
</key>
</schema>

Expand Down
32 changes: 0 additions & 32 deletions lib/AnimationsSettings.vala

This file was deleted.

7 changes: 7 additions & 0 deletions lib/Utils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -451,5 +451,12 @@ namespace Gala {
regions.remove (window);
X.Fixes.destroy_region (xdisplay, region);
}

/**
* Utility that returns the given duration or 0 if animations are disabled.
*/
public static uint get_animation_duration (uint duration) {
return Meta.Prefs.get_gnome_animations () ? duration : 0;
}
}
}
1 change: 0 additions & 1 deletion lib/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
gala_lib_sources = files(
'ActivatableComponent.vala',
'AnimationsSettings.vala',
'App.vala',
'AppCache.vala',
'AppSystem.vala',
Expand Down
14 changes: 7 additions & 7 deletions plugins/pip/PopupWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
opacity = 0;

save_easing_state ();
set_easing_duration (AnimationsSettings.get_animation_duration (200));
set_easing_duration (Utils.get_animation_duration (200));
opacity = 255;
restore_easing_state ();
}

public override void hide () {
opacity = 255;

var duration = AnimationsSettings.get_animation_duration (200);
var duration = Utils.get_animation_duration (200);
save_easing_state ();
set_easing_duration (duration);
opacity = 0;
Expand All @@ -167,7 +167,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
#else
public override bool enter_event (Clutter.CrossingEvent event) {
#endif
var duration = AnimationsSettings.get_animation_duration (300);
var duration = Utils.get_animation_duration (300);

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

close_button.save_easing_state ();
close_button.set_easing_duration (duration);
Expand Down Expand Up @@ -309,7 +309,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
}

private void on_close_click_clicked () {
var duration = AnimationsSettings.get_animation_duration (FADE_OUT_TIMEOUT);
var duration = Utils.get_animation_duration (FADE_OUT_TIMEOUT);

save_easing_state ();
set_easing_duration (duration);
Expand Down Expand Up @@ -433,7 +433,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
var screen_limit_start_y = workarea_rect.y + SCREEN_MARGIN;
var screen_limit_end_y = workarea_rect.y + workarea_rect.height - SCREEN_MARGIN - height;

var duration = AnimationsSettings.get_animation_duration (300);
var duration = Utils.get_animation_duration (300);

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

var duration = AnimationsSettings.get_animation_duration (300);
var duration = Utils.get_animation_duration (300);

save_easing_state ();
set_easing_mode (Clutter.AnimationMode.EASE_OUT_BACK);
Expand Down
2 changes: 1 addition & 1 deletion src/Background/BackgroundManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class Gala.BackgroundManager : Meta.BackgroundGroup, Gala.BackgroundManag
return;
}

if (animate && AnimationsSettings.get_enable_animations ()) {
if (animate && Meta.Prefs.get_gnome_animations ()) {
var transition = new Clutter.PropertyTransition ("opacity");
transition.set_from_value (255);
transition.set_to_value (0);
Expand Down
4 changes: 2 additions & 2 deletions src/Gestures/GestureController.vala
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public class Gala.GestureController : Object {
direction_multiplier = -1;
}

if (snap && !AnimationsSettings.get_enable_animations ()) {
if (snap && !Meta.Prefs.get_gnome_animations ()) {
prepare ();
finish (0, progress + direction_multiplier);
recognizing = false;
Expand Down Expand Up @@ -231,7 +231,7 @@ public class Gala.GestureController : Object {
return;
}

if (!AnimationsSettings.get_enable_animations ()) {
if (!Meta.Prefs.get_gnome_animations ()) {
progress = clamped_to;
target.propagate (END, action, calculate_bounded_progress ());
return;
Expand Down
6 changes: 3 additions & 3 deletions src/Gestures/GesturePropertyTransition.vala
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public class Gala.GesturePropertyTransition : Object {

actor.save_easing_state ();
actor.set_easing_mode (EASE_OUT_QUAD);
actor.set_easing_duration (AnimationsSettings.get_animation_duration (calculated_duration));
actor.set_easing_duration (Utils.get_animation_duration (calculated_duration));
actor.set_property (property, value_from_float (target_value));
actor.restore_easing_state ();

Expand All @@ -179,14 +179,14 @@ public class Gala.GesturePropertyTransition : Object {
}
};

if (with_gesture && AnimationsSettings.get_enable_animations ()) {
if (with_gesture && Meta.Prefs.get_gnome_animations ()) {
gesture_tracker.connect_handlers (on_animation_begin, on_animation_update, on_animation_end);
} else {
on_animation_begin (0);
if (overshoot_upper_clamp < 1) {
actor.save_easing_state ();
actor.set_easing_mode (EASE_OUT_QUAD);
actor.set_easing_duration (AnimationsSettings.get_animation_duration (gesture_tracker.min_animation_duration));
actor.set_easing_duration (Utils.get_animation_duration (gesture_tracker.min_animation_duration));
actor.set_property (property, value_from_float ((float) overshoot_upper_clamp * (to_value_float - from_value_float) + from_value_float));
actor.restore_easing_state ();

Expand Down
8 changes: 4 additions & 4 deletions src/NotificationStack.vala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class Gala.NotificationStack : Object {
var window_rect = window.get_frame_rect ();
window.stick ();

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

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

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

if (AnimationsSettings.get_enable_animations ()) {
if (Meta.Prefs.get_gnome_animations ()) {
actor.restore_easing_state ();
}

Expand All @@ -161,7 +161,7 @@ public class Gala.NotificationStack : Object {
}

public void destroy_notification (Meta.WindowActor notification) {
if (AnimationsSettings.get_enable_animations ()) {
if (Meta.Prefs.get_gnome_animations ()) {
notification.save_easing_state ();
notification.set_easing_duration (100);
notification.set_easing_mode (Clutter.AnimationMode.EASE_IN_QUAD);
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/IconGroup.vala
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public class Gala.IconGroup : CanvasActor {
if (animate) {
icon.save_easing_state ();
icon.set_easing_mode (Clutter.AnimationMode.LINEAR);
icon.set_easing_duration (AnimationsSettings.get_animation_duration (200));
icon.set_easing_duration (Utils.get_animation_duration (200));
icon.opacity = 0;
icon.restore_easing_state ();

Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/MultitaskingView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ namespace Gala {
}

public void play_nudge_animation (Meta.MotionDirection direction) {
if (!AnimationsSettings.get_enable_animations ()) {
if (!Meta.Prefs.get_gnome_animations ()) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/ScreenShield.vala
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public class Gala.ScreenShield : Clutter.Actor {
grab_key_focus ();
modal_proxy = wm.push_modal (this);

if (AnimationsSettings.get_enable_animations () && animate) {
if (Meta.Prefs.get_gnome_animations () && animate) {
animate_and_lock (animation_time);
} else {
_set_active (true);
Expand Down
12 changes: 6 additions & 6 deletions src/Widgets/WindowClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class Gala.WindowClone : ActorTarget {
public bool active {
set {
active_shape.save_easing_state ();
active_shape.set_easing_duration (AnimationsSettings.get_animation_duration (FADE_ANIMATION_DURATION));
active_shape.set_easing_duration (Utils.get_animation_duration (FADE_ANIMATION_DURATION));
active_shape.opacity = value ? 255 : 0;
active_shape.restore_easing_state ();
}
Expand Down Expand Up @@ -247,7 +247,7 @@ public class Gala.WindowClone : ActorTarget {

if (animate) {
save_easing_state ();
set_easing_duration (AnimationsSettings.get_animation_duration (MultitaskingView.ANIMATION_DURATION));
set_easing_duration (Utils.get_animation_duration (MultitaskingView.ANIMATION_DURATION));
set_easing_mode (EASE_OUT_QUAD);
}

Expand Down Expand Up @@ -374,7 +374,7 @@ public class Gala.WindowClone : ActorTarget {
in_slot_animation = animating;
}

var duration = AnimationsSettings.get_animation_duration (FADE_ANIMATION_DURATION);
var duration = Utils.get_animation_duration (FADE_ANIMATION_DURATION);

var show = has_pointer && !in_slot_animation;

Expand Down Expand Up @@ -472,7 +472,7 @@ public class Gala.WindowClone : ActorTarget {
active_shape.hide ();

var scale = window_icon.width / clone.width;
var duration = AnimationsSettings.get_animation_duration (FADE_ANIMATION_DURATION);
var duration = Utils.get_animation_duration (FADE_ANIMATION_DURATION);

clone.get_transformed_position (out abs_x, out abs_y);
clone.save_easing_state ();
Expand Down Expand Up @@ -534,7 +534,7 @@ public class Gala.WindowClone : ActorTarget {
var scale = hovered ? 0.4 : 1.0;
var opacity = hovered ? 0 : 255;
uint duration = hovered && insert_thumb != null ? insert_thumb.delay : 100;
duration = AnimationsSettings.get_animation_duration (duration);
duration = Utils.get_animation_duration (duration);

window_icon.save_easing_state ();

Expand Down Expand Up @@ -636,7 +636,7 @@ public class Gala.WindowClone : ActorTarget {
private void drag_canceled () {
get_parent ().remove_child (this);

var duration = AnimationsSettings.get_animation_duration (MultitaskingView.ANIMATION_DURATION);
var duration = Utils.get_animation_duration (MultitaskingView.ANIMATION_DURATION);

// Adding to the previous parent will automatically update it to take it's slot
// so to animate it we set the easing
Expand Down
4 changes: 2 additions & 2 deletions src/Widgets/WindowIconActor.vala
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class Gala.WindowIconActor : Clutter.Actor {
set {
if (_temporary && !value) {
remove_transition ("pulse");
} else if (!_temporary && value && AnimationsSettings.get_enable_animations ()) {
} else if (!_temporary && value && Meta.Prefs.get_gnome_animations ()) {
var transition = new Clutter.TransitionGroup () {
duration = 800,
auto_reverse = true,
Expand Down Expand Up @@ -134,7 +134,7 @@ public class Gala.WindowIconActor : Clutter.Actor {

new_icon.save_easing_state ();
new_icon.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
new_icon.set_easing_duration (AnimationsSettings.get_animation_duration (500));
new_icon.set_easing_duration (Utils.get_animation_duration (500));
new_icon.restore_easing_state ();

if (icon == null) {
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/WindowSwitcher/WindowSwitcher.vala
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ public class Gala.WindowSwitcher : CanvasActor {
}

save_easing_state ();
set_easing_duration (AnimationsSettings.get_animation_duration (ANIMATION_DURATION));
set_easing_duration (Utils.get_animation_duration (ANIMATION_DURATION));
opacity = show ? 255 : 0;
restore_easing_state ();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Widgets/WorkspaceInsertThumb.vala
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class Gala.WorkspaceInsertThumb : Clutter.Actor {
private new void transform (bool expand) {
save_easing_state ();
set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
set_easing_duration (AnimationsSettings.get_animation_duration (200));
set_easing_duration (Utils.get_animation_duration (200));

if (!expand) {
remove_transition ("pulse");
Expand All @@ -96,7 +96,7 @@ public class Gala.WorkspaceInsertThumb : Clutter.Actor {
}

private void add_pulse_animation () {
if (!AnimationsSettings.get_enable_animations ()) {
if (!Meta.Prefs.get_gnome_animations ()) {
return;
}

Expand Down
Loading