[gtk+/wip/overlay-scrollbar: 1/5] GtkRange: Add a style class during dragging



commit f45b28d0a60d1959f28e6d5d7255b37d43de3b40
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Oct 5 17:29:32 2014 -0400

    GtkRange: Add a style class during dragging
    
    This will be used to identify a scrollbar is being dragged - we
    don't actually need the style class; another way to keep track
    of the dragging status would be ok too.

 gtk/gtkrange.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 496f9c1..62801c5 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -2257,6 +2257,9 @@ range_grab_add (GtkRange      *range,
                 MouseLocation  location)
 {
   GtkRangePrivate *priv = range->priv;
+  GtkStyleContext *context;
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (range));
 
   /* Don't perform any GDK/GTK+ grab here. Since a button
    * is down, there's an ongoing implicit grab on
@@ -2267,6 +2270,8 @@ range_grab_add (GtkRange      *range,
 
   if (gtk_range_update_mouse_location (range))
     gtk_widget_queue_draw (GTK_WIDGET (range));
+
+  gtk_style_context_add_class (context, "dragging");
 }
 
 static void
@@ -2291,6 +2296,9 @@ range_grab_remove (GtkRange *range)
 {
   GtkRangePrivate *priv = range->priv;
   MouseLocation location;
+  GtkStyleContext *context;
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (range));
 
   location = priv->grab_location;
   priv->grab_location = MOUSE_OUTSIDE;
@@ -2301,6 +2309,8 @@ range_grab_remove (GtkRange *range)
 
   update_zoom_state (range, FALSE);
   range->priv->zoom_set = FALSE;
+
+  gtk_style_context_remove_class (context, "dragging");
 }
 
 static GtkScrollType


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