[gimp] widgets: Reset view_last_x whevener gradient editor leaves focus



commit 8d0e6efa109f5719b25aeed05471003b79900829
Author: Povilas Kanapickas <povilas radix lt>
Date:   Wed Apr 6 18:47:15 2022 +0300

    widgets: Reset view_last_x whevener gradient editor leaves focus

 app/widgets/gimpgradienteditor.c | 2 ++
 app/widgets/gimpgradienteditor.h | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/app/widgets/gimpgradienteditor.c b/app/widgets/gimpgradienteditor.c
index 1ec8bca5cc..e1691bb930 100644
--- a/app/widgets/gimpgradienteditor.c
+++ b/app/widgets/gimpgradienteditor.c
@@ -1146,6 +1146,7 @@ view_events (GtkWidget          *widget,
     {
     case GDK_LEAVE_NOTIFY:
       gradient_editor_set_hint (editor, NULL, NULL, NULL, NULL);
+      editor->view_last_x = -1;
       break;
 
     case GDK_MOTION_NOTIFY:
@@ -1388,6 +1389,7 @@ control_events (GtkWidget          *widget,
     {
     case GDK_LEAVE_NOTIFY:
       gradient_editor_set_hint (editor, NULL, NULL, NULL, NULL);
+      editor->control_last_x = -1;
       break;
 
     case GDK_BUTTON_PRESS:
diff --git a/app/widgets/gimpgradienteditor.h b/app/widgets/gimpgradienteditor.h
index 31219dfdf3..09dcc50a89 100644
--- a/app/widgets/gimpgradienteditor.h
+++ b/app/widgets/gimpgradienteditor.h
@@ -66,7 +66,7 @@ struct _GimpGradientEditor
   gdouble                 last_zoom_scale;
 
   /*  Gradient view  */
-  gint                    view_last_x;
+  gint                    view_last_x;          /* -1 if mouse has left focus */
   gboolean                view_button_down;
 
   /*  Gradient control  */
@@ -76,7 +76,7 @@ struct _GimpGradientEditor
   GradientEditorDragMode  control_drag_mode;    /* What is being dragged? */
   guint32                 control_click_time;   /* Time when mouse was pressed */
   gboolean                control_compress;     /* Compressing/expanding handles */
-  gint                    control_last_x;       /* Last mouse position when dragging */
+  gint                    control_last_x;       /* Last mouse position, -1 if out of focus */
   gdouble                 control_last_gx;      /* Last position (wrt gradient) when dragging */
   gdouble                 control_orig_pos;     /* Original click position when dragging */
 


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