Commit 6958ab9d authored by Manuel Genovés's avatar Manuel Genovés
Browse files

Port libadwaita to timed-animation

parent 36fc52d9
......@@ -8,8 +8,8 @@
#include "adw-carousel-indicator-dots.h"
#include "adw-timed-animation.h"
#include "adw-animation-util-private.h"
#include "adw-animation-private.h"
#include "adw-swipeable.h"
#include <math.h>
......@@ -80,15 +80,15 @@ done_cb (AdwCarouselIndicatorDots *self)
static void
animate (AdwCarouselIndicatorDots *self,
gint64 duration)
guint duration)
{
if (self->animation)
adw_animation_stop (self->animation);
self->animation =
adw_animation_new (GTK_WIDGET (self), 0, 1, duration,
(AdwAnimationTargetFunc) value_cb,
self);
adw_timed_animation_new (GTK_WIDGET (self), 0, 1, duration,
(AdwAnimationTargetFunc) value_cb,
self);
g_signal_connect_swapped (self->animation, "done", G_CALLBACK (done_cb), self);
......
......@@ -8,7 +8,7 @@
#include "adw-carousel-indicator-lines.h"
#include "adw-animation-private.h"
#include "adw-timed-animation.h"
#include "adw-swipeable.h"
#include <math.h>
......@@ -78,15 +78,15 @@ done_cb (AdwCarouselIndicatorLines *self)
static void
animate (AdwCarouselIndicatorLines *self,
gint64 duration)
guint duration)
{
if (self->animation)
adw_animation_stop (self->animation);
self->animation =
adw_animation_new (GTK_WIDGET (self), 0, 1, duration,
(AdwAnimationTargetFunc) value_cb,
self);
adw_timed_animation_new (GTK_WIDGET (self), 0, 1, duration,
(AdwAnimationTargetFunc) value_cb,
self);
g_signal_connect_swapped (self->animation, "done", G_CALLBACK (done_cb), self);
......
......@@ -9,7 +9,6 @@
#include "adw-carousel.h"
#include "adw-animation-util-private.h"
#include "adw-animation-private.h"
#include "adw-timed-animation.h"
#include "adw-navigation-direction.h"
#include "adw-swipe-tracker.h"
......@@ -315,7 +314,7 @@ static void
animate_child_resize (AdwCarousel *self,
ChildInfo *child,
double value,
gint64 duration)
guint duration)
{
double old_size = child->size;
......@@ -325,9 +324,9 @@ animate_child_resize (AdwCarousel *self,
adw_animation_stop (child->resize_animation);
child->resize_animation =
adw_animation_new (GTK_WIDGET (self), old_size, value, duration,
(AdwAnimationTargetFunc) resize_animation_value_cb,
child);
adw_timed_animation_new (GTK_WIDGET (self), old_size, value, duration,
(AdwAnimationTargetFunc) resize_animation_value_cb,
child);
g_signal_connect_swapped (child->resize_animation, "done", G_CALLBACK (resize_animation_done_cb), child);
......@@ -349,7 +348,6 @@ scroll_animation_value_cb (double value,
double position = adw_lerp (self->animation_source_position,
self->animation_target_child->snap_point,
value);
set_position (self, position);
gtk_widget_queue_allocate (GTK_WIDGET (self));
......@@ -374,7 +372,7 @@ scroll_animation_done_cb (AdwCarousel *self)
static void
scroll_to (AdwCarousel *self,
GtkWidget *widget,
gint64 duration)
guint duration)
{
if (self->animation)
adw_animation_stop (self->animation);
......@@ -384,8 +382,8 @@ scroll_to (AdwCarousel *self,
self->animation =
adw_timed_animation_new (GTK_WIDGET (self), 0, 1, duration,
(AdwAnimationTargetFunc) scroll_animation_value_cb,
self);
(AdwAnimationTargetFunc) scroll_animation_value_cb,
self);
g_signal_connect_swapped (self->animation, "done", G_CALLBACK (scroll_animation_done_cb), self);
......@@ -1378,11 +1376,10 @@ adw_carousel_scroll_to (AdwCarousel *self,
void
adw_carousel_scroll_to_full (AdwCarousel *self,
GtkWidget *widget,
gint64 duration)
guint duration)
{
g_return_if_fail (ADW_IS_CAROUSEL (self));
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (duration >= 0);
scroll_to (self, widget, duration);
}
......
......@@ -50,7 +50,7 @@ void adw_carousel_scroll_to (AdwCarousel *self,
ADW_AVAILABLE_IN_ALL
void adw_carousel_scroll_to_full (AdwCarousel *self,
GtkWidget *widget,
gint64 duration);
guint duration);
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_carousel_get_nth_page (AdwCarousel *self,
......
......@@ -10,8 +10,8 @@
#include <math.h>
#include "adw-timed-animation.h"
#include "adw-animation-util-private.h"
#include "adw-animation-private.h"
#include "adw-gizmo-private.h"
#include "adw-shadow-helper-private.h"
#include "adw-swipeable.h"
......@@ -296,13 +296,13 @@ animate_fold (AdwFlap *self)
adw_animation_stop (self->fold_animation);
self->fold_animation =
adw_animation_new (GTK_WIDGET (self),
self->fold_progress,
self->folded ? 1 : 0,
/* When the flap is completely hidden, we can skip animation */
(self->reveal_progress > 0) ? self->fold_duration : 0,
(AdwAnimationTargetFunc) fold_animation_value_cb,
self);
adw_timed_animation_new (GTK_WIDGET (self),
self->fold_progress,
self->folded ? 1 : 0,
/* When the flap is completely hidden, we can skip animation */
(self->reveal_progress > 0) ? self->fold_duration : 0,
(AdwAnimationTargetFunc) fold_animation_value_cb,
self);
g_signal_connect_swapped (self->fold_animation, "done", G_CALLBACK (fold_animation_done_cb), self);
......@@ -333,17 +333,17 @@ reveal_animation_done_cb (AdwFlap *self)
static void
animate_reveal (AdwFlap *self,
double to,
gint64 duration)
guint duration)
{
if (self->reveal_animation)
adw_animation_stop (self->reveal_animation);
self->reveal_animation =
adw_animation_new (GTK_WIDGET (self),
self->reveal_progress,
to, duration,
(AdwAnimationTargetFunc) reveal_animation_value_cb,
self);
adw_timed_animation_new (GTK_WIDGET (self),
self->reveal_progress,
to, duration,
(AdwAnimationTargetFunc) reveal_animation_value_cb,
self);
g_signal_connect_swapped (self->reveal_animation, "done", G_CALLBACK (reveal_animation_done_cb), self);
......@@ -353,7 +353,7 @@ animate_reveal (AdwFlap *self,
static void
set_reveal_flap (AdwFlap *self,
gboolean reveal_flap,
guint64 duration)
guint duration)
{
reveal_flap = !!reveal_flap;
......@@ -436,7 +436,7 @@ update_swipe_cb (AdwSwipeTracker *tracker,
static void
end_swipe_cb (AdwSwipeTracker *tracker,
gint64 duration,
guint duration,
double to,
AdwFlap *self)
{
......
......@@ -8,8 +8,8 @@
#include "config.h"
#include "gtkprogresstrackerprivate.h"
#include "adw-timed-animation.h"
#include "adw-animation-util-private.h"
#include "adw-animation-private.h"
#include "adw-enums-private.h"
#include "adw-fold-threshold-policy.h"
#include "adw-leaflet.h"
......@@ -1646,7 +1646,7 @@ update_swipe_cb (AdwSwipeTracker *tracker,
static void
end_swipe_cb (AdwSwipeTracker *tracker,
gint64 duration,
guint duration,
double to,
AdwLeaflet *self)
{
......
......@@ -392,7 +392,7 @@ gesture_end (AdwSwipeTracker *self,
gboolean is_touchpad)
{
double end_progress, velocity;
gint64 duration, max_duration;
guint duration, max_duration;
if (self->state == ADW_SWIPE_TRACKER_STATE_NONE)
return;
......
......@@ -9,8 +9,8 @@
#include "config.h"
#include "adw-tab-box-private.h"
#include "adw-timed-animation.h"
#include "adw-animation-util-private.h"
#include "adw-animation-private.h"
#include "adw-tab-private.h"
#include "adw-tab-bar-private.h"
#include "adw-tab-view-private.h"
......@@ -140,7 +140,7 @@ struct _AdwTabBox
struct {
TabInfo *info;
int pos;
gint64 duration;
guint duration;
gboolean keep_selected_visible;
} scheduled_scroll;
......@@ -464,10 +464,10 @@ set_tab_resize_mode (AdwTabBox *self,
self->initial_end_padding = self->end_padding;
self->resize_animation =
adw_animation_new (GTK_WIDGET (self), 0, 1,
RESIZE_ANIMATION_DURATION,
resize_animation_value_cb,
self);
adw_timed_animation_new (GTK_WIDGET (self), 0, 1,
RESIZE_ANIMATION_DURATION,
resize_animation_value_cb,
self);
g_signal_connect_swapped (self->resize_animation, "done", G_CALLBACK (resize_animation_done_cb), self);
......@@ -788,7 +788,7 @@ static void
animate_scroll (AdwTabBox *self,
TabInfo *info,
double offset,
gint64 duration)
guint duration)
{
if (!self->adjustment)
return;
......@@ -810,9 +810,9 @@ animate_scroll (AdwTabBox *self,
*/
self->scroll_animation =
adw_animation_new (GTK_WIDGET (self), 0, 1, duration,
scroll_animation_value_cb,
self);
adw_timed_animation_new (GTK_WIDGET (self), 0, 1, duration,
scroll_animation_value_cb,
self);
g_signal_connect_swapped (self->scroll_animation, "done", G_CALLBACK (scroll_animation_done_cb), self);
......@@ -822,7 +822,7 @@ animate_scroll (AdwTabBox *self,
static void
animate_scroll_relative (AdwTabBox *self,
double delta,
gint64 duration)
guint duration)
{
double current_value = gtk_adjustment_get_value (self->adjustment);
......@@ -840,7 +840,7 @@ static void
scroll_to_tab_full (AdwTabBox *self,
TabInfo *info,
int pos,
gint64 duration,
guint duration,
gboolean keep_selected_visible)
{
int tab_width;
......@@ -882,7 +882,7 @@ scroll_to_tab_full (AdwTabBox *self,
static void
scroll_to_tab (AdwTabBox *self,
TabInfo *info,
gint64 duration)
guint duration)
{
scroll_to_tab_full (self, info, -1, duration, FALSE);
}
......@@ -1042,10 +1042,10 @@ animate_reordering (AdwTabBox *self,
adw_animation_stop (self->reorder_animation);
self->reorder_animation =
adw_animation_new (GTK_WIDGET (self), 0, 1,
REORDER_ANIMATION_DURATION,
reorder_animation_value_cb,
dest_tab);
adw_timed_animation_new (GTK_WIDGET (self), 0, 1,
REORDER_ANIMATION_DURATION,
reorder_animation_value_cb,
dest_tab);
g_signal_connect_swapped (self->reorder_animation, "done", G_CALLBACK (reorder_animation_done_cb), dest_tab);
......@@ -1094,10 +1094,10 @@ animate_reorder_offset (AdwTabBox *self,
adw_animation_stop (info->reorder_animation);
info->reorder_animation =
adw_animation_new (GTK_WIDGET (self), info->reorder_offset, offset,
REORDER_ANIMATION_DURATION,
reorder_offset_animation_value_cb,
info);
adw_timed_animation_new (GTK_WIDGET (self), info->reorder_offset, offset,
REORDER_ANIMATION_DURATION,
reorder_offset_animation_value_cb,
info);
g_signal_connect_swapped (info->reorder_animation, "done", G_CALLBACK (reorder_offset_animation_done_cb), info);
......@@ -1675,10 +1675,10 @@ page_attached_cb (AdwTabBox *self,
G_CONNECT_SWAPPED);
info->appear_animation =
adw_animation_new (GTK_WIDGET (self), 0, 1,
OPEN_ANIMATION_DURATION,
appear_animation_value_cb,
info);
adw_timed_animation_new (GTK_WIDGET (self), 0, 1,
OPEN_ANIMATION_DURATION,
appear_animation_value_cb,
info);
g_signal_connect_swapped (info->appear_animation, "done", G_CALLBACK (open_animation_done_cb), info);
......@@ -1782,10 +1782,10 @@ page_detached_cb (AdwTabBox *self,
adw_animation_stop (info->appear_animation);
info->appear_animation =
adw_animation_new (GTK_WIDGET (self), info->appear_progress, 0,
CLOSE_ANIMATION_DURATION,
appear_animation_value_cb,
info);
adw_timed_animation_new (GTK_WIDGET (self), info->appear_progress, 0,
CLOSE_ANIMATION_DURATION,
appear_animation_value_cb,
info);
g_signal_connect_swapped (info->appear_animation, "done", G_CALLBACK (close_animation_done_cb), info);
......@@ -1975,10 +1975,10 @@ insert_placeholder (AdwTabBox *self,
}
info->appear_animation =
adw_animation_new (GTK_WIDGET (self), initial_progress, 1,
OPEN_ANIMATION_DURATION,
insert_animation_value_cb,
info);
adw_timed_animation_new (GTK_WIDGET (self), initial_progress, 1,
OPEN_ANIMATION_DURATION,
insert_animation_value_cb,
info);
g_signal_connect_swapped (info->appear_animation, "done", G_CALLBACK (open_animation_done_cb), info);
......@@ -2024,10 +2024,10 @@ replace_placeholder (AdwTabBox *self,
adw_animation_stop (info->appear_animation);
info->appear_animation =
adw_animation_new (GTK_WIDGET (self), initial_progress, 1,
OPEN_ANIMATION_DURATION,
appear_animation_value_cb,
info);
adw_timed_animation_new (GTK_WIDGET (self), initial_progress, 1,
OPEN_ANIMATION_DURATION,
appear_animation_value_cb,
info);
g_signal_connect_swapped (info->appear_animation, "done", G_CALLBACK (replace_animation_done_cb), info);
......@@ -2097,10 +2097,10 @@ remove_placeholder (AdwTabBox *self)
g_idle_add ((GSourceFunc) remove_placeholder_scroll_cb, self);
info->appear_animation =
adw_animation_new (GTK_WIDGET (self), info->appear_progress, 0,
CLOSE_ANIMATION_DURATION,
appear_animation_value_cb,
info);
adw_timed_animation_new (GTK_WIDGET (self), info->appear_progress, 0,
CLOSE_ANIMATION_DURATION,
appear_animation_value_cb,
info);
g_signal_connect_swapped (info->appear_animation, "done", G_CALLBACK (remove_animation_done_cb), info);
......@@ -2320,10 +2320,10 @@ resize_drag_icon (AdwTabBox *self,
icon->target_width = width;
icon->resize_animation =
adw_animation_new (GTK_WIDGET (icon->tab), icon->width, width,
ICON_RESIZE_ANIMATION_DURATION,
icon_resize_animation_value_cb,
icon);
adw_timed_animation_new (GTK_WIDGET (icon->tab), icon->width, width,
ICON_RESIZE_ANIMATION_DURATION,
icon_resize_animation_value_cb,
icon);
g_signal_connect_swapped (icon->resize_animation, "done", G_CALLBACK (icon_resize_animation_done_cb), icon);
......
......@@ -10,7 +10,7 @@
#include "adw-tab-private.h"
#include "adw-animation-util-private.h"
#include "adw-animation-private.h"
#include "adw-timed-animation.h"
#include "adw-bidi-private.h"
#include "adw-fading-label-private.h"
......@@ -131,15 +131,15 @@ update_state (AdwTab *self)
self->show_close = show_close;
self->close_btn_animation =
adw_animation_new (GTK_WIDGET (self),
opacity,
self->show_close ? 1 : 0,
CLOSE_BTN_ANIMATION_DURATION,
(AdwAnimationTargetFunc) close_btn_animation_value_cb,
self);
adw_animation_set_interpolator (self->close_btn_animation,
ADW_ANIMATION_INTERPOLATOR_EASE_IN_OUT);
adw_timed_animation_new (GTK_WIDGET (self),
opacity,
self->show_close ? 1 : 0,
CLOSE_BTN_ANIMATION_DURATION,
(AdwAnimationTargetFunc) close_btn_animation_value_cb,
self);
adw_timed_animation_set_interpolator (ADW_TIMED_ANIMATION (self->close_btn_animation),
ADW_TIMED_ANIMATION_INTERPOLATOR_EASE_IN_OUT);
g_signal_connect_swapped (self->close_btn_animation, "done", G_CALLBACK (close_btn_animation_done_cb), self);
......
......@@ -15,7 +15,7 @@
#include "adw-view-stack.h"
#include "gtkprogresstrackerprivate.h"
#include "adw-animation-private.h"
#include "adw-animation-util-private.h"
#include "adw-enums.h"
#include "adw-focus-private.h"
#include "adw-gizmo-private.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment