[gimp/gimp-2-6] Bug 612618 - Font selection remains visible



commit c36bafdd7a32cdb1fea211295ffa1f8d0e8743ec
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.
    (cherry picked from commit 2a984ef51f1679acd7c73163c633fdc8470058f2)

 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 cc825e9..50624cc 100644
--- a/app/widgets/gimpcontainerpopup.c
+++ b/app/widgets/gimpcontainerpopup.c
@@ -178,6 +178,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)
       if (gdk_keyboard_grab (widget->window, TRUE, 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]