input: Merge wl_seat into weston_seat

dev
Kristian Høgsberg 12 years ago
parent 4912454ba4
commit e314875d00
  1. 17
      src/bindings.c
  2. 12
      src/clipboard.c
  3. 4
      src/compositor-drm.c
  4. 2
      src/compositor-fbdev.c
  5. 4
      src/compositor-rpi.c
  6. 4
      src/compositor-wayland.c
  7. 2
      src/compositor-x11.c
  8. 14
      src/compositor.c
  9. 83
      src/compositor.h
  10. 45
      src/data-device.c
  11. 2
      src/evdev.c
  12. 2
      src/gl-renderer.c
  13. 172
      src/input.c
  14. 2
      src/pixman-renderer.c
  15. 4
      src/screenshooter.c
  16. 114
      src/shell.c
  17. 4
      src/tablet-shell.c
  18. 13
      src/text-backend.c
  19. 2
      src/udev-seat.c
  20. 12
      src/xwayland/selection.c
  21. 4
      src/xwayland/window-manager.c
  22. 12
      src/zoom.c
  23. 6
      tests/weston-test.c

@ -194,8 +194,7 @@ static const struct weston_keyboard_grab_interface binding_grab = {
}; };
static void static void
install_binding_grab(struct wl_seat *seat, install_binding_grab(struct weston_seat *seat, uint32_t time, uint32_t key)
uint32_t time, uint32_t key)
{ {
struct binding_keyboard_grab *grab; struct binding_keyboard_grab *grab;
@ -219,14 +218,14 @@ weston_compositor_run_key_binding(struct weston_compositor *compositor,
wl_list_for_each(b, &compositor->key_binding_list, link) { wl_list_for_each(b, &compositor->key_binding_list, link) {
if (b->key == key && b->modifier == seat->modifier_state) { if (b->key == key && b->modifier == seat->modifier_state) {
weston_key_binding_handler_t handler = b->handler; weston_key_binding_handler_t handler = b->handler;
handler(&seat->seat, time, key, b->data); handler(seat, time, key, b->data);
/* If this was a key binding and it didn't /* If this was a key binding and it didn't
* install a keyboard grab, install one now to * install a keyboard grab, install one now to
* swallow the key release. */ * swallow the key release. */
if (seat->seat.keyboard->grab == if (seat->keyboard->grab ==
&seat->seat.keyboard->default_grab) &seat->keyboard->default_grab)
install_binding_grab(&seat->seat, time, key); install_binding_grab(seat, time, key);
} }
} }
} }
@ -245,7 +244,7 @@ weston_compositor_run_button_binding(struct weston_compositor *compositor,
wl_list_for_each(b, &compositor->button_binding_list, link) { wl_list_for_each(b, &compositor->button_binding_list, link) {
if (b->button == button && b->modifier == seat->modifier_state) { if (b->button == button && b->modifier == seat->modifier_state) {
weston_button_binding_handler_t handler = b->handler; weston_button_binding_handler_t handler = b->handler;
handler(&seat->seat, time, button, b->data); handler(seat, time, button, b->data);
} }
} }
} }
@ -261,7 +260,7 @@ weston_compositor_run_axis_binding(struct weston_compositor *compositor,
wl_list_for_each(b, &compositor->axis_binding_list, link) { wl_list_for_each(b, &compositor->axis_binding_list, link) {
if (b->axis == axis && b->modifier == seat->modifier_state) { if (b->axis == axis && b->modifier == seat->modifier_state) {
weston_axis_binding_handler_t handler = b->handler; weston_axis_binding_handler_t handler = b->handler;
handler(&seat->seat, time, axis, value, b->data); handler(seat, time, axis, value, b->data);
return 1; return 1;
} }
} }
@ -285,7 +284,7 @@ weston_compositor_run_debug_binding(struct weston_compositor *compositor,
count++; count++;
handler = binding->handler; handler = binding->handler;
handler(&seat->seat, time, key, binding->data); handler(seat, time, key, binding->data);
} }
return count; return count;

@ -209,15 +209,15 @@ clipboard_set_selection(struct wl_listener *listener, void *data)
struct clipboard *clipboard = struct clipboard *clipboard =
container_of(listener, struct clipboard, selection_listener); container_of(listener, struct clipboard, selection_listener);
struct weston_seat *seat = data; struct weston_seat *seat = data;
struct wl_data_source *source = seat->seat.selection_data_source; struct wl_data_source *source = seat->selection_data_source;
const char **mime_types; const char **mime_types;
int p[2]; int p[2];
if (source == NULL) { if (source == NULL) {
if (clipboard->source) if (clipboard->source)
wl_seat_set_selection(&seat->seat, weston_seat_set_selection(seat,
&clipboard->source->base, &clipboard->source->base,
clipboard->source->serial); clipboard->source->serial);
return; return;
} else if (source->accept == clipboard_source_accept) { } else if (source->accept == clipboard_source_accept) {
/* Callback for our data source. */ /* Callback for our data source. */
@ -238,7 +238,7 @@ clipboard_set_selection(struct wl_listener *listener, void *data)
clipboard->source = clipboard->source =
clipboard_source_create(clipboard, mime_types[0], clipboard_source_create(clipboard, mime_types[0],
seat->seat.selection_serial, p[0]); seat->selection_serial, p[0]);
if (clipboard->source == NULL) if (clipboard->source == NULL)
return; return;
} }
@ -268,7 +268,7 @@ clipboard_create(struct weston_seat *seat)
clipboard->selection_listener.notify = clipboard_set_selection; clipboard->selection_listener.notify = clipboard_set_selection;
clipboard->destroy_listener.notify = clipboard_destroy; clipboard->destroy_listener.notify = clipboard_destroy;
wl_signal_add(&seat->seat.selection_signal, wl_signal_add(&seat->selection_signal,
&clipboard->selection_listener); &clipboard->selection_listener);
wl_signal_add(&seat->destroy_signal, wl_signal_add(&seat->destroy_signal,
&clipboard->destroy_listener); &clipboard->destroy_listener);

