Make GTK+ device grabs take precedence over GTK+ grabs

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=620440 (Reported by
Marek Kašík), where the print dialog modality would impair the pop-up
window from getting events. Device GTK+ grabs gain in specificness.
This commit is contained in:
Carlos Garnacho 2010-06-15 19:06:51 +02:00
parent f62e000be4
commit b238c0124a

View File

@ -1466,31 +1466,21 @@ gtk_main_do_event (GdkEvent *event)
window_group = gtk_main_get_window_group (event_widget);
device = gdk_event_get_device (event);
/* If there is a grab in effect...
/* check whether there is a (device) grab in effect...
*/
if (window_group->grabs)
{
grab_widget = window_group->grabs->data;
/* If the grab widget is an ancestor of the event widget
* then we send the event to the original event widget.
* This is the key to implementing modality.
*/
if (gtk_widget_is_sensitive (event_widget) &&
gtk_widget_is_ancestor (event_widget, grab_widget))
grab_widget = event_widget;
}
else if (device)
{
grab_widget = gtk_window_group_get_current_device_grab (window_group, device);
if (device)
grab_widget = gtk_window_group_get_current_device_grab (window_group, device);
if (grab_widget &&
gtk_widget_get_sensitive (event_widget) &&
gtk_widget_is_ancestor (event_widget, grab_widget))
grab_widget = event_widget;
}
if (!grab_widget && window_group->grabs)
grab_widget = window_group->grabs->data;
if (!grab_widget)
/* If the grab widget is an ancestor of the event widget
* then we send the event to the original event widget.
* This is the key to implementing modality.
*/
if (!grab_widget ||
(gtk_widget_is_sensitive (event_widget) &&
gtk_widget_is_ancestor (event_widget, grab_widget)))
grab_widget = event_widget;
/* If the widget receiving events is actually blocked by another device GTK+ grab */