input: Pass the appropriate pointer type to bindings instead of a seat

Normally we need to check if a seat's [device_type]_count is > 0 before
we can use the associated pointer.  However, in a binding you're
guaranteed that the seat has a device of that type.  If we pass in
that type instead of the seat, it's obvious we don't have to test it.

The bindings can still get the seat pointer via whatever->seat if they
need it.

This is preparation for a follow up patch that prevents direct access
to seat->device_type pointers, and this will save us a few tests at
that point.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
This commit is contained in:
Derek Foreman 2015-07-15 13:00:36 -05:00 committed by Bryce Harrington
parent 0720ea36c8
commit 8ae2db5b0c
15 changed files with 116 additions and 104 deletions

View File

@ -653,10 +653,10 @@ exposay_set_state(struct desktop_shell *shell, enum exposay_target_state state,
} }
void void
exposay_binding(struct weston_seat *seat, enum weston_keyboard_modifier modifier, exposay_binding(struct weston_keyboard *keyboard, enum weston_keyboard_modifier modifier,
void *data) void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
exposay_set_state(shell, EXPOSAY_TARGET_OVERVIEW, seat); exposay_set_state(shell, EXPOSAY_TARGET_OVERVIEW, keyboard->seat);
} }

View File

@ -4588,16 +4588,17 @@ get_shell_surface_type(struct weston_surface *surface)
} }
static void static void
move_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data) move_binding(struct weston_pointer *pointer, uint32_t time,
uint32_t button, void *data)
{ {
struct weston_surface *focus; struct weston_surface *focus;
struct weston_surface *surface; struct weston_surface *surface;
struct shell_surface *shsurf; struct shell_surface *shsurf;
if (seat->pointer->focus == NULL) if (pointer->focus == NULL)
return; return;
focus = seat->pointer->focus->surface; focus = pointer->focus->surface;
surface = weston_surface_get_main_surface(focus); surface = weston_surface_get_main_surface(focus);
if (surface == NULL) if (surface == NULL)
@ -4608,13 +4609,14 @@ move_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *dat
shsurf->state.maximized) shsurf->state.maximized)
return; return;
surface_move(shsurf, seat, false); surface_move(shsurf, pointer->seat, false);
} }
static void static void
maximize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data) maximize_binding(struct weston_keyboard *keyboard, uint32_t time,
uint32_t button, void *data)
{ {
struct weston_surface *focus = seat->keyboard->focus; struct weston_surface *focus = keyboard->focus;
struct weston_surface *surface; struct weston_surface *surface;
struct shell_surface *shsurf; struct shell_surface *shsurf;
@ -4635,9 +4637,10 @@ maximize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void
} }
static void static void
fullscreen_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data) fullscreen_binding(struct weston_keyboard *keyboard, uint32_t time,
uint32_t button, void *data)
{ {
struct weston_surface *focus = seat->keyboard->focus; struct weston_surface *focus = keyboard->focus;
struct weston_surface *surface; struct weston_surface *surface;
struct shell_surface *shsurf; struct shell_surface *shsurf;
@ -4659,16 +4662,16 @@ fullscreen_binding(struct weston_seat *seat, uint32_t time, uint32_t button, voi
} }
static void static void
touch_move_binding(struct weston_seat *seat, uint32_t time, void *data) touch_move_binding(struct weston_touch *touch, uint32_t time, void *data)
{ {
struct weston_surface *focus; struct weston_surface *focus;
struct weston_surface *surface; struct weston_surface *surface;
struct shell_surface *shsurf; struct shell_surface *shsurf;
if (seat->touch->focus == NULL) if (touch->focus == NULL)
return; return;
focus = seat->touch->focus->surface; focus = touch->focus->surface;
surface = weston_surface_get_main_surface(focus); surface = weston_surface_get_main_surface(focus);
if (surface == NULL) if (surface == NULL)
return; return;
@ -4678,11 +4681,12 @@ touch_move_binding(struct weston_seat *seat, uint32_t time, void *data)
shsurf->state.maximized) shsurf->state.maximized)
return; return;
surface_touch_move(shsurf, seat); surface_touch_move(shsurf, touch->seat);
} }
static void static void
resize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data) resize_binding(struct weston_pointer *pointer, uint32_t time,
uint32_t button, void *data)
{ {
struct weston_surface *focus; struct weston_surface *focus;
struct weston_surface *surface; struct weston_surface *surface;
@ -4690,10 +4694,10 @@ resize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *d
int32_t x, y; int32_t x, y;
struct shell_surface *shsurf; struct shell_surface *shsurf;
if (seat->pointer->focus == NULL) if (pointer->focus == NULL)
return; return;
focus = seat->pointer->focus->surface; focus = pointer->focus->surface;
surface = weston_surface_get_main_surface(focus); surface = weston_surface_get_main_surface(focus);
if (surface == NULL) if (surface == NULL)
@ -4705,8 +4709,8 @@ resize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *d
return; return;
weston_view_from_global(shsurf->view, weston_view_from_global(shsurf->view,
wl_fixed_to_int(seat->pointer->grab_x), wl_fixed_to_int(pointer->grab_x),
wl_fixed_to_int(seat->pointer->grab_y), wl_fixed_to_int(pointer->grab_y),
&x, &y); &x, &y);
if (x < shsurf->surface->width / 3) if (x < shsurf->surface->width / 3)
@ -4723,16 +4727,16 @@ resize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *d
else else
edges |= WL_SHELL_SURFACE_RESIZE_BOTTOM; edges |= WL_SHELL_SURFACE_RESIZE_BOTTOM;
surface_resize(shsurf, seat, edges); surface_resize(shsurf, pointer->seat, edges);
} }
static void static void
surface_opacity_binding(struct weston_seat *seat, uint32_t time, uint32_t axis, surface_opacity_binding(struct weston_pointer *pointer, uint32_t time,
wl_fixed_t value, void *data) uint32_t axis, wl_fixed_t value, void *data)
{ {
float step = 0.005; float step = 0.005;
struct shell_surface *shsurf; struct shell_surface *shsurf;
struct weston_surface *focus = seat->pointer->focus->surface; struct weston_surface *focus = pointer->focus->surface;
struct weston_surface *surface; struct weston_surface *surface;
/* XXX: broken for windows containing sub-surfaces */ /* XXX: broken for windows containing sub-surfaces */
@ -4802,22 +4806,22 @@ do_zoom(struct weston_seat *seat, uint32_t time, uint32_t key, uint32_t axis,
} }
static void static void
zoom_axis_binding(struct weston_seat *seat, uint32_t time, uint32_t axis, zoom_axis_binding(struct weston_pointer *pointer, uint32_t time,
wl_fixed_t value, void *data) uint32_t axis, wl_fixed_t value, void *data)
{ {
do_zoom(seat, time, 0, axis, value); do_zoom(pointer->seat, time, 0, axis, value);
} }
static void static void
zoom_key_binding(struct weston_seat *seat, uint32_t time, uint32_t key, zoom_key_binding(struct weston_keyboard *keyboard, uint32_t time,
void *data) uint32_t key, void *data)
{ {
do_zoom(seat, time, key, 0, 0); do_zoom(keyboard->seat, time, key, 0, 0);
} }
static void static void
terminate_binding(struct weston_seat *seat, uint32_t time, uint32_t key, terminate_binding(struct weston_keyboard *keyboard, uint32_t time,
void *data) uint32_t key, void *data)
{ {
struct weston_compositor *compositor = data; struct weston_compositor *compositor = data;
@ -4964,17 +4968,17 @@ surface_rotate(struct shell_surface *surface, struct weston_seat *seat)
} }
static void static void
rotate_binding(struct weston_seat *seat, uint32_t time, uint32_t button, rotate_binding(struct weston_pointer *pointer, uint32_t time, uint32_t button,
void *data) void *data)
{ {
struct weston_surface *focus; struct weston_surface *focus;
struct weston_surface *base_surface; struct weston_surface *base_surface;
struct shell_surface *surface; struct shell_surface *surface;
if (seat->pointer->focus == NULL) if (pointer->focus == NULL)
return; return;
focus = seat->pointer->focus->surface; focus = pointer->focus->surface;
base_surface = weston_surface_get_main_surface(focus); base_surface = weston_surface_get_main_surface(focus);
if (base_surface == NULL) if (base_surface == NULL)
@ -4985,7 +4989,7 @@ rotate_binding(struct weston_seat *seat, uint32_t time, uint32_t button,
surface->state.maximized) surface->state.maximized)
return; return;
surface_rotate(surface, seat); surface_rotate(surface, pointer->seat);
} }
/* Move all fullscreen layers down to the current workspace and hide their /* Move all fullscreen layers down to the current workspace and hide their
@ -5120,26 +5124,27 @@ activate_binding(struct weston_seat *seat,
} }
static void static void
click_to_activate_binding(struct weston_seat *seat, uint32_t time, uint32_t button, click_to_activate_binding(struct weston_pointer *pointer, uint32_t time,
void *data) uint32_t button, void *data)
{ {
if (seat->pointer->grab != &seat->pointer->default_grab) if (pointer->grab != &pointer->default_grab)
return; return;
if (seat->pointer->focus == NULL) if (pointer->focus == NULL)
return; return;
activate_binding(seat, data, seat->pointer->focus->surface); activate_binding(pointer->seat, data, pointer->focus->surface);
} }
static void static void
touch_to_activate_binding(struct weston_seat *seat, uint32_t time, void *data) touch_to_activate_binding(struct weston_touch *touch, uint32_t time,
void *data)
{ {
if (seat->touch->grab != &seat->touch->default_grab) if (touch->grab != &touch->default_grab)
return; return;
if (seat->touch->focus == NULL) if (touch->focus == NULL)
return; return;
activate_binding(seat, data, seat->touch->focus->surface); activate_binding(touch->seat, data, touch->focus->surface);
} }
static void static void
@ -6023,8 +6028,8 @@ static const struct weston_keyboard_grab_interface switcher_grab = {
}; };
static void static void
switcher_binding(struct weston_seat *seat, uint32_t time, uint32_t key, switcher_binding(struct weston_keyboard *keyboard, uint32_t time,
void *data) uint32_t key, void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
struct switcher *switcher; struct switcher *switcher;
@ -6039,14 +6044,14 @@ switcher_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
restore_all_output_modes(shell->compositor); restore_all_output_modes(shell->compositor);
lower_fullscreen_layer(switcher->shell, NULL); lower_fullscreen_layer(switcher->shell, NULL);
switcher->grab.interface = &switcher_grab; switcher->grab.interface = &switcher_grab;
weston_keyboard_start_grab(seat->keyboard, &switcher->grab); weston_keyboard_start_grab(keyboard, &switcher->grab);
weston_keyboard_set_focus(seat->keyboard, NULL); weston_keyboard_set_focus(keyboard, NULL);
switcher_next(switcher); switcher_next(switcher);
} }
static void static void
backlight_binding(struct weston_seat *seat, uint32_t time, uint32_t key, backlight_binding(struct weston_keyboard *keyboard, uint32_t time,
void *data) uint32_t key, void *data)
{ {
struct weston_compositor *compositor = data; struct weston_compositor *compositor = data;
struct weston_output *output; struct weston_output *output;
@ -6078,8 +6083,8 @@ backlight_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
} }
static void static void
force_kill_binding(struct weston_seat *seat, uint32_t time, uint32_t key, force_kill_binding(struct weston_keyboard *keyboard, uint32_t time,
void *data) uint32_t key, void *data)
{ {
struct weston_surface *focus_surface; struct weston_surface *focus_surface;
struct wl_client *client; struct wl_client *client;
@ -6087,7 +6092,7 @@ force_kill_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
struct weston_compositor *compositor = shell->compositor; struct weston_compositor *compositor = shell->compositor;
pid_t pid; pid_t pid;
focus_surface = seat->keyboard->focus; focus_surface = keyboard->focus;
if (!focus_surface) if (!focus_surface)
return; return;
@ -6105,7 +6110,7 @@ force_kill_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
} }
static void static void
workspace_up_binding(struct weston_seat *seat, uint32_t time, workspace_up_binding(struct weston_keyboard *keyboard, uint32_t time,
uint32_t key, void *data) uint32_t key, void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
@ -6120,7 +6125,7 @@ workspace_up_binding(struct weston_seat *seat, uint32_t time,
} }
static void static void
workspace_down_binding(struct weston_seat *seat, uint32_t time, workspace_down_binding(struct weston_keyboard *keyboard, uint32_t time,
uint32_t key, void *data) uint32_t key, void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
@ -6135,7 +6140,7 @@ workspace_down_binding(struct weston_seat *seat, uint32_t time,
} }
static void static void
workspace_f_binding(struct weston_seat *seat, uint32_t time, workspace_f_binding(struct weston_keyboard *keyboard, uint32_t time,
uint32_t key, void *data) uint32_t key, void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
@ -6151,8 +6156,8 @@ workspace_f_binding(struct weston_seat *seat, uint32_t time,
} }
static void static void
workspace_move_surface_up_binding(struct weston_seat *seat, uint32_t time, workspace_move_surface_up_binding(struct weston_keyboard *keyboard,
uint32_t key, void *data) uint32_t time, uint32_t key, void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
unsigned int new_index = shell->workspaces.current; unsigned int new_index = shell->workspaces.current;
@ -6163,12 +6168,12 @@ workspace_move_surface_up_binding(struct weston_seat *seat, uint32_t time,
if (new_index != 0) if (new_index != 0)
new_index--; new_index--;
take_surface_to_workspace_by_seat(shell, seat, new_index); take_surface_to_workspace_by_seat(shell, keyboard->seat, new_index);
} }
static void static void
workspace_move_surface_down_binding(struct weston_seat *seat, uint32_t time, workspace_move_surface_down_binding(struct weston_keyboard *keyboard,
uint32_t key, void *data) uint32_t time, uint32_t key, void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
unsigned int new_index = shell->workspaces.current; unsigned int new_index = shell->workspaces.current;
@ -6179,7 +6184,7 @@ workspace_move_surface_down_binding(struct weston_seat *seat, uint32_t time,
if (new_index < shell->workspaces.num - 1) if (new_index < shell->workspaces.num - 1)
new_index++; new_index++;
take_surface_to_workspace_by_seat(shell, seat, new_index); take_surface_to_workspace_by_seat(shell, keyboard->seat, new_index);
} }
static void static void

View File

@ -230,7 +230,7 @@ activate(struct desktop_shell *shell, struct weston_surface *es,
struct weston_seat *seat, bool configure); struct weston_seat *seat, bool configure);
void void
exposay_binding(struct weston_seat *seat, exposay_binding(struct weston_keyboard *keyboard,
enum weston_keyboard_modifier modifier, enum weston_keyboard_modifier modifier,
void *data); void *data);
int int

View File

@ -355,8 +355,8 @@ shell_destroy(struct wl_listener *listener, void *data)
} }
static void static void
terminate_binding(struct weston_seat *seat, uint32_t time, uint32_t key, terminate_binding(struct weston_keyboard *keyboard, uint32_t time,
void *data) uint32_t key, void *data)
{ {
struct weston_compositor *compositor = data; struct weston_compositor *compositor = data;

View File

@ -298,7 +298,7 @@ weston_compositor_run_key_binding(struct weston_compositor *compositor,
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;
focus = seat->keyboard->focus; focus = seat->keyboard->focus;
handler(seat, time, key, b->data); handler(seat->keyboard, 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
@ -337,7 +337,7 @@ weston_compositor_run_modifier_binding(struct weston_compositor *compositor,
return; return;
} }
handler(seat, modifier, b->data); handler(seat->keyboard, modifier, b->data);
} }
} }
@ -359,7 +359,7 @@ weston_compositor_run_button_binding(struct weston_compositor *compositor,
wl_list_for_each_safe(b, tmp, &compositor->button_binding_list, link) { wl_list_for_each_safe(b, tmp, &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, time, button, b->data); handler(seat->pointer, time, button, b->data);
} }
} }
} }
@ -377,7 +377,7 @@ weston_compositor_run_touch_binding(struct weston_compositor *compositor,
wl_list_for_each_safe(b, tmp, &compositor->touch_binding_list, link) { wl_list_for_each_safe(b, tmp, &compositor->touch_binding_list, link) {
if (b->modifier == seat->modifier_state) { if (b->modifier == seat->modifier_state) {
weston_touch_binding_handler_t handler = b->handler; weston_touch_binding_handler_t handler = b->handler;
handler(seat, time, b->data); handler(seat->touch, time, b->data);
} }
} }
} }
@ -397,7 +397,7 @@ weston_compositor_run_axis_binding(struct weston_compositor *compositor,
wl_list_for_each_safe(b, tmp, &compositor->axis_binding_list, link) { wl_list_for_each_safe(b, tmp, &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, time, axis, value, b->data); handler(seat->pointer, time, axis, value, b->data);
return 1; return 1;
} }
} }
@ -421,7 +421,7 @@ weston_compositor_run_debug_binding(struct weston_compositor *compositor,
count++; count++;
handler = binding->handler; handler = binding->handler;
handler(seat, time, key, binding->data); handler(seat->keyboard, time, key, binding->data);
} }
return count; return count;
@ -540,7 +540,8 @@ struct weston_keyboard_grab_interface debug_binding_keyboard_grab = {
}; };
static void static void
debug_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data) debug_binding(struct weston_keyboard *keyboard, uint32_t time,
uint32_t key, void *data)
{ {
struct debug_binding_grab *grab; struct debug_binding_grab *grab;
@ -548,10 +549,10 @@ debug_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data)
if (!grab) if (!grab)
return; return;
grab->seat = seat; grab->seat = keyboard->seat;
grab->key[0] = key; grab->key[0] = key;
grab->grab.interface = &debug_binding_keyboard_grab; grab->grab.interface = &debug_binding_keyboard_grab;
weston_keyboard_start_grab(seat->keyboard, &grab->grab); weston_keyboard_start_grab(keyboard, &grab->grab);
} }
/** Install the trigger binding for debug bindings. /** Install the trigger binding for debug bindings.

View File

@ -2764,7 +2764,8 @@ session_notify(struct wl_listener *listener, void *data)
} }
static void static void
switch_vt_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data) switch_vt_binding(struct weston_keyboard *keyboard, uint32_t time,
uint32_t key, void *data)
{ {
struct weston_compositor *compositor = data; struct weston_compositor *compositor = data;
@ -2828,7 +2829,8 @@ find_primary_gpu(struct drm_backend *b, const char *seat)
} }
static void static void
planes_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data) planes_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key,
void *data)
{ {
struct drm_backend *b = data; struct drm_backend *b = data;
@ -2908,7 +2910,7 @@ create_recorder(struct drm_backend *b, int width, int height,
} }
static void static void
recorder_binding(struct weston_seat *seat, uint32_t time, uint32_t key, recorder_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key,
void *data) void *data)
{ {
struct drm_backend *b = data; struct drm_backend *b = data;
@ -2993,10 +2995,11 @@ switch_to_gl_renderer(struct drm_backend *b)
} }
static void static void
renderer_switch_binding(struct weston_seat *seat, uint32_t time, uint32_t key, renderer_switch_binding(struct weston_keyboard *keyboard, uint32_t time,
void *data) uint32_t key, void *data)
{ {
struct drm_backend *b = (struct drm_backend *)seat->compositor->backend; struct drm_backend *b =
(struct drm_backend *) keyboard->seat->compositor;
switch_to_gl_renderer(b); switch_to_gl_renderer(b);
} }

View File

@ -803,7 +803,8 @@ fbdev_restore(struct weston_compositor *compositor)
} }
static void static void
switch_vt_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data) switch_vt_binding(struct weston_keyboard *keyboard, uint32_t time,
uint32_t key, void *data)
{ {
struct weston_compositor *compositor = data; struct weston_compositor *compositor = data;

View File

@ -448,7 +448,8 @@ rpi_restore(struct weston_compositor *compositor)
} }
static void static void
switch_vt_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data) switch_vt_binding(struct weston_keyboard *keyboard, uint32_t time,
uint32_t key, void *data)
{ {
struct weston_compositor *compositor = data; struct weston_compositor *compositor = data;

View File

@ -1925,14 +1925,14 @@ create_cursor(struct wayland_backend *b, struct weston_config *config)
} }
static void static void
fullscreen_binding(struct weston_seat *seat_base, uint32_t time, uint32_t key, fullscreen_binding(struct weston_keyboard *keyboard, uint32_t time,
void *data) uint32_t key, void *data)
{ {
struct wayland_backend *b = data; struct wayland_backend *b = data;
struct wayland_input *input = NULL; struct wayland_input *input = NULL;
wl_list_for_each(input, &b->input_list, link) wl_list_for_each(input, &b->input_list, link)
if (&input->base == seat_base) if (&input->base == keyboard->seat)
break; break;
if (!input || !input->output) if (!input || !input->output)

View File

@ -4433,7 +4433,7 @@ weston_environment_get_fd(const char *env)
} }
static void static void
timeline_key_binding_handler(struct weston_seat *seat, uint32_t time, timeline_key_binding_handler(struct weston_keyboard *keyboard, uint32_t time,
uint32_t key, void *data) uint32_t key, void *data)
{ {
struct weston_compositor *compositor = data; struct weston_compositor *compositor = data;

View File

@ -1149,7 +1149,7 @@ weston_compositor_pick_view(struct weston_compositor *compositor,
struct weston_binding; struct weston_binding;
typedef void (*weston_key_binding_handler_t)(struct weston_seat *seat, typedef void (*weston_key_binding_handler_t)(struct weston_keyboard *keyboard,
uint32_t time, uint32_t key, uint32_t time, uint32_t key,
void *data); void *data);
struct weston_binding * struct weston_binding *
@ -1159,7 +1159,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_modifier_binding_handler_t)(struct weston_seat *seat, typedef void (*weston_modifier_binding_handler_t)(struct weston_keyboard *keyboard,
enum weston_keyboard_modifier modifier, enum weston_keyboard_modifier modifier,
void *data); void *data);
struct weston_binding * struct weston_binding *
@ -1168,7 +1168,7 @@ weston_compositor_add_modifier_binding(struct weston_compositor *compositor,
weston_modifier_binding_handler_t binding, weston_modifier_binding_handler_t binding,
void *data); void *data);
typedef void (*weston_button_binding_handler_t)(struct weston_seat *seat, typedef void (*weston_button_binding_handler_t)(struct weston_pointer *pointer,
uint32_t time, uint32_t button, uint32_t time, uint32_t button,
void *data); void *data);
struct weston_binding * struct weston_binding *
@ -1178,7 +1178,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_touch_binding_handler_t)(struct weston_seat *seat, typedef void (*weston_touch_binding_handler_t)(struct weston_touch *touch,
uint32_t time, uint32_t time,
void *data); void *data);
struct weston_binding * struct weston_binding *
@ -1187,7 +1187,7 @@ weston_compositor_add_touch_binding(struct weston_compositor *compositor,
weston_touch_binding_handler_t binding, weston_touch_binding_handler_t binding,
void *data); void *data);
typedef void (*weston_axis_binding_handler_t)(struct weston_seat *seat, typedef void (*weston_axis_binding_handler_t)(struct weston_pointer *pointer,
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 *

View File

@ -2429,8 +2429,8 @@ compile_shaders(struct weston_compositor *ec)
} }
static void static void
fragment_debug_binding(struct weston_seat *seat, uint32_t time, uint32_t key, fragment_debug_binding(struct weston_keyboard *keyboard, uint32_t time,
void *data) uint32_t key, void *data)
{ {
struct weston_compositor *ec = data; struct weston_compositor *ec = data;
struct gl_renderer *gr = get_renderer(ec); struct gl_renderer *gr = get_renderer(ec);
@ -2455,8 +2455,8 @@ fragment_debug_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
} }
static void static void
fan_debug_repaint_binding(struct weston_seat *seat, uint32_t time, uint32_t key, fan_debug_repaint_binding(struct weston_keyboard *keyboard, uint32_t time,
void *data) uint32_t key, void *data)
{ {
struct weston_compositor *compositor = data; struct weston_compositor *compositor = data;
struct gl_renderer *gr = get_renderer(compositor); struct gl_renderer *gr = get_renderer(compositor);

View File

@ -804,7 +804,7 @@ pixman_renderer_surface_copy_content(struct weston_surface *surface,
} }
static void static void
debug_binding(struct weston_seat *seat, uint32_t time, uint32_t key, debug_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key,
void *data) void *data)
{ {
struct weston_compositor *ec = data; struct weston_compositor *ec = data;

View File

@ -286,8 +286,8 @@ screenshooter_sigchld(struct weston_process *process, int status)
} }
static void static void
screenshooter_binding(struct weston_seat *seat, uint32_t time, uint32_t key, screenshooter_binding(struct weston_keyboard *keyboard, uint32_t time,
void *data) uint32_t key, void *data)
{ {
struct screenshooter *shooter = data; struct screenshooter *shooter = data;
char *screenshooter_exe; char *screenshooter_exe;
@ -560,9 +560,10 @@ weston_recorder_destroy(struct weston_recorder *recorder)
} }
static void static void
recorder_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data) recorder_binding(struct weston_keyboard *keyboard, uint32_t time,
uint32_t key, void *data)
{ {
struct weston_compositor *ec = seat->compositor; struct weston_compositor *ec = keyboard->seat->compositor;
struct weston_output *output; struct weston_output *output;
struct wl_listener *listener = NULL; struct wl_listener *listener = NULL;
struct weston_recorder *recorder; struct weston_recorder *recorder;
@ -586,9 +587,8 @@ recorder_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *da
recorder->destroying = 1; recorder->destroying = 1;
weston_output_schedule_repaint(recorder->output); weston_output_schedule_repaint(recorder->output);
} else { } else {
if (seat->keyboard && seat->keyboard->focus && if (keyboard->focus && keyboard->focus->output)
seat->keyboard->focus->output) output = keyboard->focus->output;
output = seat->keyboard->focus->output;
else else
output = container_of(ec->output_list.next, output = container_of(ec->output_list.next,
struct weston_output, link); struct weston_output, link);

View File

@ -131,13 +131,14 @@ unpremultiply_and_swap_a8b8g8r8_to_PAMrgba(void *pixels, size_t size)
} }
static void static void
trigger_binding(struct weston_seat *seat, uint32_t time, uint32_t key, trigger_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key,
void *data) void *data)
{ {
const char *prefix = "surfaceshot-"; const char *prefix = "surfaceshot-";
const char *suffix = ".pam"; const char *suffix = ".pam";
char fname[1024]; char fname[1024];
struct weston_surface *surface; struct weston_surface *surface;
struct weston_seat *seat = keyboard->seat;
int width, height; int width, height;
char desc[512]; char desc[512];
void *pixels; void *pixels;