summaryrefslogtreecommitdiff
path: root/src/bindings.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2015-07-15 13:00:36 -0500
committerBryce Harrington <bryce@osg.samsung.com>2015-07-16 19:03:43 -0700
commit8ae2db5b0cc5673e442938aa176cb44ada3e20ca (patch)
tree3cd6d82774f2774bdc1fb10c77360f903bad223f /src/bindings.c
parent0720ea36c8ee7e957d292a9ca41f35b403f39062 (diff)
downloadweston-8ae2db5b0cc5673e442938aa176cb44ada3e20ca.tar.gz
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>
Diffstat (limited to 'src/bindings.c')
-rw-r--r--src/bindings.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/bindings.c b/src/bindings.c
index ec505dc9..cc726af5 100644
--- a/src/bindings.c
+++ b/src/bindings.c
@@ -298,7 +298,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
@@ -337,7 +337,7 @@ weston_compositor_run_modifier_binding(struct weston_compositor *compositor,
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) {
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);
}
}
}
@@ -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) {
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);
}
}
}
@@ -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) {
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;
}
}
@@ -421,7 +421,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;
@@ -540,7 +540,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;
@@ -548,10 +549,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.