[gimp] app: restore ungrab on unmap in GimpDial



commit 5c37ef213dab1c6f954cfde79a31473dc7794bc5
Author: Michael Natterer <mitch gimp org>
Date:   Mon May 26 10:56:18 2014 +0200

    app: restore ungrab on unmap in GimpDial
    
    which I broke when splitting classes.

 app/widgets/gimpcircle.c |    7 -------
 app/widgets/gimpdial.c   |   19 +++++++++++++++++--
 2 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/app/widgets/gimpcircle.c b/app/widgets/gimpcircle.c
index 1648dfe..c8e735e 100644
--- a/app/widgets/gimpcircle.c
+++ b/app/widgets/gimpcircle.c
@@ -52,7 +52,6 @@ struct _GimpCirclePrivate
   GimpCircleBackground  background;
 
   GdkWindow            *event_window;
-  guint                 has_grab : 1;
 };
 
 
@@ -267,12 +266,6 @@ gimp_circle_unmap (GtkWidget *widget)
 {
   GimpCircle *circle = GIMP_CIRCLE (widget);
 
-  if (circle->priv->has_grab)
-    {
-      gtk_grab_remove (widget);
-      circle->priv->has_grab = FALSE;
-    }
-
   if (circle->priv->event_window)
     gdk_window_hide (circle->priv->event_window);
 
diff --git a/app/widgets/gimpdial.c b/app/widgets/gimpdial.c
index 69197bd..c8d3aa9 100644
--- a/app/widgets/gimpdial.c
+++ b/app/widgets/gimpdial.c
@@ -67,7 +67,7 @@ struct _GimpDialPrivate
 
   DialTarget  target;
   gdouble     last_angle;
-  guint       has_grab : 1;
+  gboolean    has_grab;
 };
 
 
@@ -81,6 +81,7 @@ static void        gimp_dial_get_property         (GObject            *object,
                                                    GValue             *value,
                                                    GParamSpec         *pspec);
 
+static void        gimp_dial_unmap                (GtkWidget          *widget);
 static gboolean    gimp_dial_expose_event         (GtkWidget          *widget,
                                                    GdkEventExpose     *event);
 static gboolean    gimp_dial_button_press_event   (GtkWidget          *widget,
@@ -113,6 +114,7 @@ gimp_dial_class_init (GimpDialClass *klass)
   object_class->get_property         = gimp_dial_get_property;
   object_class->set_property         = gimp_dial_set_property;
 
+  widget_class->unmap                = gimp_dial_unmap;
   widget_class->expose_event         = gimp_dial_expose_event;
   widget_class->button_press_event   = gimp_dial_button_press_event;
   widget_class->button_release_event = gimp_dial_button_release_event;
@@ -236,6 +238,20 @@ gimp_dial_get_property (GObject    *object,
     }
 }
 
+static void
+gimp_dial_unmap (GtkWidget *widget)
+{
+  GimpDial *dial = GIMP_DIAL (widget);
+
+  if (dial->priv->has_grab)
+    {
+      gtk_grab_remove (widget);
+      dial->priv->has_grab = FALSE;
+    }
+
+  GTK_WIDGET_CLASS (parent_class)->unmap (widget);
+}
+
 static gboolean
 gimp_dial_expose_event (GtkWidget      *widget,
                         GdkEventExpose *event)
@@ -249,7 +265,6 @@ gimp_dial_expose_event (GtkWidget      *widget,
       GtkAllocation  allocation;
       gint           size;
       cairo_t       *cr;
-      gint           x, y;
 
       g_object_get (widget,
                     "size", &size,


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