Revert "gtk: Remove propagation limit of captured events on the grab widget"

This reverts commit 6511f411955adba4f960b8b07d39b93785afe33e.
This commit is contained in:
Carlos Garnacho 2014-04-03 14:44:58 +02:00
parent cdcc536ddc
commit f766109b5b

View File

@ -1508,6 +1508,7 @@ gtk_main_do_event (GdkEvent *event)
{
GtkWidget *event_widget;
GtkWidget *grab_widget = NULL;
GtkWidget *topmost_widget = NULL;
GtkWindowGroup *window_group;
GdkEvent *rewritten_event = NULL;
GdkDevice *device;
@ -1567,6 +1568,14 @@ gtk_main_do_event (GdkEvent *event)
if (!grab_widget)
grab_widget = gtk_window_group_get_current_grab (window_group);
/* Find out the topmost widget where captured event propagation
* should start, which is the widget holding the GTK+ grab
* if any, otherwise it's left NULL and events are emitted
* from the toplevel (or topmost parentless parent).
*/
if (grab_widget)
topmost_widget = 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.
@ -1680,7 +1689,7 @@ gtk_main_do_event (GdkEvent *event)
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_TOUCH_BEGIN:
if (!_gtk_propagate_captured_event (grab_widget, event, NULL))
if (!_gtk_propagate_captured_event (grab_widget, event, topmost_widget))
gtk_propagate_event (grab_widget, event);
break;
@ -1728,19 +1737,19 @@ gtk_main_do_event (GdkEvent *event)
case GDK_TOUCH_UPDATE:
case GDK_TOUCH_END:
case GDK_TOUCH_CANCEL:
if (!_gtk_propagate_captured_event (grab_widget, event, NULL))
if (!_gtk_propagate_captured_event (grab_widget, event, topmost_widget))
gtk_propagate_event (grab_widget, event);
break;
case GDK_ENTER_NOTIFY:
if (gtk_widget_is_sensitive (grab_widget) &&
!_gtk_propagate_captured_event (grab_widget, event, NULL))
!_gtk_propagate_captured_event (grab_widget, event, topmost_widget))
gtk_widget_event (grab_widget, event);
break;
case GDK_LEAVE_NOTIFY:
if (gtk_widget_is_sensitive (grab_widget) &&
!_gtk_propagate_captured_event (grab_widget, event, NULL))
!_gtk_propagate_captured_event (grab_widget, event, topmost_widget))
gtk_widget_event (grab_widget, event);
break;