[gimp] Bug 612618 - Font selection remains visible



commit 2a984ef51f1679acd7c73163c633fdc8470058f2
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jun 22 20:07:50 2010 +0200

    Bug 612618 - Font selection remains visible
    
    Connect to "grab-notify" and "grab-broken-event" and close the popup
    when the grab is lost.

 app/widgets/gimpcontainerpopup.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/app/widgets/gimpcontainerpopup.c b/app/widgets/gimpcontainerpopup.c
index a07d05c..7d2f003 100644
--- a/app/widgets/gimpcontainerpopup.c
+++ b/app/widgets/gimpcontainerpopup.c
@@ -177,6 +177,23 @@ gimp_container_popup_finalize (GObject *object)
 }
 
 static void
+gimp_container_popup_grab_notify (GtkWidget *widget,
+                                  gboolean   was_grabbed)
+{
+  if (! was_grabbed)
+    g_signal_emit (widget, popup_signals[CANCEL], 0);
+}
+
+static gboolean
+gimp_container_popup_grab_broken_event (GtkWidget          *widget,
+                                        GdkEventGrabBroken *event)
+{
+  gimp_container_popup_grab_notify (widget, FALSE);
+
+  return FALSE;
+}
+
+static void
 gimp_container_popup_map (GtkWidget *widget)
 {
   GTK_WIDGET_CLASS (parent_class)->map (widget);
@@ -194,6 +211,14 @@ gimp_container_popup_map (GtkWidget *widget)
                              GDK_CURRENT_TIME) == 0)
         {
           gtk_grab_add (widget);
+
+          g_signal_connect (widget, "grab-notify",
+                            G_CALLBACK (gimp_container_popup_grab_notify),
+                            widget);
+          g_signal_connect (widget, "grab-broken-event",
+                            G_CALLBACK (gimp_container_popup_grab_broken_event),
+                            widget);
+
           return;
         }
       else



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