From edfaf3de490ce6502df87a36ec53fe6f827d3891 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Wed, 16 Apr 2014 15:29:59 -0400 Subject: [PATCH] pointer/keyboard: Stop using focus_resource for anything unessential --- src/wayland/meta-wayland-keyboard.c | 6 +++--- src/wayland/meta-wayland-pointer.c | 15 +++++---------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c index 535674410..dde0e71b1 100644 --- a/src/wayland/meta-wayland-keyboard.c +++ b/src/wayland/meta-wayland-keyboard.c @@ -238,7 +238,7 @@ default_grab_key (MetaWaylandKeyboardGrab *grab, resource = keyboard->focus_resource; if (resource) { - struct wl_client *client = wl_resource_get_client (resource); + struct wl_client *client = wl_resource_get_client (keyboard->focus_surface->resource); struct wl_display *display = wl_client_get_display (client); serial = wl_display_next_serial (display); wl_keyboard_send_key (resource, serial, time, key, state); @@ -439,7 +439,7 @@ meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard, { if (keyboard->focus_resource) { - struct wl_client *client = wl_resource_get_client (keyboard->focus_resource); + struct wl_client *client = wl_resource_get_client (keyboard->focus_surface->resource); struct wl_display *display = wl_client_get_display (client); uint32_t serial = wl_display_next_serial (display); wl_keyboard_send_leave (keyboard->focus_resource, serial, keyboard->focus_surface->resource); @@ -460,7 +460,7 @@ meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard, keyboard->focus_resource = find_resource_for_surface (&keyboard->resource_list, surface); if (keyboard->focus_resource) { - struct wl_client *client = wl_resource_get_client (keyboard->focus_resource); + struct wl_client *client = wl_resource_get_client (keyboard->focus_surface->resource); struct wl_display *display = wl_client_get_display (client); struct xkb_state *state = keyboard->xkb_info.state; uint32_t serial = wl_display_next_serial (display); diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c index 8971e1ed3..d80df1d63 100644 --- a/src/wayland/meta-wayland-pointer.c +++ b/src/wayland/meta-wayland-pointer.c @@ -120,7 +120,7 @@ default_grab_button (MetaWaylandPointerGrab *grab, resource = pointer->focus_resource; if (resource) { - struct wl_client *client = wl_resource_get_client (resource); + struct wl_client *client = wl_resource_get_client (pointer->focus_surface->resource); struct wl_display *display = wl_client_get_display (client); uint32_t button; uint32_t serial; @@ -327,7 +327,7 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer, { if (pointer->focus_resource) { - struct wl_client *client = wl_resource_get_client (pointer->focus_resource); + struct wl_client *client = wl_resource_get_client (pointer->focus_surface->resource); struct wl_display *display = wl_client_get_display (client); uint32_t serial = wl_display_next_serial (display); wl_pointer_send_leave (pointer->focus_resource, serial, pointer->focus_surface->resource); @@ -354,7 +354,7 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer, pointer->focus_resource = find_resource_for_surface (&pointer->resource_list, surface); if (pointer->focus_resource) { - struct wl_client *client = wl_resource_get_client (pointer->focus_resource); + struct wl_client *client = wl_resource_get_client (pointer->focus_surface->resource); struct wl_display *display = wl_client_get_display (client); uint32_t serial = wl_display_next_serial (display); @@ -438,13 +438,8 @@ popup_grab_button (MetaWaylandPointerGrab *grab, MetaWaylandPopupGrab *popup_grab = (MetaWaylandPopupGrab*)grab; MetaWaylandPointer *pointer = grab->pointer; - if (pointer->focus_resource) - { - /* This is ensured by popup_grab_focus */ - g_assert (wl_resource_get_client (pointer->focus_resource) == popup_grab->grab_client); - - default_grab_button (grab, event); - } + if (pointer->focus_surface) + default_grab_button (grab, event); else if (clutter_event_type (event) == CLUTTER_BUTTON_RELEASE && pointer->button_count == 0) meta_wayland_pointer_end_popup_grab (grab->pointer);