[libdazzle] stack-list: use animation duration calculation



commit a86b75910f1803991684469c82e9b8dbf116d86f
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jun 8 00:16:06 2017 -0700

    stack-list: use animation duration calculation
    
    This uses the mm of the monitor to determine the optimal animation
    duration. We have a hatch of 500msec match to avoid getting too
    annoying.
    
    We might want to have "classifications" for duration such as
    DURATION_FAST, DURATION_NORMAL, DURATION_SLOW, etc

 src/widgets/dzl-stack-list.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/widgets/dzl-stack-list.c b/src/widgets/dzl-stack-list.c
index 480aa06..4e6df9c 100644
--- a/src/widgets/dzl-stack-list.c
+++ b/src/widgets/dzl-stack-list.c
@@ -309,9 +309,17 @@ dzl_stack_list_begin_anim (DzlStackList       *self,
 
   if (pos != 0)
     {
+      GdkMonitor *monitor;
+      GdkDisplay *display;
+      GdkWindow *window;
       guint distance = ABS (end_area->y - begin_area->y);
 
-      duration = CLAMP (distance, 100, MAX (SLIDE_DURATION, distance / 5));
+      display = gtk_widget_get_display (GTK_WIDGET (self));
+      window = gtk_widget_get_window (GTK_WIDGET (self));
+      monitor = gdk_display_get_monitor_at_window (display, window);
+
+      duration = dzl_animation_calculate_duration (monitor, 0, distance);
+      duration = CLAMP (duration, 0, 500);
     }
 
   priv->animation = dzl_object_animate_full (priv->animating_rect,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]