forked from AuroraMiddleware/gtk
combobox: popdown the combobox when on 'grab-broken-event'
And also explicitly remove pointer/keyboard grabs from the display. Whenever the grab is reported lost, we should popdown the combobox, so that the GDK_WINDOW_TEMP window is hidden and removed from the toplevel, as done with the menu for example. Leaving the GDK_WINDOW_TEMP window open when re-activating the application triggers several issues in the win32 backend, due to restacking windows of the non-toplevel group into the toplevel group: https://bugzilla.gnome.org/show_bug.cgi?id=695200
This commit is contained in:
parent
d1de6c322b
commit
24fa277329
@ -2331,6 +2331,19 @@ popup_grab_on_window (GdkWindow *window,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_combo_box_grab_broken_event (GtkWidget *widget,
|
||||||
|
GdkEventGrabBroken *event,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
|
||||||
|
|
||||||
|
if (event->grab_window == NULL)
|
||||||
|
gtk_combo_box_popdown (combo_box);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_combo_box_popup:
|
* gtk_combo_box_popup:
|
||||||
* @combo_box: a #GtkComboBox
|
* @combo_box: a #GtkComboBox
|
||||||
@ -2455,6 +2468,11 @@ gtk_combo_box_popup_for_device (GtkComboBox *combo_box,
|
|||||||
gtk_device_grab_add (priv->popup_window, pointer, TRUE);
|
gtk_device_grab_add (priv->popup_window, pointer, TRUE);
|
||||||
priv->grab_pointer = pointer;
|
priv->grab_pointer = pointer;
|
||||||
priv->grab_keyboard = keyboard;
|
priv->grab_keyboard = keyboard;
|
||||||
|
|
||||||
|
g_signal_connect (priv->popup_window,
|
||||||
|
"grab-broken-event",
|
||||||
|
G_CALLBACK (gtk_combo_box_grab_broken_event),
|
||||||
|
combo_box);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -2521,6 +2539,10 @@ gtk_combo_box_popdown (GtkComboBox *combo_box)
|
|||||||
if (!gtk_widget_get_realized (GTK_WIDGET (combo_box)))
|
if (!gtk_widget_get_realized (GTK_WIDGET (combo_box)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (priv->grab_keyboard)
|
||||||
|
gdk_device_ungrab (priv->grab_keyboard, GDK_CURRENT_TIME);
|
||||||
|
gdk_device_ungrab (priv->grab_pointer, GDK_CURRENT_TIME);
|
||||||
|
|
||||||
gtk_device_grab_remove (priv->popup_window, priv->grab_pointer);
|
gtk_device_grab_remove (priv->popup_window, priv->grab_pointer);
|
||||||
gtk_widget_hide (priv->popup_window);
|
gtk_widget_hide (priv->popup_window);
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button),
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button),
|
||||||
|
Loading…
Reference in New Issue
Block a user