Bug 612618 - Font selection remains visible

Connect to "grab-notify" and "grab-broken-event" and close the popup
when the grab is lost.
This commit is contained in:
Michael Natterer 2010-06-22 20:07:50 +02:00
parent ff1da59f33
commit 2a984ef51f
1 changed files with 25 additions and 0 deletions

View File

@ -176,6 +176,23 @@ gimp_container_popup_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (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)
{
@ -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