From 45df3e41c5ce5ef5865780c4f6208d6f6438ca5a Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 18 Apr 2014 18:53:38 -0400 Subject: [PATCH] pointer: Split out the code that sets the focus surface --- src/wayland/meta-wayland-pointer.c | 31 ++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c index f93c22fec..0b84a09f9 100644 --- a/src/wayland/meta-wayland-pointer.c +++ b/src/wayland/meta-wayland-pointer.c @@ -352,13 +352,29 @@ count_buttons (const ClutterEvent *event) return count; } +static void +sync_focus_surface (MetaWaylandPointer *pointer) +{ + MetaWaylandSurface *focus_surface; + MetaDisplay *display = meta_get_display (); + + if (meta_grab_op_should_block_wayland (display->grab_op)) + focus_surface = NULL; + else + focus_surface = pointer->current; + + if (focus_surface != pointer->focus_surface) + { + const MetaWaylandPointerGrabInterface *interface = pointer->grab->interface; + interface->focus (pointer->grab, focus_surface); + } +} + static void repick_for_event (MetaWaylandPointer *pointer, const ClutterEvent *for_event) { ClutterActor *actor = NULL; - MetaDisplay *display = meta_get_display (); - MetaWaylandSurface *focus_surface; if (for_event) { @@ -386,16 +402,7 @@ repick_for_event (MetaWaylandPointer *pointer, if (pointer->cursor_tracker && pointer->current == NULL) meta_cursor_tracker_unset_window_cursor (pointer->cursor_tracker); - if (meta_grab_op_should_block_wayland (display->grab_op)) - focus_surface = NULL; - else - focus_surface = pointer->current; - - if (focus_surface != pointer->focus_surface) - { - const MetaWaylandPointerGrabInterface *interface = pointer->grab->interface; - interface->focus (pointer->grab, focus_surface); - } + sync_focus_surface (pointer); } static void