From 600a0f836f315f84a999777df645d355fcfaac91 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Tue, 19 Nov 2013 20:25:52 -0500 Subject: [PATCH] keyboard: Don't send leave events to dying surfaces --- src/wayland/meta-wayland-keyboard.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c index 670c7bc46..a003ea531 100644 --- a/src/wayland/meta-wayland-keyboard.c +++ b/src/wayland/meta-wayland-keyboard.c @@ -501,14 +501,14 @@ meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard, struct wl_resource *resource; uint32_t serial; - if (keyboard->focus_resource && keyboard->focus != surface) - { - struct wl_display *display; - struct wl_client *client; + if (keyboard->focus == surface) + return; - resource = keyboard->focus_resource; - client = wl_resource_get_client (resource); - display = wl_client_get_display (client); + resource = keyboard->focus_resource; + if (keyboard->focus_resource && keyboard->focus->resource) + { + struct wl_client *client = wl_resource_get_client (resource); + struct wl_display *display = wl_client_get_display (client); serial = wl_display_next_serial (display); wl_keyboard_send_leave (resource, serial, keyboard->focus->resource); @@ -516,13 +516,11 @@ meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard, } resource = find_resource_for_surface (&keyboard->resource_list, surface); - if (resource && - (keyboard->focus != surface || keyboard->focus_resource != resource)) + if (resource) { struct wl_client *client = wl_resource_get_client (resource); - struct wl_display *display; + struct wl_display *display = wl_client_get_display (client); - display = wl_client_get_display (client); serial = wl_display_next_serial (display); /* If we're in a modal grab, the client is focused but doesn't see