Skip to content

Commit 4c10ad5

Browse files
committed
refactor: further simplify main UI element animations.
Signed-off-by: ldelossa <louis.delos@gmail.com>
1 parent ff824ab commit 4c10ad5

File tree

2 files changed

+6
-22
lines changed

2 files changed

+6
-22
lines changed

src/panel/message_tray/message_tray.c

+3-11
Original file line numberDiff line numberDiff line change
@@ -102,23 +102,15 @@ static void animation_close_done(AdwAnimation *animation, MessageTray *self) {
102102
};
103103

104104
void message_tray_set_hidden(MessageTray *self) {
105-
int anim_state = 0;
106-
107105
g_debug("message_tray.c:message_tray_set_hidden() called.");
108106

109-
// this is required, since external callers will call this method as expect
110-
// a no-op of there is no attached self->monitor.
107+
// this is required, since external callers will call this method and expect
108+
// a no-op if there is no attached self->monitor.
111109
if (!self || !self->win) {
112110
return;
113111
}
114112

115-
// this ensures there are no in-flight animation done callbacks on the
116-
// event-loop before starting a new animation, and avoids timing bugs.
117-
anim_state = adw_animation_get_state(self->animation);
118-
if (anim_state != ADW_ANIMATION_IDLE &&
119-
anim_state != ADW_ANIMATION_FINISHED) {
120-
adw_animation_reset(self->animation);
121-
}
113+
adw_animation_reset(self->animation);
122114

123115
// reverse animation
124116
adw_timed_animation_set_reverse(ADW_TIMED_ANIMATION(self->animation), TRUE);

src/panel/quick_settings/quick_settings.c

+3-11
Original file line numberDiff line numberDiff line change
@@ -97,24 +97,16 @@ static void animation_close_done(AdwAnimation *animation, QuickSettings *self) {
9797
};
9898

9999
void quick_settings_set_hidden(QuickSettings *self) {
100-
int anim_state = 0;
101-
102100
g_debug("quick_settings.c:quick_settings_set_hidden() called.");
103101

104-
// this is required, since external callers will call this method as expect
105-
// a no-op of there is no attached self->panel.
102+
// this is required, since external callers will call this method and expect
103+
// a no-op if there is no attached self->panel.
106104
if (!self || !self->win) {
107105
g_debug("quick_settings.c:quick_settings_set_hidden() no-op.");
108106
return;
109107
}
110108

111-
// this ensures there are no in-flight animation done callbacks on the
112-
// event-loop before starting a new animation, and avoids timing bugs.
113-
anim_state = adw_animation_get_state(self->animation);
114-
if (anim_state != ADW_ANIMATION_IDLE &&
115-
anim_state != ADW_ANIMATION_FINISHED) {
116-
adw_animation_reset(self->animation);
117-
}
109+
adw_animation_reset(self->animation);
118110

119111
// reverse animation
120112
adw_timed_animation_set_reverse(ADW_TIMED_ANIMATION(self->animation), TRUE);

0 commit comments

Comments
 (0)