From b2df1358447c39e3a4720af2286846d516ea3b02 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 7 Nov 2012 12:08:23 +0100 Subject: [PATCH] Reset event controllers on GdkEventGrabBroken This event means that the widget being listened won't receive further input events as something else grabbed devices, reset event controllers in this case. This helps with SL #4128 where we did reset the long press controller manually. Signed-off-by: Carlos Garnacho Acked-by: Simon Schampijer --- .../event-controller/sugar-event-controller.c | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/sugar3/event-controller/sugar-event-controller.c b/src/sugar3/event-controller/sugar-event-controller.c index 2fae4a15..e2f86825 100644 --- a/src/sugar3/event-controller/sugar-event-controller.c +++ b/src/sugar3/event-controller/sugar-event-controller.c @@ -203,16 +203,21 @@ _sugar_event_controller_widget_event (GtkWidget *widget, data->current_exclusive != item->controller) continue; - if (!sugar_event_controller_handle_event (item->controller, event)) - continue; + if (event->type == GDK_GRAB_BROKEN && !event->grab_broken.keyboard) + sugar_event_controller_reset (item->controller); + else + { + if (!sugar_event_controller_handle_event (item->controller, event)) + continue; - state = sugar_event_controller_get_state (item->controller); + state = sugar_event_controller_get_state (item->controller); - /* Consider events handled once the - * controller recognizes the action - */ - if (state == SUGAR_EVENT_CONTROLLER_STATE_RECOGNIZED) - handled = TRUE; + /* Consider events handled once the + * controller recognizes the action + */ + if (state == SUGAR_EVENT_CONTROLLER_STATE_RECOGNIZED) + handled = TRUE; + } } return handled;