[gtk+] paned: Grab during the drag



commit e7ed7c1913f9eb9c9dd214f501acad54e80ea36b
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Dec 8 21:09:24 2017 -0500

    paned: Grab during the drag
    
    This is necessary to ensure we get the right cursor.

 gtk/gtkpaned.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 04d8829..1340f84 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -801,6 +801,9 @@ gesture_drag_begin_cb (GtkGestureDrag *gesture,
       else
         priv->drag_pos = start_y - priv->handle_pos.y;
 
+      paned->priv->panning = TRUE;
+      gtk_grab_add (GTK_WIDGET (paned));
+
       gtk_gesture_set_state (GTK_GESTURE (gesture),
                              GTK_EVENT_SEQUENCE_CLAIMED);
     }
@@ -819,8 +822,6 @@ gesture_drag_update_cb (GtkGestureDrag   *gesture,
 {
   gdouble start_x, start_y;
 
-  paned->priv->panning = TRUE;
-
   gtk_gesture_drag_get_start_point (GTK_GESTURE_DRAG (gesture),
                                &start_x, &start_y);
   update_drag (paned, start_x + offset_x, start_y + offset_y);
@@ -836,6 +837,7 @@ gesture_drag_end_cb (GtkGestureDrag *gesture,
   if (!paned->priv->panning)
     gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED);
 
+  gtk_grab_remove (GTK_WIDGET (paned));
   paned->priv->panning = FALSE;
 }
 


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