[PATCH weston 11/19] input: Pass the appropriate pointer type to bindings instead of a seat

Derek Foreman derekf at osg.samsung.com
Wed Jun 3 13:53:30 PDT 2015


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.

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
 desktop-shell/exposay.c    |   4 +-
 desktop-shell/shell.c      | 125 +++++++++++++++++++++++----------------------
 desktop-shell/shell.h      |   2 +-
 ivi-shell/ivi-shell.c      |   4 +-
 src/bindings.c             |  19 +++----
 src/compositor-drm.c       |  15 +++---
 src/compositor-fbdev.c     |   3 +-
 src/compositor-rpi.c       |   3 +-
 src/compositor-wayland.c   |   6 +--
 src/compositor.c           |   2 +-
 src/compositor.h           |  10 ++--
 src/gl-renderer.c          |   8 +--
 src/pixman-renderer.c      |   2 +-
 src/screenshooter.c        |  14 ++---
 tests/surface-screenshot.c |   3 +-
 15 files changed, 116 insertions(+), 104 deletions(-)

diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c
index 4916b39..ec65e7d 100644
--- a/desktop-shell/exposay.c
+++ b/desktop-shell/exposay.c
@@ -652,10 +652,10 @@ exposay_set_state(struct desktop_shell *shell, enum exposay_target_state state,
 }
 
 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)
 {
 	struct desktop_shell *shell = data;
 
-	exposay_set_state(shell, EXPOSAY_TARGET_OVERVIEW, seat);
+	exposay_set_state(shell, EXPOSAY_TARGET_OVERVIEW, keyboard->seat);
 }
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 57511d2..734834d 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -4642,16 +4642,17 @@ get_shell_surface_type(struct weston_surface *surface)
 }
 
 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 *surface;
 	struct shell_surface *shsurf;
 
-	if (seat->pointer->focus == NULL)
+	if (pointer->focus == NULL)
 		return;
 
-	focus = seat->pointer->focus->surface;
+	focus = pointer->focus->surface;
 
 	surface = weston_surface_get_main_surface(focus);
 	if (surface == NULL)
@@ -4662,13 +4663,14 @@ move_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *dat
 	    shsurf->state.maximized)
 		return;
 
-	surface_move(shsurf, seat, false);
+	surface_move(shsurf, pointer->seat, false);
 }
 
 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 shell_surface *shsurf;
 
@@ -4689,9 +4691,10 @@ maximize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, 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 shell_surface *shsurf;
 
@@ -4713,16 +4716,16 @@ fullscreen_binding(struct weston_seat *seat, uint32_t time, uint32_t button, voi
 }
 
 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 *surface;
 	struct shell_surface *shsurf;
 
-	if (seat->touch->focus == NULL)
+	if (touch->focus == NULL)
 		return;
 
-	focus = seat->touch->focus->surface;
+	focus = touch->focus->surface;
 	surface = weston_surface_get_main_surface(focus);
 	if (surface == NULL)
 		return;
@@ -4732,11 +4735,12 @@ touch_move_binding(struct weston_seat *seat, uint32_t time, void *data)
 	    shsurf->state.maximized)
 		return;
 
-	surface_touch_move(shsurf, seat);
+	surface_touch_move(shsurf, touch->seat);
 }
 
 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 *surface;
@@ -4744,10 +4748,10 @@ resize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *d
 	int32_t x, y;
 	struct shell_surface *shsurf;
 
-	if (seat->pointer->focus == NULL)
+	if (pointer->focus == NULL)
 		return;
 
-	focus = seat->pointer->focus->surface;
+	focus = pointer->focus->surface;
 
 	surface = weston_surface_get_main_surface(focus);
 	if (surface == NULL)
@@ -4759,8 +4763,8 @@ resize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *d
 		return;
 
 	weston_view_from_global(shsurf->view,
-				wl_fixed_to_int(seat->pointer->grab_x),
-				wl_fixed_to_int(seat->pointer->grab_y),
+				wl_fixed_to_int(pointer->grab_x),
+				wl_fixed_to_int(pointer->grab_y),
 				&x, &y);
 
 	if (x < shsurf->surface->width / 3)
@@ -4777,16 +4781,16 @@ resize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *d
 	else
 		edges |= WL_SHELL_SURFACE_RESIZE_BOTTOM;
 
-	surface_resize(shsurf, seat, edges);
+	surface_resize(shsurf, pointer->seat, edges);
 }
 
 static void