@ -2251,7 +2251,7 @@ vt_func(struct weston_compositor *compositor, int event)
} }
static void static void
switch_vt_binding(struct wl_seat *seat, uint32_t time, uint32_t key, void *data) switch_vt_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data)
{ {
struct drm_compositor *ec = data; struct drm_compositor *ec = data;
@ -2315,7 +2315,7 @@ find_primary_gpu(struct drm_compositor *ec, const char *seat)
} }
static void static void
planes_binding(struct wl_seat *seat, uint32_t time, uint32_t key, void *data) planes_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data)
{ {
struct drm_compositor *c = data; struct drm_compositor *c = data;

@ -826,7 +826,7 @@ fbdev_restore(struct weston_compositor *base)
} }
static void static void
switch_vt_binding(struct wl_seat *seat, uint32_t time, uint32_t key, void *data) switch_vt_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data)
{ {
struct fbdev_compositor *ec = data; struct fbdev_compositor *ec = data;

@ -1335,7 +1335,7 @@ evdev_remove_devices(struct weston_seat *seat_base)
wl_list_for_each_safe(device, next, &seat->devices_list, link) wl_list_for_each_safe(device, next, &seat->devices_list, link)
evdev_device_destroy(device); evdev_device_destroy(device);
if (seat->base.seat.keyboard) if (seat->base.keyboard)
notify_keyboard_focus_out(&seat->base); notify_keyboard_focus_out(&seat->base);
} }
@ -1426,7 +1426,7 @@ rpi_restore(struct weston_compositor *base)
} }
static void static void
switch_vt_binding(struct wl_seat *seat, uint32_t time, uint32_t key, void *data) switch_vt_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data)
{ {
struct rpi_compositor *ec = data; struct rpi_compositor *ec = data;

@ -451,9 +451,9 @@ input_handle_motion(void *data, struct wl_pointer *pointer,
if (input->focus) if (input->focus)
notify_motion(&input->base, time, notify_motion(&input->base, time,
x - wl_fixed_from_int(c->border.left) - x - wl_fixed_from_int(c->border.left) -
input->base.seat.pointer->x, input->base.pointer->x,
y - wl_fixed_from_int(c->border.top) - y - wl_fixed_from_int(c->border.top) -
input->base.seat.pointer->y); input->base.pointer->y);
} }
static void static void

@ -865,7 +865,7 @@ static void
update_xkb_state_from_core(struct x11_compositor *c, uint16_t x11_mask) update_xkb_state_from_core(struct x11_compositor *c, uint16_t x11_mask)
{ {
uint32_t mask = get_xkb_mod_mask(c, x11_mask); uint32_t mask = get_xkb_mod_mask(c, x11_mask);
struct weston_keyboard *keyboard = &c->core_seat.keyboard; struct weston_keyboard *keyboard = &c->core_seat.keyboard_instance;
xkb_state_update_mask(c->core_seat.xkb_state.state, xkb_state_update_mask(c->core_seat.xkb_state.state,
keyboard->modifiers.mods_depressed & mask, keyboard->modifiers.mods_depressed & mask,

@ -122,7 +122,7 @@ weston_output_switch_mode(struct weston_output *output, struct weston_mode *mode
/* If a pointer falls outside the outputs new geometry, move it to its /* If a pointer falls outside the outputs new geometry, move it to its
* lower-right corner */ * lower-right corner */
wl_list_for_each(seat, &output->compositor->seat_list, link) { wl_list_for_each(seat, &output->compositor->seat_list, link) {
struct weston_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->pointer;
int32_t x, y; int32_t x, y;
if (!pointer) if (!pointer)
@ -946,12 +946,12 @@ weston_surface_unmap(struct weston_surface *surface)
wl_list_remove(&surface->layer_link); wl_list_remove(&surface->layer_link);
wl_list_for_each(seat, &surface->compositor->seat_list, link) { wl_list_for_each(seat, &surface->compositor->seat_list, link) {
if (seat->seat.keyboard && if (seat->keyboard &&
seat->seat.keyboard->focus == &surface->surface) seat->keyboard->focus == &surface->surface)
weston_keyboard_set_focus(seat->seat.keyboard, NULL); weston_keyboard_set_focus(seat->keyboard, NULL);
if (seat->seat.pointer && if (seat->pointer &&
seat->seat.pointer->focus == &surface->surface) seat->pointer->focus == &surface->surface)
weston_pointer_set_focus(seat->seat.pointer, weston_pointer_set_focus(seat->pointer,
NULL, NULL,
wl_fixed_from_int(0), wl_fixed_from_int(0),
wl_fixed_from_int(0)); wl_fixed_from_int(0));

@ -286,7 +286,7 @@ struct wl_data_source {
}; };
struct weston_pointer { struct weston_pointer {
struct wl_seat *seat; struct weston_seat *seat;
struct wl_list resource_list; struct wl_list resource_list;
struct wl_surface *focus; struct wl_surface *focus;
@ -312,7 +312,7 @@ struct weston_pointer {
struct weston_touch { struct weston_touch {
struct wl_seat *seat; struct weston_seat *seat;
struct wl_list resource_list; struct wl_list resource_list;
struct wl_surface *focus; struct wl_surface *focus;
@ -328,37 +328,12 @@ struct weston_touch {
uint32_t grab_time; uint32_t grab_time;
}; };
struct wl_seat {
struct wl_list base_resource_list;
struct weston_pointer *pointer;
struct weston_keyboard *keyboard;
struct weston_touch *touch;
uint32_t selection_serial;
struct wl_data_source *selection_data_source;
struct wl_listener selection_data_source_listener;
struct wl_signal selection_signal;
struct wl_list drag_resource_list;
struct wl_client *drag_client;
struct wl_data_source *drag_data_source;
struct wl_listener drag_data_source_listener;
struct wl_surface *drag_focus;
struct wl_resource *drag_focus_resource;
struct wl_listener drag_focus_listener;
struct weston_pointer_grab drag_grab;
struct wl_surface *drag_surface;
struct wl_listener drag_icon_listener;
struct wl_signal drag_icon_signal;
};
void void
wl_seat_set_pointer(struct wl_seat *seat, struct weston_pointer *pointer); weston_seat_set_pointer(struct weston_seat *seat, struct weston_pointer *pointer);
void void
wl_seat_set_keyboard(struct wl_seat *seat, struct weston_keyboard *keyboard); weston_seat_set_keyboard(struct weston_seat *seat, struct weston_keyboard *keyboard);
void void
wl_seat_set_touch(struct wl_seat *seat, struct weston_touch *touch); weston_seat_set_touch(struct weston_seat *seat, struct weston_touch *touch);
void void
weston_pointer_init(struct weston_pointer *pointer); weston_pointer_init(struct weston_pointer *pointer);
@ -401,15 +376,15 @@ void
weston_touch_end_grab(struct weston_touch *touch); weston_touch_end_grab(struct weston_touch *touch);
void void
wl_data_device_set_keyboard_focus(struct wl_seat *seat); wl_data_device_set_keyboard_focus(struct weston_seat *seat);
int int
wl_data_device_manager_init(struct wl_display *display); wl_data_device_manager_init(struct wl_display *display);
void void
wl_seat_set_selection(struct wl_seat *seat, weston_seat_set_selection(struct weston_seat *seat,
struct wl_data_source *source, uint32_t serial); struct wl_data_source *source, uint32_t serial);
struct weston_xkb_info { struct weston_xkb_info {
struct xkb_keymap *keymap; struct xkb_keymap *keymap;
@ -430,7 +405,7 @@ struct weston_xkb_info {
}; };
struct weston_keyboard { struct weston_keyboard {
struct wl_seat *seat; struct weston_seat *seat;
struct wl_list resource_list; struct wl_list resource_list;
struct wl_surface *focus; struct wl_surface *focus;
@ -459,26 +434,48 @@ struct weston_keyboard {
}; };
struct weston_seat { struct weston_seat {
struct wl_seat seat; struct wl_list base_resource_list;
struct weston_pointer pointer;
struct weston_pointer *pointer;
struct weston_keyboard *keyboard;
struct weston_touch *touch;
struct weston_pointer pointer_instance;
int has_pointer; int has_pointer;
struct weston_keyboard keyboard; struct weston_keyboard keyboard_instance;
int has_keyboard; int has_keyboard;
struct weston_touch touch; struct weston_touch touch_instance;
int has_touch; int has_touch;
struct wl_signal destroy_signal; struct wl_signal destroy_signal;
struct weston_compositor *compositor; struct weston_compositor *compositor;
struct weston_surface *sprite; struct weston_surface *sprite;
struct wl_listener sprite_destroy_listener; struct wl_listener sprite_destroy_listener;
struct weston_surface *drag_surface;
struct wl_listener drag_surface_destroy_listener;
int32_t hotspot_x, hotspot_y; int32_t hotspot_x, hotspot_y;
struct wl_list link; struct wl_list link;
enum weston_keyboard_modifier modifier_state; enum weston_keyboard_modifier modifier_state;
struct wl_surface *saved_kbd_focus; struct wl_surface *saved_kbd_focus;
struct wl_listener saved_kbd_focus_listener; struct wl_listener saved_kbd_focus_listener;
uint32_t selection_serial;
struct wl_data_source *selection_data_source;
struct wl_listener selection_data_source_listener;
struct wl_signal selection_signal;
struct wl_list drag_resource_list;
struct wl_client *drag_client;
struct wl_data_source *drag_data_source;
struct wl_listener drag_data_source_listener;
struct wl_surface *drag_focus;
struct wl_resource *drag_focus_resource;
struct wl_listener drag_focus_listener;
struct weston_pointer_grab drag_grab;
struct wl_surface *next_drag_surface;
struct weston_surface *drag_surface;
struct wl_listener drag_surface_destroy_listener;
struct wl_listener drag_icon_listener;
struct wl_signal drag_icon_signal;
uint32_t num_tp; uint32_t num_tp;
struct wl_listener new_drag_icon_listener; struct wl_listener new_drag_icon_listener;
@ -872,7 +869,7 @@ weston_compositor_pick_surface(struct weston_compositor *compositor,
struct weston_binding; struct weston_binding;
typedef void (*weston_key_binding_handler_t)(struct wl_seat *seat, typedef void (*weston_key_binding_handler_t)(struct weston_seat *seat,
uint32_t time, uint32_t key, uint32_t time, uint32_t key,
void *data); void *data);
struct weston_binding * struct weston_binding *
@ -882,7 +879,7 @@ weston_compositor_add_key_binding(struct weston_compositor *compositor,
weston_key_binding_handler_t binding, weston_key_binding_handler_t binding,
void *data); void *data);
typedef void (*weston_button_binding_handler_t)(struct wl_seat *seat, typedef void (*weston_button_binding_handler_t)(struct weston_seat *seat,
uint32_t time, uint32_t button, uint32_t time, uint32_t button,
void *data); void *data);
struct weston_binding * struct weston_binding *
@ -892,7 +889,7 @@ weston_compositor_add_button_binding(struct weston_compositor *compositor,
weston_button_binding_handler_t binding, weston_button_binding_handler_t binding,
void *data); void *data);
typedef void (*weston_axis_binding_handler_t)(struct wl_seat *seat, typedef void (*weston_axis_binding_handler_t)(struct weston_seat *seat,
uint32_t time, uint32_t axis, uint32_t time, uint32_t axis,
wl_fixed_t value, void *data); wl_fixed_t value, void *data);
struct weston_binding * struct weston_binding *

@ -158,8 +158,8 @@ find_resource(struct wl_list *list, struct wl_client *client)
static void static void
destroy_drag_focus(struct wl_listener *listener, void *data) destroy_drag_focus(struct wl_listener *listener, void *data)
{ {
struct wl_seat *seat = struct weston_seat *seat =
container_of(listener, struct wl_seat, drag_focus_listener); container_of(listener, struct weston_seat, drag_focus_listener);
seat->drag_focus_resource = NULL; seat->drag_focus_resource = NULL;
} }
@ -168,7 +168,8 @@ static void
drag_grab_focus(struct weston_pointer_grab *grab, drag_grab_focus(struct weston_pointer_grab *grab,
struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y) struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y)
{ {
struct wl_seat *seat = container_of(grab, struct wl_seat, drag_grab); struct weston_seat *seat =
container_of(grab, struct weston_seat, drag_grab);
struct wl_resource *resource, *offer = NULL; struct wl_resource *resource, *offer = NULL;
struct wl_display *display; struct wl_display *display;
uint32_t serial; uint32_t serial;
@ -214,7 +215,8 @@ static void
drag_grab_motion(struct weston_pointer_grab *grab, drag_grab_motion(struct weston_pointer_grab *grab,
uint32_t time, wl_fixed_t x, wl_fixed_t y) uint32_t time, wl_fixed_t x, wl_fixed_t y)
{ {
struct wl_seat *seat = container_of(grab, struct wl_seat, drag_grab); struct weston_seat *seat =
container_of(grab, struct weston_seat, drag_grab);
if (seat->drag_focus_resource) if (seat->drag_focus_resource)
wl_data_device_send_motion(seat->drag_focus_resource, wl_data_device_send_motion(seat->drag_focus_resource,
@ -222,7 +224,7 @@ drag_grab_motion(struct weston_pointer_grab *grab,
} }
static void static void
data_device_end_drag_grab(struct wl_seat *seat) data_device_end_drag_grab(struct weston_seat *seat)
{ {
if (seat->drag_surface) { if (seat->drag_surface) {
seat->drag_surface = NULL; seat->drag_surface = NULL;
@ -243,7 +245,8 @@ static void
drag_grab_button(struct weston_pointer_grab *grab, drag_grab_button(struct weston_pointer_grab *grab,
uint32_t time, uint32_t button, uint32_t state_w) uint32_t time, uint32_t button, uint32_t state_w)
{ {
struct wl_seat *seat = container_of(grab, struct wl_seat, drag_grab); struct weston_seat *seat =
container_of(grab, struct weston_seat, drag_grab);
enum wl_pointer_button_state state = state_w; enum wl_pointer_button_state state = state_w;
if (seat->drag_focus_resource && if (seat->drag_focus_resource &&
@ -268,8 +271,8 @@ static const struct weston_pointer_grab_interface drag_grab_interface = {
static void static void
destroy_data_device_source(struct wl_listener *listener, void *data) destroy_data_device_source(struct wl_listener *listener, void *data)
{ {
struct wl_seat *seat = container_of(listener, struct wl_seat, struct weston_seat *seat = container_of(listener, struct weston_seat,
drag_data_source_listener); drag_data_source_listener);
data_device_end_drag_grab(seat); data_device_end_drag_grab(seat);
} }
@ -277,10 +280,10 @@ destroy_data_device_source(struct wl_listener *listener, void *data)
static void static void
destroy_data_device_icon(struct wl_listener *listener, void *data) destroy_data_device_icon(struct wl_listener *listener, void *data)
{ {
struct wl_seat *seat = container_of(listener, struct wl_seat, struct weston_seat *seat = container_of(listener, struct weston_seat,
drag_icon_listener); drag_icon_listener);
seat->drag_surface = NULL; seat->next_drag_surface = NULL;
} }
static void static void
@ -289,7 +292,7 @@ data_device_start_drag(struct wl_client *client, struct wl_resource *resource,
struct wl_resource *origin_resource, struct wl_resource *origin_resource,
struct wl_resource *icon_resource, uint32_t serial) struct wl_resource *icon_resource, uint32_t serial)
{ {
struct wl_seat *seat = resource->data; struct weston_seat *seat = resource->data;
/* FIXME: Check that client has implicit grab on the origin /* FIXME: Check that client has implicit grab on the origin
* surface that matches the given time. */ * surface that matches the given time. */
@ -310,7 +313,7 @@ data_device_start_drag(struct wl_client *client, struct wl_resource *resource,
} }
if (icon_resource) { if (icon_resource) {
seat->drag_surface = icon_resource->data; seat->next_drag_surface = icon_resource->data;
seat->drag_icon_listener.notify = destroy_data_device_icon; seat->drag_icon_listener.notify = destroy_data_device_icon;
wl_signal_add(&icon_resource->destroy_signal, wl_signal_add(&icon_resource->destroy_signal,
&seat->drag_icon_listener); &seat->drag_icon_listener);
@ -325,8 +328,8 @@ data_device_start_drag(struct wl_client *client, struct wl_resource *resource,
static void static void
destroy_selection_data_source(struct wl_listener *listener, void *data) destroy_selection_data_source(struct wl_listener *listener, void *data)
{ {
struct wl_seat *seat = container_of(listener, struct wl_seat, struct weston_seat *seat = container_of(listener, struct weston_seat,
selection_data_source_listener); selection_data_source_listener);
struct wl_resource *data_device; struct wl_resource *data_device;
struct wl_resource *focus = NULL; struct wl_resource *focus = NULL;
@ -345,8 +348,8 @@ destroy_selection_data_source(struct wl_listener *listener, void *data)
} }
WL_EXPORT void WL_EXPORT void
wl_seat_set_selection(struct wl_seat *seat, struct wl_data_source *source, weston_seat_set_selection(struct weston_seat *seat,
uint32_t serial) struct wl_data_source *source, uint32_t serial)
{ {
struct wl_resource *data_device, *offer; struct wl_resource *data_device, *offer;
struct wl_resource *focus = NULL; struct wl_resource *focus = NULL;
@ -397,8 +400,8 @@ data_device_set_selection(struct wl_client *client,
return; return;
/* FIXME: Store serial and check against incoming serial here. */ /* FIXME: Store serial and check against incoming serial here. */
wl_seat_set_selection(resource->data, source_resource->data, weston_seat_set_selection(resource->data, source_resource->data,
serial); serial);
} }
static const struct wl_data_device_interface data_device_interface = { static const struct wl_data_device_interface data_device_interface = {
@ -477,7 +480,7 @@ get_data_device(struct wl_client *client,
struct wl_resource *manager_resource, struct wl_resource *manager_resource,
uint32_t id, struct wl_resource *seat_resource) uint32_t id, struct wl_resource *seat_resource)
{ {
struct wl_seat *seat = seat_resource->data; struct weston_seat *seat = seat_resource->data;
struct wl_resource *resource; struct wl_resource *resource;
resource = wl_client_add_object(client, &wl_data_device_interface, resource = wl_client_add_object(client, &wl_data_device_interface,
@ -502,7 +505,7 @@ bind_manager(struct wl_client *client,
} }
WL_EXPORT void WL_EXPORT void
wl_data_device_set_keyboard_focus(struct wl_seat *seat) wl_data_device_set_keyboard_focus(struct weston_seat *seat)
{ {
struct wl_resource *data_device, *focus, *offer; struct wl_resource *data_device, *focus, *offer;
struct wl_data_source *source; struct wl_data_source *source;

@ -618,7 +618,7 @@ evdev_notify_keyboard_focus(struct weston_seat *seat,
uint32_t *k; uint32_t *k;
int ret; int ret;
if (!seat->seat.keyboard) if (!seat->keyboard)
return; return;
memset(all_keys, 0, sizeof all_keys); memset(all_keys, 0, sizeof all_keys);

@ -1860,7 +1860,7 @@ compile_shaders(struct weston_compositor *ec)
} }
static void static void
fragment_debug_binding(struct wl_seat *seat, uint32_t time, uint32_t key, fragment_debug_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
void *data) void *data)
{ {
struct weston_compositor *ec = data; struct weston_compositor *ec = data;

@ -48,7 +48,7 @@ weston_seat_repick(struct weston_seat *seat)
{ {
const struct weston_pointer_grab_interface *interface; const struct weston_pointer_grab_interface *interface;
struct weston_surface *surface, *focus; struct weston_surface *surface, *focus;
struct weston_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->pointer;
if (!pointer) if (!pointer)
return; return;
@ -357,7 +357,7 @@ weston_touch_release(struct weston_touch *touch)
} }
static void static void
seat_send_updated_caps(struct wl_seat *seat) seat_send_updated_caps(struct weston_seat *seat)
{ {
struct wl_resource *r; struct wl_resource *r;
enum wl_seat_capability caps = 0; enum wl_seat_capability caps = 0;
@ -374,7 +374,8 @@ seat_send_updated_caps(struct wl_seat *seat)
} }
WL_EXPORT void WL_EXPORT void
wl_seat_set_pointer(struct wl_seat *seat, struct weston_pointer *pointer) weston_seat_set_pointer(struct weston_seat *seat,
struct weston_pointer *pointer)
{ {
if (pointer && (seat->pointer || pointer->seat)) if (pointer && (seat->pointer || pointer->seat))
return; /* XXX: error? */ return; /* XXX: error? */
@ -389,7 +390,8 @@ wl_seat_set_pointer(struct wl_seat *seat, struct weston_pointer *pointer)
} }
WL_EXPORT void WL_EXPORT void
wl_seat_set_keyboard(struct wl_seat *seat, struct weston_keyboard *keyboard) weston_seat_set_keyboard(struct weston_seat *seat,
struct weston_keyboard *keyboard)
{ {
if (keyboard && (seat->keyboard || keyboard->seat)) if (keyboard && (seat->keyboard || keyboard->seat))
return; /* XXX: error? */ return; /* XXX: error? */
@ -404,7 +406,7 @@ wl_seat_set_keyboard(struct wl_seat *seat, struct weston_keyboard *keyboard)
} }
WL_EXPORT void WL_EXPORT void
wl_seat_set_touch(struct wl_seat *seat, struct weston_touch *touch) weston_seat_set_touch(struct weston_seat *seat, struct weston_touch *touch)
{ {
if (touch && (seat->touch || touch->seat)) if (touch && (seat->touch || touch->seat))
return; /* XXX: error? */ return; /* XXX: error? */
@ -603,8 +605,8 @@ clip_pointer_motion(struct weston_seat *seat, wl_fixed_t *fx, wl_fixed_t *fy)
x = wl_fixed_to_int(*fx); x = wl_fixed_to_int(*fx);
y = wl_fixed_to_int(*fy); y = wl_fixed_to_int(*fy);
old_x = wl_fixed_to_int(seat->seat.pointer->x); old_x = wl_fixed_to_int(seat->pointer->x);
old_y = wl_fixed_to_int(seat->seat.pointer->y); old_y = wl_fixed_to_int(seat->pointer->y);
wl_list_for_each(output, &ec->output_list, link) { wl_list_for_each(output, &ec->output_list, link) {
if (pixman_region32_contains_point(&output->region, if (pixman_region32_contains_point(&output->region,
@ -634,7 +636,7 @@ static void
move_pointer(struct weston_seat *seat, wl_fixed_t x, wl_fixed_t y) move_pointer(struct weston_seat *seat, wl_fixed_t x, wl_fixed_t y)
{ {
struct weston_compositor *ec = seat->compositor; struct weston_compositor *ec = seat->compositor;
struct weston_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->pointer;
struct weston_output *output; struct weston_output *output;
int32_t ix, iy; int32_t ix, iy;
@ -670,7 +672,7 @@ notify_motion(struct weston_seat *seat,
{ {
const struct weston_pointer_grab_interface *interface; const struct weston_pointer_grab_interface *interface;
struct weston_compositor *ec = seat->compositor; struct weston_compositor *ec = seat->compositor;
struct weston_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->pointer;
weston_compositor_wake(ec); weston_compositor_wake(ec);
@ -687,7 +689,7 @@ notify_motion_absolute(struct weston_seat *seat,
{ {
const struct weston_pointer_grab_interface *interface; const struct weston_pointer_grab_interface *interface;
struct weston_compositor *ec = seat->compositor; struct weston_compositor *ec = seat->compositor;
struct weston_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->pointer;
weston_compositor_wake(ec); weston_compositor_wake(ec);
@ -704,9 +706,9 @@ weston_surface_activate(struct weston_surface *surface,
{ {
struct weston_compositor *compositor = seat->compositor; struct weston_compositor *compositor = seat->compositor;
if (seat->seat.keyboard) { if (seat->keyboard) {
weston_keyboard_set_focus(seat->seat.keyboard, &surface->surface); weston_keyboard_set_focus(seat->keyboard, &surface->surface);
wl_data_device_set_keyboard_focus(&seat->seat); wl_data_device_set_keyboard_focus(seat);
} }
wl_signal_emit(&compositor->activate_signal, surface); wl_signal_emit(&compositor->activate_signal, surface);
@ -717,7 +719,7 @@ notify_button(struct weston_seat *seat, uint32_t time, int32_t button,
enum wl_pointer_button_state state) enum wl_pointer_button_state state)
{ {
struct weston_compositor *compositor = seat->compositor; struct weston_compositor *compositor = seat->compositor;
struct weston_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->pointer;
struct weston_surface *focus = struct weston_surface *focus =
(struct weston_surface *) pointer->focus; (struct weston_surface *) pointer->focus;
uint32_t serial = wl_display_next_serial(compositor->wl_display); uint32_t serial = wl_display_next_serial(compositor->wl_display);
@ -753,7 +755,7 @@ notify_axis(struct weston_seat *seat, uint32_t time, uint32_t axis,
wl_fixed_t value) wl_fixed_t value)
{ {
struct weston_compositor *compositor = seat->compositor; struct weston_compositor *compositor = seat->compositor;
struct weston_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->pointer;
struct weston_surface *focus = struct weston_surface *focus =
(struct weston_surface *) pointer->focus; (struct weston_surface *) pointer->focus;
uint32_t serial = wl_display_next_serial(compositor->wl_display); uint32_t serial = wl_display_next_serial(compositor->wl_display);
@ -778,7 +780,7 @@ notify_axis(struct weston_seat *seat, uint32_t time, uint32_t axis,
WL_EXPORT void WL_EXPORT void
notify_modifiers(struct weston_seat *seat, uint32_t serial) notify_modifiers(struct weston_seat *seat, uint32_t serial)
{ {
struct weston_keyboard *keyboard = &seat->keyboard; struct weston_keyboard *keyboard = seat->keyboard;
struct weston_keyboard_grab *grab = keyboard->grab; struct weston_keyboard_grab *grab = keyboard->grab;
uint32_t mods_depressed, mods_latched, mods_locked, group; uint32_t mods_depressed, mods_latched, mods_locked, group;
uint32_t mods_lookup; uint32_t mods_lookup;
@ -796,16 +798,16 @@ notify_modifiers(struct weston_seat *seat, uint32_t serial)
group = xkb_state_serialize_group(seat->xkb_state.state, group = xkb_state_serialize_group(seat->xkb_state.state,
XKB_STATE_EFFECTIVE); XKB_STATE_EFFECTIVE);
if (mods_depressed != seat->seat.keyboard->modifiers.mods_depressed || if (mods_depressed != seat->keyboard->modifiers.mods_depressed ||
mods_latched != seat->seat.keyboard->modifiers.mods_latched || mods_latched != seat->keyboard->modifiers.mods_latched ||
mods_locked != seat->seat.keyboard->modifiers.mods_locked || mods_locked != seat->keyboard->modifiers.mods_locked ||
group != seat->seat.keyboard->modifiers.group) group != seat->keyboard->modifiers.group)
changed = 1; changed = 1;
seat->seat.keyboard->modifiers.mods_depressed = mods_depressed; seat->keyboard->modifiers.mods_depressed = mods_depressed;
seat->seat.keyboard->modifiers.mods_latched = mods_latched; seat->keyboard->modifiers.mods_latched = mods_latched;
seat->seat.keyboard->modifiers.mods_locked = mods_locked; seat->keyboard->modifiers.mods_locked = mods_locked;
seat->seat.keyboard->modifiers.group = group; seat->keyboard->modifiers.group = group;
/* And update the modifier_state for bindings. */ /* And update the modifier_state for bindings. */
mods_lookup = mods_depressed | mods_latched; mods_lookup = mods_depressed | mods_latched;
@ -867,7 +869,7 @@ notify_key(struct weston_seat *seat, uint32_t time, uint32_t key,
enum weston_key_state_update update_state) enum weston_key_state_update update_state)
{ {
struct weston_compositor *compositor = seat->compositor; struct weston_compositor *compositor = seat->compositor;
struct weston_keyboard *keyboard = &seat->keyboard; struct weston_keyboard *keyboard = seat->keyboard;
struct weston_surface *focus = struct weston_surface *focus =
(struct weston_surface *) keyboard->focus; (struct weston_surface *) keyboard->focus;
struct weston_keyboard_grab *grab = keyboard->grab; struct weston_keyboard_grab *grab = keyboard->grab;
@ -949,7 +951,7 @@ notify_keyboard_focus_in(struct weston_seat *seat, struct wl_array *keys,
enum weston_key_state_update update_state) enum weston_key_state_update update_state)
{ {
struct weston_compositor *compositor = seat->compositor; struct weston_compositor *compositor = seat->compositor;
struct weston_keyboard *keyboard = seat->seat.keyboard; struct weston_keyboard *keyboard = seat->keyboard;
struct wl_surface *surface; struct wl_surface *surface;
uint32_t *k, serial; uint32_t *k, serial;
@ -981,7 +983,7 @@ WL_EXPORT void
notify_keyboard_focus_out(struct weston_seat *seat) notify_keyboard_focus_out(struct weston_seat *seat)
{ {
struct weston_compositor *compositor = seat->compositor; struct weston_compositor *compositor = seat->compositor;
struct weston_keyboard *keyboard = seat->seat.keyboard; struct weston_keyboard *keyboard = seat->keyboard;
uint32_t *k, serial; uint32_t *k, serial;
serial = wl_display_next_serial(compositor->wl_display); serial = wl_display_next_serial(compositor->wl_display);
@ -1009,9 +1011,8 @@ notify_keyboard_focus_out(struct weston_seat *seat)
} }
static void static void
touch_set_focus(struct weston_seat *ws, struct wl_surface *surface) touch_set_focus(struct weston_seat *seat, struct wl_surface *surface)
{ {
struct wl_seat *seat = &ws->seat;
struct wl_resource *resource; struct wl_resource *resource;
if (seat->touch->focus == surface) if (seat->touch->focus == surface)
@ -1051,7 +1052,7 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
wl_fixed_t x, wl_fixed_t y, int touch_type) wl_fixed_t x, wl_fixed_t y, int touch_type)
{ {
struct weston_compositor *ec = seat->compositor; struct weston_compositor *ec = seat->compositor;
struct weston_touch *touch = seat->seat.touch; struct weston_touch *touch = seat->touch;
struct weston_touch_grab *grab = touch->grab; struct weston_touch_grab *grab = touch->grab;
struct weston_surface *es; struct weston_surface *es;
wl_fixed_t sx, sy; wl_fixed_t sx, sy;
@ -1129,8 +1130,8 @@ pointer_cursor_surface_configure(struct weston_surface *es,
seat->hotspot_x -= dx; seat->hotspot_x -= dx;
seat->hotspot_y -= dy; seat->hotspot_y -= dy;
x = wl_fixed_to_int(seat->seat.pointer->x) - seat->hotspot_x; x = wl_fixed_to_int(seat->pointer->x) - seat->hotspot_x;
y = wl_fixed_to_int(seat->seat.pointer->y) - seat->hotspot_y; y = wl_fixed_to_int(seat->pointer->y) - seat->hotspot_y;
weston_surface_configure(seat->sprite, x, y, weston_surface_configure(seat->sprite, x, y,
width, height); width, height);
@ -1167,11 +1168,11 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource,
if (surface_resource) if (surface_resource)
surface = surface_resource->data; surface = surface_resource->data;
if (seat->seat.pointer->focus == NULL) if (seat->pointer->focus == NULL)
return; return;
if (seat->seat.pointer->focus->resource.client != client) if (seat->pointer->focus->resource.client != client)
return; return;
if (seat->seat.pointer->focus_serial - serial > UINT32_MAX / 2) if (seat->pointer->focus_serial - serial > UINT32_MAX / 2)
return; return;
if (surface && surface != seat->sprite) { if (surface && surface != seat->sprite) {
@ -1226,27 +1227,27 @@ seat_get_pointer(struct wl_client *client, struct wl_resource *resource,
struct weston_seat *seat = resource->data; struct weston_seat *seat = resource->data;
struct wl_resource *cr; struct wl_resource *cr;
if (!seat->seat.pointer) if (!seat->pointer)
return; return;
cr = wl_client_add_object(client, &wl_pointer_interface, cr = wl_client_add_object(client, &wl_pointer_interface,
&pointer_interface, id, seat); &pointer_interface, id, seat);
wl_list_insert(&seat->seat.pointer->resource_list, &cr->link); wl_list_insert(&seat->pointer->resource_list, &cr->link);
cr->destroy = unbind_resource; cr->destroy = unbind_resource;
if (seat->seat.pointer->focus && if (seat->pointer->focus &&
seat->seat.pointer->focus->resource.client == client) { seat->pointer->focus->resource.client == client) {
struct weston_surface *surface; struct weston_surface *surface;
wl_fixed_t sx, sy; wl_fixed_t sx, sy;
surface = (struct weston_surface *) seat->seat.pointer->focus; surface = (struct weston_surface *) seat->pointer->focus;
weston_surface_from_global_fixed(surface, weston_surface_from_global_fixed(surface,
seat->seat.pointer->x, seat->pointer->x,
seat->seat.pointer->y, seat->pointer->y,
&sx, &sx,
&sy); &sy);
weston_pointer_set_focus(seat->seat.pointer, weston_pointer_set_focus(seat->pointer,
seat->seat.pointer->focus, seat->pointer->focus,
sx, sx,
sy); sy);
} }
@ -1259,23 +1260,23 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource,
struct weston_seat *seat = resource->data; struct weston_seat *seat = resource->data;
struct wl_resource *cr; struct wl_resource *cr;
if (!seat->seat.keyboard) if (!seat->keyboard)
return; return;
cr = wl_client_add_object(client, &wl_keyboard_interface, NULL, id, cr = wl_client_add_object(client, &wl_keyboard_interface, NULL, id,
seat); seat);
wl_list_insert(&seat->seat.keyboard->resource_list, &cr->link); wl_list_insert(&seat->keyboard->resource_list, &cr->link);
cr->destroy = unbind_resource; cr->destroy = unbind_resource;
wl_keyboard_send_keymap(cr, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, wl_keyboard_send_keymap(cr, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
seat->xkb_info.keymap_fd, seat->xkb_info.keymap_fd,
seat->xkb_info.keymap_size); seat->xkb_info.keymap_size);
if (seat->seat.keyboard->focus && if (seat->keyboard->focus &&
seat->seat.keyboard->focus->resource.client == client) { seat->keyboard->focus->resource.client == client) {
weston_keyboard_set_focus(seat->seat.keyboard, weston_keyboard_set_focus(seat->keyboard,
seat->seat.keyboard->focus); seat->keyboard->focus);
wl_data_device_set_keyboard_focus(&seat->seat); wl_data_device_set_keyboard_focus(seat);
} }
} }
@ -1286,11 +1287,11 @@ seat_get_touch(struct wl_client *client, struct wl_resource *resource,
struct weston_seat *seat = resource->data; struct weston_seat *seat = resource->data;
struct wl_resource *cr; struct wl_resource *cr;
if (!seat->seat.touch) if (!seat->touch)
return; return;
cr = wl_client_add_object(client, &wl_touch_interface, NULL, id, seat); cr = wl_client_add_object(client, &wl_touch_interface, NULL, id, seat);
wl_list_insert(&seat->seat.touch->resource_list, &cr->link); wl_list_insert(&seat->touch->resource_list, &cr->link);
cr->destroy = unbind_resource; cr->destroy = unbind_resource;
} }
@ -1303,7 +1304,7 @@ static const struct wl_seat_interface seat_interface = {
static void static void
bind_seat(struct wl_client *client, void *data, uint32_t version, uint32_t id) bind_seat(struct wl_client *client, void *data, uint32_t version, uint32_t id)
{ {
struct wl_seat *seat = data; struct weston_seat *seat = data;
struct wl_resource *resource; struct wl_resource *resource;
enum wl_seat_capability caps = 0; enum wl_seat_capability caps = 0;
@ -1492,8 +1493,8 @@ weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap)
seat->xkb_state.leds = 0; seat->xkb_state.leds = 0;
weston_keyboard_init(&seat->keyboard); weston_keyboard_init(&seat->keyboard_instance);
wl_seat_set_keyboard(&seat->seat, &seat->keyboard); weston_seat_set_keyboard(seat, &seat->keyboard_instance);
seat->has_keyboard = 1; seat->has_keyboard = 1;
@ -1506,8 +1507,8 @@ weston_seat_init_pointer(struct weston_seat *seat)
if (seat->has_pointer) if (seat->has_pointer)
return; return;
weston_pointer_init(&seat->pointer); weston_pointer_init(&seat->pointer_instance);
wl_seat_set_pointer(&seat->seat, &seat->pointer); weston_seat_set_pointer(seat, &seat->pointer_instance);
seat->has_pointer = 1; seat->has_pointer = 1;
} }
@ -1518,8 +1519,8 @@ weston_seat_init_touch(struct weston_seat *seat)
if (seat->has_touch) if (seat->has_touch)
return; return;
weston_touch_init(&seat->touch); weston_touch_init(&seat->touch_instance);
wl_seat_set_touch(&seat->seat, &seat->touch); weston_seat_set_touch(seat, &seat->touch_instance);
seat->has_touch = 1; seat->has_touch = 1;
} }
@ -1529,11 +1530,12 @@ weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec)
{ {
memset(seat, 0, sizeof *seat); memset(seat, 0, sizeof *seat);
seat->seat.selection_data_source = NULL; seat->selection_data_source = NULL;
wl_list_init(&seat->seat.base_resource_list); wl_list_init(&seat->base_resource_list);
wl_signal_init(&seat->seat.selection_signal); wl_signal_init(&seat->selection_signal);
wl_list_init(&seat->seat.drag_resource_list); wl_list_init(&seat->drag_resource_list);
wl_signal_init(&seat->seat.drag_icon_signal); wl_signal_init(&seat->drag_icon_signal);
wl_signal_init(&seat->destroy_signal);
seat->has_pointer = 0; seat->has_pointer = 0;
seat->has_keyboard = 0; seat->has_keyboard = 0;
@ -1557,12 +1559,11 @@ weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec)
wl_list_insert(ec->seat_list.prev, &seat->link); wl_list_insert(ec->seat_list.prev, &seat->link);
seat->new_drag_icon_listener.notify = device_handle_new_drag_icon; seat->new_drag_icon_listener.notify = device_handle_new_drag_icon;
wl_signal_add(&seat->seat.drag_icon_signal, wl_signal_add(&seat->drag_icon_signal,
&seat->new_drag_icon_listener); &seat->new_drag_icon_listener);
clipboard_create(seat); clipboard_create(seat);
wl_signal_init(&seat->destroy_signal);
wl_signal_emit(&ec->seat_created_signal, seat); wl_signal_emit(&ec->seat_created_signal, seat);
} }
@ -1579,12 +1580,12 @@ weston_seat_release(struct weston_seat *seat)
xkb_state_unref(seat->xkb_state.state); xkb_state_unref(seat->xkb_state.state);
xkb_info_destroy(&seat->xkb_info); xkb_info_destroy(&seat->xkb_info);
if (seat->seat.pointer) if (seat->pointer)
weston_pointer_release(seat->seat.pointer); weston_pointer_release(seat->pointer);
if (seat->seat.keyboard) if (seat->keyboard)
weston_keyboard_release(seat->seat.keyboard); weston_keyboard_release(seat->keyboard);
if (seat->seat.touch) if (seat->touch)
weston_touch_release(seat->seat.touch); weston_touch_release(seat->touch);
wl_signal_emit(&seat->destroy_signal, seat); wl_signal_emit(&seat->destroy_signal, seat);
} }
@ -1600,11 +1601,9 @@ drag_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy, int32_
} }
static int static int
device_setup_new_drag_surface(struct weston_seat *ws, device_setup_new_drag_surface(struct weston_seat *seat,
struct weston_surface *surface) struct weston_surface *surface)
{ {
struct wl_seat *seat = &ws->seat;
if (surface->configure) { if (surface->configure) {
wl_resource_post_error(&surface->surface.resource, wl_resource_post_error(&surface->surface.resource,
WL_DISPLAY_ERROR_INVALID_OBJECT, WL_DISPLAY_ERROR_INVALID_OBJECT,
@ -1612,16 +1611,16 @@ device_setup_new_drag_surface(struct weston_seat *ws,
return 0; return 0;
} }
ws->drag_surface = surface; seat->drag_surface = surface;
weston_surface_set_position(ws->drag_surface, weston_surface_set_position(seat->drag_surface,
wl_fixed_to_double(seat->pointer->x), wl_fixed_to_double(seat->pointer->x),
wl_fixed_to_double(seat->pointer->y)); wl_fixed_to_double(seat->pointer->y));
surface->configure = drag_surface_configure; surface->configure = drag_surface_configure;
wl_signal_add(&surface->surface.resource.destroy_signal, wl_signal_add(&surface->surface.resource.destroy_signal,
&ws->drag_surface_destroy_listener); &seat->drag_surface_destroy_listener);
return 1; return 1;
} }
@ -1658,29 +1657,28 @@ device_map_drag_surface(struct weston_seat *seat)
} }
static void static void
weston_seat_update_drag_surface(struct weston_seat *seat, weston_seat_update_drag_surface(struct weston_seat *seat, int dx, int dy)
int dx, int dy)
{ {
int surface_changed = 0; int surface_changed = 0;
if (!seat->drag_surface && !seat->seat.drag_surface) if (!seat->drag_surface && !seat->drag_surface)
return; return;
if (seat->drag_surface && seat->seat.drag_surface && if (seat->drag_surface && seat->drag_surface &&
(&seat->drag_surface->surface.resource != (&seat->drag_surface->surface.resource !=
&seat->seat.drag_surface->resource)) &seat->next_drag_surface->resource))
/* between calls to this funcion we got a new drag_surface */ /* between calls to this funcion we got a new drag_surface */
surface_changed = 1; surface_changed = 1;
if (!seat->seat.drag_surface || surface_changed) { if (!seat->drag_surface || surface_changed) {
device_release_drag_surface(seat); device_release_drag_surface(seat);
if (!surface_changed) if (!surface_changed)
return; return;
} }
if (!seat->drag_surface || surface_changed) { if (!seat->drag_surface || surface_changed) {
struct weston_surface *surface = (struct weston_surface *) struct weston_surface *surface =
seat->seat.drag_surface; (struct weston_surface *) seat->drag_surface;
if (!device_setup_new_drag_surface(seat, surface)) if (!device_setup_new_drag_surface(seat, surface))
return; return;
} }

@ -456,7 +456,7 @@ pixman_renderer_destroy(struct weston_compositor *ec)
} }
static void static void
debug_binding(struct wl_seat *seat, uint32_t time, uint32_t key, debug_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
void *data) void *data)
{ {
struct weston_compositor *ec = data; struct weston_compositor *ec = data;

@ -203,7 +203,7 @@ screenshooter_sigchld(struct weston_process *process, int status)
} }
static void static void
screenshooter_binding(struct wl_seat *seat, uint32_t time, uint32_t key, screenshooter_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
void *data) void *data)
{ {
struct screenshooter *shooter = data; struct screenshooter *shooter = data;
@ -452,7 +452,7 @@ weston_recorder_destroy(struct weston_recorder *recorder)
} }
static void static void
recorder_binding(struct wl_seat *seat, uint32_t time, uint32_t key, void *data) recorder_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data)
{ {
struct weston_seat *ws = (struct weston_seat *) seat; struct weston_seat *ws = (struct weston_seat *) seat;
struct weston_compositor *ec = ws->compositor; struct weston_compositor *ec = ws->compositor;

@ -273,7 +273,7 @@ static struct desktop_shell *
shell_surface_get_shell(struct shell_surface *shsurf); shell_surface_get_shell(struct shell_surface *shsurf);
static void static void
surface_rotate(struct shell_surface *surface, struct wl_seat *seat); surface_rotate(struct shell_surface *surface, struct weston_seat *seat);
static bool static bool
shell_surface_is_top_fullscreen(struct shell_surface *shsurf) shell_surface_is_top_fullscreen(struct shell_surface *shsurf)
@ -504,7 +504,7 @@ restore_focus_state(struct desktop_shell *shell, struct workspace *ws)
surface = state->keyboard_focus ? surface = state->keyboard_focus ?
&state->keyboard_focus->surface : NULL; &state->keyboard_focus->surface : NULL;
weston_keyboard_set_focus(state->seat->seat.keyboard, surface); weston_keyboard_set_focus(state->seat->keyboard, surface);
} }
} }
@ -517,7 +517,7 @@ replace_focus_state(struct desktop_shell *shell, struct workspace *ws,
wl_list_for_each(state, &ws->focus_list, link) { wl_list_for_each(state, &ws->focus_list, link) {
if (state->seat == seat) { if (state->seat == seat) {
surface = seat->seat.keyboard->focus; surface = seat->keyboard->focus;
state->keyboard_focus = state->keyboard_focus =
(struct weston_surface *) surface; (struct weston_surface *) surface;
return; return;
@ -901,20 +901,19 @@ move_surface_to_workspace(struct desktop_shell *shell,
drop_focus_state(shell, from, surface); drop_focus_state(shell, from, surface);
wl_list_for_each(seat, &shell->compositor->seat_list, link) wl_list_for_each(seat, &shell->compositor->seat_list, link)
if (seat->has_keyboard && if (seat->has_keyboard &&
seat->keyboard.focus == &surface->surface) seat->keyboard->focus == &surface->surface)
weston_keyboard_set_focus(&seat->keyboard, NULL); weston_keyboard_set_focus(seat->keyboard, NULL);
weston_surface_damage_below(surface); weston_surface_damage_below(surface);
} }
static void static void
take_surface_to_workspace_by_seat(struct desktop_shell *shell, take_surface_to_workspace_by_seat(struct desktop_shell *shell,
struct wl_seat *wl_seat, struct weston_seat *seat,
unsigned int index) unsigned int index)
{ {
struct weston_seat *seat = (struct weston_seat *) wl_seat;
struct weston_surface *surface = struct weston_surface *surface =
(struct weston_surface *) wl_seat->keyboard->focus; (struct weston_surface *) seat->keyboard->focus;
struct shell_surface *shsurf; struct shell_surface *shsurf;
struct workspace *from; struct workspace *from;
struct workspace *to; struct workspace *to;
@ -1068,7 +1067,7 @@ static const struct weston_pointer_grab_interface move_grab_interface = {
}; };
static int static int
surface_move(struct shell_surface *shsurf, struct weston_seat *ws) surface_move(struct shell_surface *shsurf, struct weston_seat *seat)
{ {
struct weston_move_grab *move; struct weston_move_grab *move;
@ -1083,12 +1082,12 @@ surface_move(struct shell_surface *shsurf, struct weston_seat *ws)
return -1; return -1;
move->dx = wl_fixed_from_double(shsurf->surface->geometry.x) - move->dx = wl_fixed_from_double(shsurf->surface->geometry.x) -
ws->seat.pointer->grab_x; seat->pointer->grab_x;
move->dy = wl_fixed_from_double(shsurf->surface->geometry.y) - move->dy = wl_fixed_from_double(shsurf->surface->geometry.y) -
ws->seat.pointer->grab_y; seat->pointer->grab_y;
shell_grab_start(&move->base, &move_grab_interface, shsurf, shell_grab_start(&move->base, &move_grab_interface, shsurf,
ws->seat.pointer, DESKTOP_SHELL_CURSOR_MOVE); seat->pointer, DESKTOP_SHELL_CURSOR_MOVE);
return 0; return 0;
} }
@ -1097,15 +1096,15 @@ static void
shell_surface_move(struct wl_client *client, struct wl_resource *resource, shell_surface_move(struct wl_client *client, struct wl_resource *resource,
struct wl_resource *seat_resource, uint32_t serial) struct wl_resource *seat_resource, uint32_t serial)
{ {
struct weston_seat *ws = seat_resource->data; struct weston_seat *seat = seat_resource->data;
struct shell_surface *shsurf = resource->data; struct shell_surface *shsurf = resource->data;
if (ws->seat.pointer->button_count == 0 || if (seat->pointer->button_count == 0 ||
ws->seat.pointer->grab_serial != serial || seat->pointer->grab_serial != serial ||
ws->seat.pointer->focus != &shsurf->surface->surface) seat->pointer->focus != &shsurf->surface->surface)
return; return;
if (surface_move(shsurf, ws) < 0) if (surface_move(shsurf, seat) < 0)
wl_resource_post_no_memory(resource); wl_resource_post_no_memory(resource);
} }
@ -1190,7 +1189,7 @@ static const struct weston_pointer_grab_interface resize_grab_interface = {
static int static int
surface_resize(struct shell_surface *shsurf, surface_resize(struct shell_surface *shsurf,
struct weston_seat *ws, uint32_t edges) struct weston_seat *seat, uint32_t edges)
{ {
struct weston_resize_grab *resize; struct weston_resize_grab *resize;
@ -1211,7 +1210,7 @@ surface_resize(struct shell_surface *shsurf,
resize->height = shsurf->surface->geometry.height; resize->height = shsurf->surface->geometry.height;
shell_grab_start(&resize->base, &resize_grab_interface, shsurf, shell_grab_start(&resize->base, &resize_grab_interface, shsurf,
ws->seat.pointer, edges); seat->pointer, edges);
return 0; return 0;
} }
@ -1221,18 +1220,18 @@ shell_surface_resize(struct wl_client *client, struct wl_resource *resource,
struct wl_resource *seat_resource, uint32_t serial, struct wl_resource *seat_resource, uint32_t serial,
uint32_t edges) uint32_t edges)
{ {
struct weston_seat *ws = seat_resource->data; struct weston_seat *seat = seat_resource->data;
struct shell_surface *shsurf = resource->data; struct shell_surface *shsurf = resource->data;
if (shsurf->type == SHELL_SURFACE_FULLSCREEN) if (shsurf->type == SHELL_SURFACE_FULLSCREEN)
return; return;
if (ws->seat.pointer->button_count == 0 || if (seat->pointer->button_count == 0 ||
ws->seat.pointer->grab_serial != serial || seat->pointer->grab_serial != serial ||
ws->seat.pointer->focus != &shsurf->surface->surface) seat->pointer->focus != &shsurf->surface->surface)
return; return;
if (surface_resize(shsurf, ws, edges) < 0) if (surface_resize(shsurf, seat, edges) < 0)
wl_resource_post_no_memory(resource); wl_resource_post_no_memory(resource);
} }
@ -1262,8 +1261,7 @@ busy_cursor_grab_button(struct weston_pointer_grab *base,
struct shell_surface *shsurf; struct shell_surface *shsurf;
struct weston_surface *surface = struct weston_surface *surface =
(struct weston_surface *) grab->grab.pointer->current; (struct weston_surface *) grab->grab.pointer->current;
struct weston_seat *seat = struct weston_seat *seat = grab->grab.pointer->seat;
(struct weston_seat *) grab->grab.pointer->seat;
shsurf = get_shell_surface(surface); shsurf = get_shell_surface(surface);
if (shsurf && button == BTN_LEFT && state) { if (shsurf && button == BTN_LEFT && state) {
@ -1271,7 +1269,7 @@ busy_cursor_grab_button(struct weston_pointer_grab *base,
surface_move(shsurf, seat); surface_move(shsurf, seat);
} else if (shsurf && button == BTN_RIGHT && state) { } else if (shsurf && button == BTN_RIGHT && state) {
activate(shsurf->shell, shsurf->surface, seat); activate(shsurf->shell, shsurf->surface, seat);
surface_rotate(shsurf, &seat->seat); surface_rotate(shsurf, seat);
} }
} }
@ -1328,8 +1326,8 @@ ping_timeout_handler(void *data)
shsurf->unresponsive = 1; shsurf->unresponsive = 1;
wl_list_for_each(seat, &shsurf->surface->compositor->seat_list, link) wl_list_for_each(seat, &shsurf->surface->compositor->seat_list, link)
if (seat->seat.pointer->focus == &shsurf->surface->surface) if (seat->pointer->focus == &shsurf->surface->surface)
set_busy_cursor(shsurf, seat->seat.pointer); set_busy_cursor(shsurf, seat->pointer);
return 1; return 1;
} }
@ -1393,12 +1391,12 @@ create_pointer_focus_listener(struct weston_seat *seat)
{ {
struct wl_listener *listener; struct wl_listener *listener;
if (!seat->seat.pointer) if (!seat->pointer)
return; return;
listener = malloc(sizeof *listener); listener = malloc(sizeof *listener);
listener->notify = handle_pointer_focus; listener->notify = handle_pointer_focus;
wl_signal_add(&seat->seat.pointer->focus_signal, listener); wl_signal_add(&seat->pointer->focus_signal, listener);
} }
static void static void
@ -1422,7 +1420,7 @@ shell_surface_pong(struct wl_client *client, struct wl_resource *resource,
if (was_unresponsive) { if (was_unresponsive) {
/* Received pong from previously unresponsive client */ /* Received pong from previously unresponsive client */
wl_list_for_each(seat, &ec->seat_list, link) { wl_list_for_each(seat, &ec->seat_list, link) {
pointer = seat->seat.pointer; pointer = seat->pointer;
if (pointer->focus == if (pointer->focus ==
&shell->grab_surface->surface && &shell->grab_surface->surface &&
pointer->current == pointer->current ==
@ -1969,7 +1967,7 @@ popup_grab_button(struct weston_pointer_grab *grab,
wl_pointer_send_button(resource, serial, time, button, state); wl_pointer_send_button(resource, serial, time, button, state);
} else if (state == WL_POINTER_BUTTON_STATE_RELEASED && } else if (state == WL_POINTER_BUTTON_STATE_RELEASED &&
(shseat->popup_grab.initial_up || (shseat->popup_grab.initial_up ||
time - shseat->seat->pointer.grab_time > 500)) { time - shseat->seat->pointer->grab_time > 500)) {
popup_grab_end(grab->pointer); popup_grab_end(grab->pointer);
} }
@ -2014,7 +2012,7 @@ popup_grab_end(struct weston_pointer *pointer)
static void static void
add_popup_grab(struct shell_surface *shsurf, struct shell_seat *shseat) add_popup_grab(struct shell_surface *shsurf, struct shell_seat *shseat)
{ {
struct wl_seat *seat = &shseat->seat->seat; struct weston_seat *seat = shseat->seat;
if (wl_list_empty(&shseat->popup_grab.surfaces_list)) { if (wl_list_empty(&shseat->popup_grab.surfaces_list)) {
shseat->popup_grab.client = shsurf->surface->surface.resource.client; shseat->popup_grab.client = shsurf->surface->surface.resource.client;
@ -2022,7 +2020,7 @@ add_popup_grab(struct shell_surface *shsurf, struct shell_seat *shseat)
/* We must make sure here that this popup was opened after /* We must make sure here that this popup was opened after
* a mouse press, and not just by moving around with other * a mouse press, and not just by moving around with other
* popups already open. */ * popups already open. */
if (shseat->seat->pointer.button_count > 0) if (shseat->seat->pointer->button_count > 0)
shseat->popup_grab.initial_up = 0; shseat->popup_grab.initial_up = 0;
weston_pointer_start_grab(seat->pointer, &shseat->popup_grab.grab); weston_pointer_start_grab(seat->pointer, &shseat->popup_grab.grab);
@ -2056,7 +2054,7 @@ shell_map_popup(struct shell_surface *shsurf)
weston_surface_set_position(es, shsurf->popup.x, shsurf->popup.y); weston_surface_set_position(es, shsurf->popup.x, shsurf->popup.y);
weston_surface_update_transform(es); weston_surface_update_transform(es);
if (shseat->seat->pointer.grab_serial == shsurf->popup.serial) { if (shseat->seat->pointer->grab_serial == shsurf->popup.serial) {
add_popup_grab(shsurf, shseat); add_popup_grab(shsurf, shseat);
} else { } else {
wl_shell_surface_send_popup_done(&shsurf->resource); wl_shell_surface_send_popup_done(&shsurf->resource);
@ -2518,7 +2516,7 @@ get_shell_surface_type(struct weston_surface *surface)
} }
static void static void
move_binding(struct wl_seat *seat, uint32_t time, uint32_t button, void *data) move_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data)
{ {
struct weston_surface *surface = struct weston_surface *surface =
(struct weston_surface *) seat->pointer->focus; (struct weston_surface *) seat->pointer->focus;
@ -2536,7 +2534,7 @@ move_binding(struct wl_seat *seat, uint32_t time, uint32_t button, void *data)
} }
static void static void
resize_binding(struct wl_seat *seat, uint32_t time, uint32_t button, void *data) resize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data)
{ {
struct weston_surface *surface = struct weston_surface *surface =
(struct weston_surface *) seat->pointer->focus; (struct weston_surface *) seat->pointer->focus;
@ -2575,7 +2573,7 @@ resize_binding(struct wl_seat *seat, uint32_t time, uint32_t button, void *data)
} }
static void static void
surface_opacity_binding(struct wl_seat *seat, uint32_t time, uint32_t axis, surface_opacity_binding(struct weston_seat *seat, uint32_t time, uint32_t axis,
wl_fixed_t value, void *data) wl_fixed_t value, void *data)
{ {
float step = 0.005; float step = 0.005;
@ -2602,7 +2600,7 @@ surface_opacity_binding(struct wl_seat *seat, uint32_t time, uint32_t axis,
} }
static void static void
do_zoom(struct wl_seat *seat, uint32_t time, uint32_t key, uint32_t axis, do_zoom(struct weston_seat *seat, uint32_t time, uint32_t key, uint32_t axis,
wl_fixed_t value) wl_fixed_t value)
{ {
struct weston_seat *ws = (struct weston_seat *) seat; struct weston_seat *ws = (struct weston_seat *) seat;
@ -2645,21 +2643,21 @@ do_zoom(struct wl_seat *seat, uint32_t time, uint32_t key, uint32_t axis,
} }
static void static void
zoom_axis_binding(struct wl_seat *seat, uint32_t time, uint32_t axis, zoom_axis_binding(struct weston_seat *seat, uint32_t time, uint32_t axis,
wl_fixed_t value, void *data) wl_fixed_t value, void *data)
{ {
do_zoom(seat, time, 0, axis, value); do_zoom(seat, time, 0, axis, value);
} }
static void static void
zoom_key_binding(struct wl_seat *seat, uint32_t time, uint32_t key, zoom_key_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
void *data) void *data)
{ {
do_zoom(seat, time, key, 0, 0); do_zoom(seat, time, key, 0, 0);
} }
static void static void
terminate_binding(struct wl_seat *seat, uint32_t time, uint32_t key, terminate_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
void *data) void *data)
{ {
struct weston_compositor *compositor = data; struct weston_compositor *compositor = data;
@ -2760,7 +2758,7 @@ static const struct weston_pointer_grab_interface rotate_grab_interface = {
}; };
static void static void
surface_rotate(struct shell_surface *surface, struct wl_seat *seat) surface_rotate(struct shell_surface *surface, struct weston_seat *seat)
{ {
struct rotate_grab *rotate; struct rotate_grab *rotate;
float dx, dy; float dx, dy;
@ -2797,7 +2795,7 @@ surface_rotate(struct shell_surface *surface, struct wl_seat *seat)
} }
static void static void
rotate_binding(struct wl_seat *seat, uint32_t time, uint32_t button, rotate_binding(struct weston_seat *seat, uint32_t time, uint32_t button,
void *data) void *data)
{ {
struct weston_surface *base_surface = struct weston_surface *base_surface =
@ -2877,7 +2875,7 @@ is_black_surface (struct weston_surface *es, struct weston_surface **fs_surface)
} }
static void static void
click_to_activate_binding(struct wl_seat *seat, uint32_t time, uint32_t button, click_to_activate_binding(struct weston_seat *seat, uint32_t time, uint32_t button,
void *data) void *data)
{ {
struct weston_seat *ws = (struct weston_seat *) seat; struct weston_seat *ws = (struct weston_seat *) seat;
@ -3130,8 +3128,8 @@ weston_surface_set_initial_position (struct weston_surface *surface,
*/ */
wl_list_for_each(seat, &compositor->seat_list, link) { wl_list_for_each(seat, &compositor->seat_list, link) {
if (seat->has_pointer) { if (seat->has_pointer) {
ix = wl_fixed_to_int(seat->pointer.x); ix = wl_fixed_to_int(seat->pointer->x);
iy = wl_fixed_to_int(seat->pointer.y); iy = wl_fixed_to_int(seat->pointer->y);
break; break;
} }
} }
@ -3851,7 +3849,7 @@ static const struct weston_keyboard_grab_interface switcher_grab = {
}; };
static void static void
switcher_binding(struct wl_seat *seat, uint32_t time, uint32_t key, switcher_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
void *data) void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
@ -3871,7 +3869,7 @@ switcher_binding(struct wl_seat *seat, uint32_t time, uint32_t key,
} }
static void static void
backlight_binding(struct wl_seat *seat, uint32_t time, uint32_t key, backlight_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
void *data) void *data)
{ {
struct weston_compositor *compositor = data; struct weston_compositor *compositor = data;
@ -3904,7 +3902,7 @@ backlight_binding(struct wl_seat *seat, uint32_t time, uint32_t key,
} }
static void static void
fan_debug_repaint_binding(struct wl_seat *seat, uint32_t time, uint32_t key, fan_debug_repaint_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
void *data) void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
@ -4017,7 +4015,7 @@ struct weston_keyboard_grab_interface debug_binding_keyboard_grab = {
}; };
static void static void
debug_binding(struct wl_seat *seat, uint32_t time, uint32_t key, void *data) debug_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data)
{ {
struct debug_binding_grab *grab; struct debug_binding_grab *grab;
@ -4032,7 +4030,7 @@ debug_binding(struct wl_seat *seat, uint32_t time, uint32_t key, void *data)
} }
static void static void
force_kill_binding(struct wl_seat *seat, uint32_t time, uint32_t key, force_kill_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
void *data) void *data)
{ {
struct wl_surface *focus_surface; struct wl_surface *focus_surface;
@ -4059,7 +4057,7 @@ force_kill_binding(struct wl_seat *seat, uint32_t time, uint32_t key,
} }
static void static void
workspace_up_binding(struct wl_seat *seat, uint32_t time, workspace_up_binding(struct weston_seat *seat, uint32_t time,
uint32_t key, void *data) uint32_t key, void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
@ -4074,7 +4072,7 @@ workspace_up_binding(struct wl_seat *seat, uint32_t time,
} }
static void static void
workspace_down_binding(struct wl_seat *seat, uint32_t time, workspace_down_binding(struct weston_seat *seat, uint32_t time,
uint32_t key, void *data) uint32_t key, void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
@ -4089,7 +4087,7 @@ workspace_down_binding(struct wl_seat *seat, uint32_t time,
} }
static void static void
workspace_f_binding(struct wl_seat *seat, uint32_t time, workspace_f_binding(struct weston_seat *seat, uint32_t time,
uint32_t key, void *data) uint32_t key, void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
@ -4105,7 +4103,7 @@ workspace_f_binding(struct wl_seat *seat, uint32_t time,
} }
static void static void
workspace_move_surface_up_binding(struct wl_seat *seat, uint32_t time, workspace_move_surface_up_binding(struct weston_seat *seat, uint32_t time,
uint32_t key, void *data) uint32_t key, void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
@ -4121,7 +4119,7 @@ workspace_move_surface_up_binding(struct wl_seat *seat, uint32_t time,
} }
static void static void
workspace_move_surface_down_binding(struct wl_seat *seat, uint32_t time, workspace_move_surface_down_binding(struct weston_seat *seat, uint32_t time,
uint32_t key, void *data) uint32_t key, void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;

@ -445,7 +445,7 @@ long_press_handler(void *data)
} }
static void static void
menu_key_binding(struct wl_seat *seat, uint32_t time, uint32_t key, void *data) menu_key_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data)
{ {
struct tablet_shell *shell = data; struct tablet_shell *shell = data;
@ -456,7 +456,7 @@ menu_key_binding(struct wl_seat *seat, uint32_t time, uint32_t key, void *data)
} }
static void static void
home_key_binding(struct wl_seat *seat, uint32_t time, uint32_t key, void *data) home_key_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data)
{ {
struct tablet_shell *shell = data; struct tablet_shell *shell = data;

@ -571,7 +571,7 @@ input_method_context_grab_keyboard(struct wl_client *client,
struct input_method_context *context = resource->data; struct input_method_context *context = resource->data;
struct wl_resource *cr; struct wl_resource *cr;
struct weston_seat *seat = context->input_method->seat; struct weston_seat *seat = context->input_method->seat;
struct weston_keyboard *keyboard = &seat->keyboard; struct weston_keyboard *keyboard = seat->keyboard;
cr = wl_client_add_object(client, &wl_keyboard_interface, cr = wl_client_add_object(client, &wl_keyboard_interface,
NULL, id, context); NULL, id, context);
@ -600,7 +600,7 @@ input_method_context_key(struct wl_client *client,
{ {
struct input_method_context *context = resource->data; struct input_method_context *context = resource->data;
struct weston_seat *seat = context->input_method->seat; struct weston_seat *seat = context->input_method->seat;
struct weston_keyboard *keyboard = seat->seat.keyboard; struct weston_keyboard *keyboard = seat->keyboard;
struct weston_keyboard_grab *default_grab = &keyboard->default_grab; struct weston_keyboard_grab *default_grab = &keyboard->default_grab;
default_grab->interface->key(default_grab, time, key, state_w); default_grab->interface->key(default_grab, time, key, state_w);
@ -618,7 +618,7 @@ input_method_context_modifiers(struct wl_client *client,
struct input_method_context *context = resource->data; struct input_method_context *context = resource->data;
struct weston_seat *seat = context->input_method->seat; struct weston_seat *seat = context->input_method->seat;
struct weston_keyboard *keyboard = seat->seat.keyboard; struct weston_keyboard *keyboard = seat->keyboard;
struct weston_keyboard_grab *default_grab = &keyboard->default_grab; struct weston_keyboard_grab *default_grab = &keyboard->default_grab;
default_grab->interface->modifiers(default_grab, default_grab->interface->modifiers(default_grab,
@ -712,7 +712,8 @@ input_method_context_create(struct text_input *model,
static void static void
input_method_context_end_keyboard_grab(struct input_method_context *context) input_method_context_end_keyboard_grab(struct input_method_context *context)
{ {
struct weston_keyboard_grab *grab = &context->input_method->seat->keyboard.input_method_grab; struct weston_keyboard_grab *grab =
&context->input_method->seat->keyboard->input_method_grab;
struct weston_keyboard *keyboard = grab->keyboard; struct weston_keyboard *keyboard = grab->keyboard;
if (!grab->keyboard) if (!grab->keyboard)
@ -811,8 +812,8 @@ input_method_init_seat(struct weston_seat *seat)
if (seat->has_keyboard) { if (seat->has_keyboard) {
seat->input_method->keyboard_focus_listener.notify = handle_keyboard_focus; seat->input_method->keyboard_focus_listener.notify = handle_keyboard_focus;
wl_signal_add(&seat->seat.keyboard->focus_signal, &seat->input_method->keyboard_focus_listener); wl_signal_add(&seat->keyboard->focus_signal, &seat->input_method->keyboard_focus_listener);
seat->keyboard.input_method_grab.interface = &input_method_context_grab; seat->keyboard->input_method_grab.interface = &input_method_context_grab;
} }
seat->input_method->focus_listener_initialized = 1; seat->input_method->focus_listener_initialized = 1;

@ -231,7 +231,7 @@ udev_seat_remove_devices(struct udev_seat *seat)
wl_list_for_each_safe(device, next, &seat->devices_list, link) wl_list_for_each_safe(device, next, &seat->devices_list, link)
evdev_device_destroy(device); evdev_device_destroy(device);
if (seat->base.seat.keyboard) if (seat->base.keyboard)
notify_keyboard_focus_out(&seat->base); notify_keyboard_focus_out(&seat->base);
} }

@ -195,8 +195,8 @@ weston_wm_get_selection_targets(struct weston_wm *wm)
} }
compositor = wm->server->compositor; compositor = wm->server->compositor;
wl_seat_set_selection(&seat->seat, &source->base, weston_seat_set_selection(seat, &source->base,
wl_display_next_serial(compositor->wl_display)); wl_display_next_serial(compositor->wl_display));
free(reply); free(reply);
} }
@ -441,7 +441,7 @@ weston_wm_send_data(struct weston_wm *wm, xcb_atom_t target, const char *mime_ty
weston_wm_read_data_source, weston_wm_read_data_source,
wm); wm);
source = seat->seat.selection_data_source; source = seat->selection_data_source;
source->send(source, mime_type, p[1]); source->send(source, mime_type, p[1]);
} }
@ -563,7 +563,7 @@ weston_wm_handle_xfixes_selection_notify(struct weston_wm *wm,
* proxy selection. Clear the wayland selection. */ * proxy selection. Clear the wayland selection. */
compositor = wm->server->compositor; compositor = wm->server->compositor;
serial = wl_display_next_serial(compositor->wl_display); serial = wl_display_next_serial(compositor->wl_display);
wl_seat_set_selection(&seat->seat, NULL, serial); weston_seat_set_selection(seat, NULL, serial);
} }
wm->selection_owner = XCB_WINDOW_NONE; wm->selection_owner = XCB_WINDOW_NONE;
@ -619,7 +619,7 @@ weston_wm_handle_selection_event(struct weston_wm *wm,
static void static void
weston_wm_set_selection(struct wl_listener *listener, void *data) weston_wm_set_selection(struct wl_listener *listener, void *data)
{ {
struct wl_seat *seat = data; struct weston_seat *seat = data;
struct weston_wm *wm = struct weston_wm *wm =
container_of(listener, struct weston_wm, selection_listener); container_of(listener, struct weston_wm, selection_listener);
struct wl_data_source *source = seat->selection_data_source; struct wl_data_source *source = seat->selection_data_source;
@ -697,7 +697,7 @@ weston_wm_selection_init(struct weston_wm *wm)
seat = weston_wm_pick_seat(wm); seat = weston_wm_pick_seat(wm);
wm->selection_listener.notify = weston_wm_set_selection; wm->selection_listener.notify = weston_wm_set_selection;
wl_signal_add(&seat->seat.selection_signal, &wm->selection_listener); wl_signal_add(&seat->selection_signal, &wm->selection_listener);
weston_wm_set_selection(&wm->selection_listener, seat); weston_wm_set_selection(&wm->selection_listener, seat);
} }

@ -1015,8 +1015,8 @@ weston_wm_window_handle_moveresize(struct weston_wm_window *window,
struct weston_shell_interface *shell_interface = struct weston_shell_interface *shell_interface =
&wm->server->compositor->shell_interface; &wm->server->compositor->shell_interface;
if (seat->seat.pointer->button_count != 1 || if (seat->pointer->button_count != 1 ||
seat->seat.pointer->focus != &window->surface->surface) seat->pointer->focus != &window->surface->surface)
return; return;
detail = client_message->data.data32[2]; detail = client_message->data.data32[2];

@ -168,10 +168,10 @@ weston_zoom_frame_xy(struct weston_animation *animation,
output->zoom.spring_xy.current = output->zoom.spring_xy.target; output->zoom.spring_xy.current = output->zoom.spring_xy.target;
output->zoom.current.x = output->zoom.current.x =
output->zoom.type == ZOOM_FOCUS_POINTER ? output->zoom.type == ZOOM_FOCUS_POINTER ?
seat->pointer.x : output->zoom.text_cursor.x; seat->pointer->x : output->zoom.text_cursor.x;
output->zoom.current.y = output->zoom.current.y =
output->zoom.type == ZOOM_FOCUS_POINTER ? output->zoom.type == ZOOM_FOCUS_POINTER ?
seat->pointer.y : output->zoom.text_cursor.y; seat->pointer->y : output->zoom.text_cursor.y;
wl_list_remove(&animation->link); wl_list_remove(&animation->link);
wl_list_init(&animation->link); wl_list_init(&animation->link);
} }
@ -337,15 +337,15 @@ WL_EXPORT void
weston_output_update_zoom(struct weston_output *output, uint32_t type) weston_output_update_zoom(struct weston_output *output, uint32_t type)
{ {
struct weston_seat *seat = weston_zoom_pick_seat(output->compositor); struct weston_seat *seat = weston_zoom_pick_seat(output->compositor);
wl_fixed_t x = seat->pointer.x; wl_fixed_t x = seat->pointer->x;
wl_fixed_t y = seat->pointer.y; wl_fixed_t y = seat->pointer->y;
zoom_area_center_from_pointer(output, &x, &y); zoom_area_center_from_pointer(output, &x, &y);
if (type == ZOOM_FOCUS_POINTER) { if (type == ZOOM_FOCUS_POINTER) {
if (wl_list_empty(&output->zoom.animation_xy.link)) { if (wl_list_empty(&output->zoom.animation_xy.link)) {
output->zoom.current.x = seat->pointer.x; output->zoom.current.x = seat->pointer->x;
output->zoom.current.y = seat->pointer.y; output->zoom.current.y = seat->pointer->y;
} else { } else {
output->zoom.to.x = x; output->zoom.to.x = x;
output->zoom.to.y = y; output->zoom.to.y = y;

@ -68,7 +68,7 @@ static void
notify_pointer_position(struct weston_test *test, struct wl_resource *resource) notify_pointer_position(struct weston_test *test, struct wl_resource *resource)
{ {
struct weston_seat *seat = get_seat(test); struct weston_seat *seat = get_seat(test);
struct weston_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->pointer;
wl_test_send_pointer_position(resource, pointer->x, pointer->y); wl_test_send_pointer_position(resource, pointer->x, pointer->y);
} }
@ -119,7 +119,7 @@ move_pointer(struct wl_client *client, struct wl_resource *resource,
{ {
struct weston_test *test = resource->data; struct weston_test *test = resource->data;
struct weston_seat *seat = get_seat(test); struct weston_seat *seat = get_seat(test);
struct weston_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->pointer;
test->compositor->focus = 1; test->compositor->focus = 1;
@ -155,7 +155,7 @@ activate_surface(struct wl_client *client, struct wl_resource *resource,
if (surface) { if (surface) {
weston_surface_activate(surface, seat); weston_surface_activate(surface, seat);
notify_keyboard_focus_in(seat, &seat->keyboard.keys, notify_keyboard_focus_in(seat, &seat->keyboard->keys,
STATE_UPDATE_AUTOMATIC); STATE_UPDATE_AUTOMATIC);
} }
else { else {

Loading…
Cancel
Save