bindings: Make run binding functions take apropriate device instead of a seat
Going from seat to input device requires that we test the device
before relying on the pointer. In all of these binding functions
we can trust exactly one input device type directly. If we pass
that in instead of a seat it's more obvious that we can trust
the one pointer we have.
When a seat is required, we can access through the device we have
and use that to get to other device types for the seat, provided
we validate them appropriately.
Reviewed-by: Jonas Ã…dahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
diff --git a/src/input.c b/src/input.c
index 568985f..1d7e705 100644
--- a/src/input.c
+++ b/src/input.c
@@ -973,7 +973,7 @@
for (i = 0; i < ARRAY_LENGTH(mods); i++) {
if (diff & (1 << mods[i].xkb))
weston_compositor_run_modifier_binding(compositor,
- seat,
+ keyboard,
mods[i].weston,
WL_KEYBOARD_KEY_STATE_PRESSED);
}
@@ -982,7 +982,7 @@
for (i = 0; i < ARRAY_LENGTH(mods); i++) {
if (diff & (1 << mods[i].xkb))
weston_compositor_run_modifier_binding(compositor,
- seat,
+ keyboard,
mods[i].weston,
WL_KEYBOARD_KEY_STATE_RELEASED);
}
@@ -1034,7 +1034,7 @@
pointer->button_count--;
}
- weston_compositor_run_button_binding(compositor, seat, time, button,
+ weston_compositor_run_button_binding(compositor, pointer, time, button,
state);
pointer->grab->interface->button(pointer->grab, time, button, state);
@@ -1058,8 +1058,8 @@
if (!value)
return;
- if (weston_compositor_run_axis_binding(compositor, seat,
- time, axis, value))
+ if (weston_compositor_run_axis_binding(compositor, pointer,
+ time, axis, value))
return;
resource_list = &pointer->focus_resource_list;
@@ -1346,8 +1346,8 @@
if (grab == &keyboard->default_grab ||
grab == &keyboard->input_method_grab) {
- weston_compositor_run_key_binding(compositor, seat, time, key,
- state);
+ weston_compositor_run_key_binding(compositor, keyboard, time,
+ key, state);
grab = keyboard->grab;
}
@@ -1542,7 +1542,7 @@
return;
}
- weston_compositor_run_touch_binding(ec, seat,
+ weston_compositor_run_touch_binding(ec, touch,
time, touch_type);
grab->interface->down(grab, time, touch_id, sx, sy);