-surface_opacity_binding(struct weston_seat *seat, uint32_t time, uint32_t axis,
-			wl_fixed_t value, void *data)
+surface_opacity_binding(struct weston_pointer *pointer, uint32_t time,
+			uint32_t axis, wl_fixed_t value, void *data)
 {
 	float step = 0.005;
 	struct shell_surface *shsurf;
-	struct weston_surface *focus = seat->pointer->focus->surface;
+	struct weston_surface *focus = pointer->focus->surface;
 	struct weston_surface *surface;
 
 	/* XXX: broken for windows containing sub-surfaces */
@@ -4856,22 +4860,22 @@ do_zoom(struct weston_seat *seat, uint32_t time, uint32_t key, uint32_t axis,
 }
 
 static void
-zoom_axis_binding(struct weston_seat *seat, uint32_t time, uint32_t axis,
-		  wl_fixed_t value, void *data)
+zoom_axis_binding(struct weston_pointer *pointer, uint32_t time,
+		  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
-zoom_key_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
-		 void *data)
+zoom_key_binding(struct weston_keyboard *keyboard, uint32_t time,
+		 uint32_t key, void *data)
 {
-	do_zoom(seat, time, key, 0, 0);
+	do_zoom(keyboard->seat, time, key, 0, 0);
 }
 
 static void
-terminate_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
-		  void *data)
+terminate_binding(struct weston_keyboard *keyboard, uint32_t time,
+		  uint32_t key, void *data)
 {
 	struct weston_compositor *compositor = data;
 
@@ -5018,17 +5022,17 @@ surface_rotate(struct shell_surface *surface, struct weston_seat *seat)
 }
 
 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)
 {
 	struct weston_surface *focus;
 	struct weston_surface *base_surface;
 	struct shell_surface *surface;
 
-	if (seat->pointer->focus == NULL)
+	if (pointer->focus == NULL)
 		return;
 
-	focus = seat->pointer->focus->surface;
+	focus = pointer->focus->surface;
 
 	base_surface = weston_surface_get_main_surface(focus);
 	if (base_surface == NULL)
@@ -5039,7 +5043,7 @@ rotate_binding(struct weston_seat *seat, uint32_t time, uint32_t button,
 	    surface->state.maximized)
 		return;
 
-	surface_rotate(surface, seat);
+	surface_rotate(surface, pointer->seat);
 }
 
 /* Move all fullscreen layers down to the current workspace and hide their
@@ -5163,26 +5167,27 @@ activate_binding(struct weston_seat *seat,
 }
 
 static void
-click_to_activate_binding(struct weston_seat *seat, uint32_t time, uint32_t button,
-			  void *data)
+click_to_activate_binding(struct weston_pointer *pointer, uint32_t time,
+			  uint32_t button, void *data)
 {
-	if (seat->pointer->grab != &seat->pointer->default_grab)
+	if (pointer->grab != &pointer->default_grab)
 		return;
-	if (seat->pointer->focus == NULL)
+	if (pointer->focus == NULL)
 		return;
 
-	activate_binding(seat, data, seat->pointer->focus->surface);
+	activate_binding(pointer->seat, data, pointer->focus->surface);
 }
 
 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;
-	if (seat->touch->focus == NULL)
+	if (touch->focus == NULL)
 		return;
 
-	activate_binding(seat, data, seat->touch->focus->surface);
+	activate_binding(touch->seat, data, touch->focus->surface);
 }
 
 static void
@@ -6159,8 +6164,8 @@ static const struct weston_keyboard_grab_interface switcher_grab = {
 };
 
 static void
-switcher_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
-		 void *data)
+switcher_binding(struct weston_keyboard *keyboard, uint32_t time,
+		 uint32_t key, void *data)
 {
 	struct desktop_shell *shell = data;
 	struct switcher *switcher;
@@ -6175,14 +6180,14 @@ switcher_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
 	restore_all_output_modes(shell->compositor);
 	lower_fullscreen_layer(switcher->shell);
 	switcher->grab.interface = &switcher_grab;
-	weston_keyboard_start_grab(seat->keyboard, &switcher->grab);
-	weston_keyboard_set_focus(seat->keyboard, NULL);
+	weston_keyboard_start_grab(keyboard, &switcher->grab);
+	weston_keyboard_set_focus(keyboard, NULL);
 	switcher_next(switcher);
 }
 
 static void
-backlight_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
-		  void *data)
+backlight_binding(struct weston_keyboard *keyboard, uint32_t time,
+		  uint32_t key, void *data)
 {
 	struct weston_compositor *compositor = data;
 	struct weston_output *output;
@@ -6214,8 +6219,8 @@ backlight_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
 }
 
 static void
-force_kill_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
-		   void *data)
+force_kill_binding(struct weston_keyboard *keyboard, uint32_t time,
+		   uint32_t key, void *data)
 {
 	struct weston_surface *focus_surface;
 	struct wl_client *client;
@@ -6223,7 +6228,7 @@ force_kill_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
 	struct weston_compositor *compositor = shell->compositor;
 	pid_t pid;
 
-	focus_surface = seat->keyboard->focus;
+	focus_surface = keyboard->focus;
 	if (!focus_surface)
 		return;
 
@@ -6241,7 +6246,7 @@ force_kill_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
 }
 
 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)
 {
 	struct desktop_shell *shell = data;
@@ -6256,7 +6261,7 @@ workspace_up_binding(struct weston_seat *seat, uint32_t time,
 }
 
 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)
 {
 	struct desktop_shell *shell = data;
@@ -6271,7 +6276,7 @@ workspace_down_binding(struct weston_seat *seat, uint32_t time,
 }
 
 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)
 {
 	struct desktop_shell *shell = data;
@@ -6287,8 +6292,8 @@ workspace_f_binding(struct weston_seat *seat, uint32_t time,
 }
 
 static void
-workspace_move_surface_up_binding(struct weston_seat *seat, uint32_t time,
-				  uint32_t key, void *data)
+workspace_move_surface_up_binding(struct weston_keyboard *keyboard,
+				  uint32_t time, uint32_t key, void *data)
 {
 	struct desktop_shell *shell = data;
 	unsigned int new_index = shell->workspaces.current;
@@ -6299,12 +6304,12 @@ workspace_move_surface_up_binding(struct weston_seat *seat, uint32_t time,
 	if (new_index != 0)
 		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
-workspace_move_surface_down_binding(struct weston_seat *seat, uint32_t time,
-				    uint32_t key, void *data)
+workspace_move_surface_down_binding(struct weston_keyboard *keyboard,
+				    uint32_t time, uint32_t key, void *data)
 {
 	struct desktop_shell *shell = data;
 	unsigned int new_index = shell->workspaces.current;
@@ -6315,7 +6320,7 @@ workspace_move_surface_down_binding(struct weston_seat *seat, uint32_t time,
 	if (new_index < shell->workspaces.num - 1)
 		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
diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h
index 2cfd1d6..ead9121 100644
--- a/desktop-shell/shell.h
+++ b/desktop-shell/shell.h
@@ -234,7 +234,7 @@ activate(struct desktop_shell *shell, struct weston_surface *es,
 	 struct weston_seat *seat, bool configure);
 
 void
-exposay_binding(struct weston_seat *seat,
+exposay_binding(struct weston_keyboard *keyboard,
 		enum weston_keyboard_modifier modifier,
 		void *data);
 int
diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
index 4a688cc..f7ee8e2 100644
--- a/ivi-shell/ivi-shell.c
+++ b/ivi-shell/ivi-shell.c
@@ -338,8 +338,8 @@ shell_destroy(struct wl_listener *listener, void *data)
 }
 
 static void
-terminate_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
-		  void *data)
+terminate_binding(struct weston_keyboard *keyboard, uint32_t time,
+		  uint32_t key, void *data)
 {
 	struct weston_compositor *compositor = data;
 
diff --git a/src/bindings.c b/src/bindings.c
index 71a982c..31dcd63 100644
--- a/src/bindings.c
+++ b/src/bindings.c
@@ -294,7 +294,7 @@ weston_compositor_run_key_binding(struct weston_compositor *compositor,
 		if (b->key == key && b->modifier == seat->modifier_state) {
 			weston_key_binding_handler_t handler = b->handler;
 			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
 			 * install a keyboard grab, install one now to
@@ -333,7 +333,7 @@ weston_compositor_run_modifier_binding(struct weston_compositor *compositor,
 			return;
 		}
 
-		handler(seat, modifier, b->data);
+		handler(seat->keyboard, modifier, b->data);
 	}
 }
 
@@ -355,7 +355,7 @@ weston_compositor_run_button_binding(struct weston_compositor *compositor,
 	wl_list_for_each_safe(b, tmp, &compositor->button_binding_list, link) {
 		if (b->button == button && b->modifier == seat->modifier_state) {
 			weston_button_binding_handler_t handler = b->handler;
-			handler(seat, time, button, b->data);
+			handler(seat->pointer, time, button, b->data);
 		}
 	}
 }
@@ -373,7 +373,7 @@ weston_compositor_run_touch_binding(struct weston_compositor *compositor,
 	wl_list_for_each_safe(b, tmp, &compositor->touch_binding_list, link) {
 		if (b->modifier == seat->modifier_state) {
 			weston_touch_binding_handler_t handler = b->handler;
-			handler(seat, time, b->data);
+			handler(seat->touch, time, b->data);
 		}
 	}
 }
@@ -393,7 +393,7 @@ weston_compositor_run_axis_binding(struct weston_compositor *compositor,
 	wl_list_for_each_safe(b, tmp, &compositor->axis_binding_list, link) {
 		if (b->axis == axis && b->modifier == seat->modifier_state) {
 			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;
 		}
 	}
@@ -417,7 +417,7 @@ weston_compositor_run_debug_binding(struct weston_compositor *compositor,
 
 		count++;
 		handler = binding->handler;
-		handler(seat, time, key, binding->data);
+		handler(seat->keyboard, time, key, binding->data);
 	}
 
 	return count;
@@ -536,7 +536,8 @@ struct weston_keyboard_grab_interface debug_binding_keyboard_grab = {
 };
 
 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;
 
@@ -544,10 +545,10 @@ debug_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data)
 	if (!grab)
 		return;
 
-	grab->seat = seat;
+	grab->seat = keyboard->seat;
 	grab->key[0] = key;
 	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.
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index b13e0c0..3463dc1 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -2563,7 +2563,8 @@ session_notify(struct wl_listener *listener, void *data)
 }
 
 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;
 
@@ -2627,7 +2628,8 @@ find_primary_gpu(struct drm_compositor *ec, const char *seat)
 }
 
 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_compositor *c = data;
 
@@ -2707,7 +2709,7 @@ create_recorder(struct drm_compositor *c, int width, int height,
 }
 
 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)
 {
 	struct drm_compositor *c = data;
@@ -2792,10 +2794,11 @@ switch_to_gl_renderer(struct drm_compositor *c)
 }
 
 static void
-renderer_switch_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
-			void *data)
+renderer_switch_binding(struct weston_keyboard *keyboard, uint32_t time,
+			uint32_t key, void *data)
 {
-	struct drm_compositor *c = (struct drm_compositor *) seat->compositor;
+	struct drm_compositor *c =
+		(struct drm_compositor *)keyboard->seat->compositor;
 
 	switch_to_gl_renderer(c);
 }
diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
index 3f3394f..582ce47 100644
--- a/src/compositor-fbdev.c
+++ b/src/compositor-fbdev.c
@@ -797,7 +797,8 @@ fbdev_restore(struct weston_compositor *compositor)
 }
 
 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;
 
diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
index 1c0a783..a7d763b 100644
--- a/src/compositor-rpi.c
+++ b/src/compositor-rpi.c
@@ -442,7 +442,8 @@ rpi_restore(struct weston_compositor *compositor)
 }
 
 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;
 
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 935701a..15f58b7 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -1920,14 +1920,14 @@ create_cursor(struct wayland_compositor *c, struct weston_config *config)
 }
 
 static void
-fullscreen_binding(struct weston_seat *seat_base, uint32_t time, uint32_t key,
-		   void *data)
+fullscreen_binding(struct weston_keyboard *keyboard, uint32_t time,
+		   uint32_t key, void *data)
 {
 	struct wayland_compositor *c = data;
 	struct wayland_input *input = NULL;
 
 	wl_list_for_each(input, &c->input_list, link)
-		if (&input->base == seat_base)
+		if (&input->base == keyboard->seat)
 			break;
 
 	if (!input || !input->output)
diff --git a/src/compositor.c b/src/compositor.c
index 8f02b4d..041c03f 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -4485,7 +4485,7 @@ weston_environment_get_fd(const char *env)
 }
 
 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)
 {
 	struct weston_compositor *compositor = data;
diff --git a/src/compositor.h b/src/compositor.h
index 867f8c4..4d9e1a0 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -1150,7 +1150,7 @@ weston_compositor_pick_view(struct weston_compositor *compositor,
 
 
 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,
 					     void *data);
 struct weston_binding *
@@ -1160,7 +1160,7 @@ weston_compositor_add_key_binding(struct weston_compositor *compositor,
 				  weston_key_binding_handler_t binding,
 				  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,
 					          void *data);
 struct weston_binding *
@@ -1169,7 +1169,7 @@ weston_compositor_add_modifier_binding(struct weston_compositor *compositor,
 				       weston_modifier_binding_handler_t binding,
 				       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,
 						void *data);
 struct weston_binding *
@@ -1179,7 +1179,7 @@ weston_compositor_add_button_binding(struct weston_compositor *compositor,
 				     weston_button_binding_handler_t binding,
 				     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,
 					       void *data);
 struct weston_binding *
@@ -1188,7 +1188,7 @@ weston_compositor_add_touch_binding(struct weston_compositor *compositor,
 				    weston_touch_binding_handler_t binding,
 				    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,
 					      wl_fixed_t value, void *data);
 struct weston_binding *
diff --git a/src/gl-renderer.c b/src/gl-renderer.c
index d18e124..d28f0fc 100644
--- a/src/gl-renderer.c
+++ b/src/gl-renderer.c
@@ -2425,8 +2425,8 @@ compile_shaders(struct weston_compositor *ec)
 }
 
 static void
-fragment_debug_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
-		       void *data)
+fragment_debug_binding(struct weston_keyboard *keyboard, uint32_t time,
+		       uint32_t key, void *data)
 {
 	struct weston_compositor *ec = data;
 	struct gl_renderer *gr = get_renderer(ec);
@@ -2451,8 +2451,8 @@ fragment_debug_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
 }
 
 static void
-fan_debug_repaint_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
-		      void *data)
+fan_debug_repaint_binding(struct weston_keyboard *keyboard, uint32_t time,
+			  uint32_t key, void *data)
 {
 	struct weston_compositor *compositor = data;
 	struct gl_renderer *gr = get_renderer(compositor);
diff --git a/src/pixman-renderer.c b/src/pixman-renderer.c
index c650d55..74a9416 100644
--- a/src/pixman-renderer.c
+++ b/src/pixman-renderer.c
@@ -800,7 +800,7 @@ pixman_renderer_surface_copy_content(struct weston_surface *surface,
 }
 
 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)
 {
 	struct weston_compositor *ec = data;
diff --git a/src/screenshooter.c b/src/screenshooter.c
index fc648a1..fd9571f 100644
--- a/src/screenshooter.c
+++ b/src/screenshooter.c
@@ -282,8 +282,8 @@ screenshooter_sigchld(struct weston_process *process, int status)
 }
 
 static void
-screenshooter_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
-		      void *data)
+screenshooter_binding(struct weston_keyboard *keyboard, uint32_t time,
+		      uint32_t key, void *data)
 {
 	struct screenshooter *shooter = data;
 	char *screenshooter_exe;
@@ -556,9 +556,10 @@ weston_recorder_destroy(struct weston_recorder *recorder)
 }
 
 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 wl_listener *listener = NULL;
 	struct weston_recorder *recorder;
@@ -582,9 +583,8 @@ recorder_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *da
 		recorder->destroying = 1;
 		weston_output_schedule_repaint(recorder->output);
 	} else {
-		if (seat->keyboard && seat->keyboard->focus &&
-		    seat->keyboard->focus->output)
-			output = seat->keyboard->focus->output;
+		if (keyboard->focus && keyboard->focus->output)
+			output = keyboard->focus->output;
 		else
 			output = container_of(ec->output_list.next,
 					      struct weston_output, link);
diff --git a/tests/surface-screenshot.c b/tests/surface-screenshot.c
index 57ec925..8badcf2 100644
--- a/tests/surface-screenshot.c
+++ b/tests/surface-screenshot.c
@@ -128,13 +128,14 @@ unpremultiply_and_swap_a8b8g8r8_to_PAMrgba(void *pixels, size_t size)
 }
 
 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)
 {
 	const char *prefix = "surfaceshot-";
 	const char *suffix = ".pam";
 	char fname[1024];
 	struct weston_surface *surface;
+	struct weston_seat *seat = keyboard->seat;
 	int width, height;
 	char desc[512];
 	void *pixels;
-- 
2.1.4



More information about the wayland-devel mailing list