pointer/keyboard: Stop using focus_resource for anything unessential

This commit is contained in:
Jasper St. Pierre 2014-04-16 15:29:59 -04:00
parent bbec66c2d8
commit edfaf3de49
2 changed files with 8 additions and 13 deletions

View File

@ -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);

View File

@ -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);