[gimp] widgets: Fix support for smooth scrolling in gradient editor



commit 62490218ee9c265730e8aa95494c7a7fd2ef4bc1
Author: Povilas Kanapickas <povilas radix lt>
Date:   Wed Apr 6 18:47:14 2022 +0300

    widgets: Fix support for smooth scrolling in gradient editor
    
    Smooth scrolling requires that we keep the scroll (or zoom, as is in
    this case) state as a floating-point number. The scroll deltas are often
    less than one, thus storing scroll state as an integer will effectively
    ignore most of the scroll events.

 app/widgets/gimpgradienteditor.c | 2 +-
 app/widgets/gimpgradienteditor.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/app/widgets/gimpgradienteditor.c b/app/widgets/gimpgradienteditor.c
index d4eaeeaecb..9c3e8c634d 100644
--- a/app/widgets/gimpgradienteditor.c
+++ b/app/widgets/gimpgradienteditor.c
@@ -879,7 +879,7 @@ gradient_editor_scrollbar_update (GtkAdjustment      *adjustment,
   gchar                    *str1;
   gchar                    *str2;
 
-  str1 = g_strdup_printf (_("Zoom factor: %d:1"),
+  str1 = g_strdup_printf (_("Zoom factor: %f:1"),
                           editor->zoom_factor);
 
   str2 = g_strdup_printf (_("Displaying [%0.4f, %0.4f]"),
diff --git a/app/widgets/gimpgradienteditor.h b/app/widgets/gimpgradienteditor.h
index 8ecc5b2e1a..e3f939d36b 100644
--- a/app/widgets/gimpgradienteditor.h
+++ b/app/widgets/gimpgradienteditor.h
@@ -60,7 +60,7 @@ struct _GimpGradientEditor
   GtkWidget              *control;
 
   /*  Zoom and scrollbar  */
-  guint                   zoom_factor;
+  gdouble                 zoom_factor;
   GtkAdjustment          *scroll_data;
 
   /*  Gradient view  */


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