[libhandy/wip/exalm/animations: 3/3] style-manager: Properly reset animations
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy/wip/exalm/animations: 3/3] style-manager: Properly reset animations
- Date: Sun, 28 Nov 2021 22:32:34 +0000 (UTC)
commit 337bf8cac028dfff5eb7b841522a8f6f582ef439
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Mon Nov 29 02:51:40 2021 +0500
style-manager: Properly reset animations
Turns out we were permanently enabling animations after a light/dark
transition. This shouldn't happen.
See https://gitlab.gnome.org/GNOME/libadwaita/-/merge_requests/385
src/hdy-style-manager.c | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)
---
diff --git a/src/hdy-style-manager.c b/src/hdy-style-manager.c
index 61a43d91..f18d4996 100644
--- a/src/hdy-style-manager.c
+++ b/src/hdy-style-manager.c
@@ -264,9 +264,8 @@ enable_animations_cb (HdyStyleManager *self)
{
GdkScreen *screen = gdk_display_get_default_screen (self->display);
- g_object_set (gtk_settings_get_for_screen (screen),
- "gtk-enable-animations", TRUE,
- NULL);
+ gtk_settings_reset_property (gtk_settings_get_for_screen (screen),
+ "gtk-enable-animations");
self->animation_timeout_id = 0;
@@ -296,6 +295,7 @@ update_stylesheet (HdyStyleManager *self)
{
GdkScreen *screen;
GtkSettings *gtk_settings;
+ gboolean enable_animations;
if (!self->display)
return;
@@ -303,8 +303,6 @@ update_stylesheet (HdyStyleManager *self)
screen = gdk_display_get_default_screen (self->display);
gtk_settings = gtk_settings_get_for_screen (screen);
- g_clear_handle_id (&self->animation_timeout_id, g_source_remove);
-
g_signal_handlers_block_by_func (gtk_settings,
G_CALLBACK (warn_prefer_dark_theme),
self);
@@ -312,8 +310,19 @@ update_stylesheet (HdyStyleManager *self)
G_CALLBACK (update_stylesheet),
self);
+ if (self->animation_timeout_id) {
+ g_clear_handle_id (&self->animation_timeout_id, g_source_remove);
+ enable_animations = TRUE;
+ } else {
+ g_object_get (gtk_settings,
+ "gtk-enable-animations", &enable_animations,
+ NULL);
+ }
+
+ if (enable_animations)
+ g_object_set (gtk_settings, "gtk-enable-animations", FALSE, NULL);
+
g_object_set (gtk_settings,
- "gtk-enable-animations", FALSE,
"gtk-application-prefer-dark-theme", self->dark,
NULL);
@@ -331,10 +340,12 @@ update_stylesheet (HdyStyleManager *self)
G_CALLBACK (warn_prefer_dark_theme),
self);
- self->animation_timeout_id =
- g_timeout_add (SWITCH_DURATION,
- G_SOURCE_FUNC (enable_animations_cb),
- self);
+ if (enable_animations) {
+ self->animation_timeout_id =
+ g_timeout_add (SWITCH_DURATION,
+ G_SOURCE_FUNC (enable_animations_cb),
+ self);
+ }
g_idle_add (G_SOURCE_FUNC (unblock_theme_name_changed_cb), self);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]