input: clean up seat_get_keyboard a little

We already have a pointer to the keyboard, so we can change all
seat->keyboard to keyboard

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
dev
Derek Foreman 10 years ago committed by Bryce Harrington
parent c269b5832d
commit 345c9f366f
  1. 22
      src/input.c

@ -1777,7 +1777,7 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource,
struct weston_keyboard *keyboard = seat->keyboard; struct weston_keyboard *keyboard = seat->keyboard;
struct wl_resource *cr; struct wl_resource *cr;
if (!seat->keyboard) if (!keyboard)
return; return;
cr = wl_resource_create(client, &wl_keyboard_interface, cr = wl_resource_create(client, &wl_keyboard_interface,
@ -1790,7 +1790,7 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource,
/* May be moved to focused list later by either /* May be moved to focused list later by either
* weston_keyboard_set_focus or directly if this client is already * weston_keyboard_set_focus or directly if this client is already
* focused */ * focused */
wl_list_insert(&seat->keyboard->resource_list, wl_resource_get_link(cr)); wl_list_insert(&keyboard->resource_list, wl_resource_get_link(cr));
wl_resource_set_implementation(cr, &keyboard_interface, wl_resource_set_implementation(cr, &keyboard_interface,
seat, unbind_resource); seat, unbind_resource);
@ -1813,27 +1813,27 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource,
} }
if (should_send_modifiers_to_client(seat, client)) { if (should_send_modifiers_to_client(seat, client)) {
send_modifiers_to_resource(seat->keyboard, send_modifiers_to_resource(keyboard,
cr, cr,
seat->keyboard->focus_serial); keyboard->focus_serial);
} }
if (seat->keyboard->focus && seat->keyboard->focus->resource && if (keyboard->focus && keyboard->focus->resource &&
wl_resource_get_client(seat->keyboard->focus->resource) == client) { wl_resource_get_client(keyboard->focus->resource) == client) {
struct weston_surface *surface = struct weston_surface *surface =
(struct weston_surface *) seat->keyboard->focus; (struct weston_surface *)keyboard->focus;
wl_list_remove(wl_resource_get_link(cr)); wl_list_remove(wl_resource_get_link(cr));
wl_list_insert(&seat->keyboard->focus_resource_list, wl_list_insert(&keyboard->focus_resource_list,
wl_resource_get_link(cr)); wl_resource_get_link(cr));
wl_keyboard_send_enter(cr, wl_keyboard_send_enter(cr,
seat->keyboard->focus_serial, keyboard->focus_serial,
surface->resource, surface->resource,
&seat->keyboard->keys); &keyboard->keys);
/* If this is the first keyboard resource for this /* If this is the first keyboard resource for this
* client... */ * client... */
if (seat->keyboard->focus_resource_list.prev == if (keyboard->focus_resource_list.prev ==
wl_resource_get_link(cr)) wl_resource_get_link(cr))
wl_data_device_set_keyboard_focus(seat); wl_data_device_set_keyboard_focus(seat);
} }

Loading…
Cancel
Save