diff options
author | Daniel Stone <daniel@fooishbar.org> | 2012-05-16 18:45:18 +0100 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-05-16 15:29:06 -0400 |
commit | 37816df64641a9b8bb922e938f902adc2374de2e (patch) | |
tree | ca57380d1aeb7c9f13b4bd4cd743e8869d2db1a7 /src/util.c | |
parent | dc549932b734967b6ea7bb9a9d3467440e105739 (diff) |
Convert wl_input_device to wl_seat (and friends)
wl_input_device has been both renamed and split. wl_seat is now a
virtual object representing a group of logically related input devices
with related focus.
It now only generates one event: to let clients know that it has new
capabilities. It takes requests which hand back objects for the
wl_pointer, wl_keyboard and wl_touch interfaces it exposes which all
provide the old input interface, just under different names.
This commit tracks these changes in weston and the clients, as well as
similar renames (e.g. weston_input_device -> weston_seat). Some other
changes were necessary, e.g. renaming the name for the visible mouse
sprite from 'pointer' to 'cursor' so as to not conflict.
For simplicity, every seat is always exposed with all three interfaces,
although this will change as time goes on.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -257,16 +257,16 @@ binding_key(struct wl_keyboard_grab *grab, struct wl_display *display; uint32_t serial; - resource = grab->input_device->keyboard_focus_resource; + resource = grab->keyboard->focus_resource; if (key == b->key) { if (!state) { - wl_input_device_end_keyboard_grab(grab->input_device); + wl_keyboard_end_grab(grab->keyboard); free(b); } } else if (resource) { display = wl_client_get_display(resource->client); serial = wl_display_next_serial(display); - wl_input_device_send_key(resource, serial, time, key, state); + wl_keyboard_send_key(resource, serial, time, key, state); } } @@ -275,7 +275,7 @@ static const struct wl_keyboard_grab_interface binding_grab = { }; static void -install_binding_grab(struct wl_input_device *device, +install_binding_grab(struct wl_seat *seat, uint32_t time, uint32_t key) { struct binding_keyboard_grab *grab; @@ -283,12 +283,12 @@ install_binding_grab(struct wl_input_device *device, grab = malloc(sizeof *grab); grab->key = key; grab->grab.interface = &binding_grab; - wl_input_device_start_keyboard_grab(device, &grab->grab); + wl_keyboard_start_grab(seat->keyboard, &grab->grab); } WL_EXPORT void weston_compositor_run_binding(struct weston_compositor *compositor, - struct weston_input_device *device, + struct weston_seat *seat, uint32_t time, uint32_t key, uint32_t button, uint32_t axis, int32_t value) { @@ -296,18 +296,17 @@ weston_compositor_run_binding(struct weston_compositor *compositor, wl_list_for_each(b, &compositor->binding_list, link) { if (b->key == key && b->button == button && b->axis == axis && - b->modifier == device->modifier_state && value) { - b->handler(&device->input_device, + b->modifier == seat->modifier_state && value) { + b->handler(&seat->seat, time, key, button, axis, value, b->data); /* If this was a key binding and it didn't * install a keyboard grab, install one now to * swallow the key release. */ if (b->key && - device->input_device.keyboard_grab == - &device->input_device.default_keyboard_grab) - install_binding_grab(&device->input_device, - time, key); + seat->seat.keyboard->grab == + &seat->seat.keyboard->default_grab) + install_binding_grab(&seat->seat, time, key); } } } |