@ -280,12 +280,13 @@ install_binding_grab(struct weston_keyboard *keyboard, uint32_t time,
void
weston_compositor_run_key_binding ( struct weston_compositor * compositor ,
struct weston_seat * seat ,
struct weston_keyboard * keyboard ,
uint32_t time , uint32_t key ,
enum wl_keyboard_key_state state )
{
struct weston_binding * b , * tmp ;
struct weston_surface * focus ;
struct weston_seat * seat = keyboard - > seat ;
if ( state = = WL_KEYBOARD_KEY_STATE_RELEASED )
return ;
@ -297,15 +298,15 @@ weston_compositor_run_key_binding(struct weston_compositor *compositor,
wl_list_for_each_safe ( b , tmp , & compositor - > key_binding_list , link ) {
if ( b - > key = = key & & b - > modifier = = seat - > modifier_state ) {
weston_key_binding_handler_t handler = b - > handler ;
focus = seat - > keyboard - > focus ;
handler ( seat - > keyboard , time , key , b - > data ) ;
focus = keyboard - > focus ;
handler ( keyboard , time , key , b - > data ) ;
/* If this was a key binding and it didn't
* install a keyboard grab , install one now to
* swallow the key press . */
if ( seat - > keyboard - > grab = =
& seat - > keyboard - > default_grab )
install_binding_grab ( seat - > keyboard ,
if ( keyboard - > grab = =
& keyboard - > default_grab )
install_binding_grab ( keyboard ,
time ,
key ,
focus ) ;
@ -315,13 +316,13 @@ weston_compositor_run_key_binding(struct weston_compositor *compositor,
void
weston_compositor_run_modifier_binding ( struct weston_compositor * compositor ,
struct weston_seat * seat ,
struct weston_keyboard * keyboard ,
enum weston_keyboard_modifier modifier ,
enum wl_keyboard_key_state state )
{
struct weston_binding * b , * tmp ;
if ( seat - > keyboard - > grab ! = & seat - > keyboard - > default_grab )
if ( keyboard - > grab ! = & keyboard - > default_grab )
return ;
wl_list_for_each_safe ( b , tmp , & compositor - > modifier_binding_list , link ) {
@ -340,13 +341,13 @@ weston_compositor_run_modifier_binding(struct weston_compositor *compositor,
return ;
}
handler ( seat - > keyboard , modifier , b - > data ) ;
handler ( keyboard , modifier , b - > data ) ;
}
}
void
weston_compositor_run_button_binding ( struct weston_compositor * compositor ,
struct weston_seat * seat ,
struct weston_pointer * pointer ,
uint32_t time , uint32_t button ,
enum wl_pointer_button_state state )
{
@ -360,34 +361,35 @@ weston_compositor_run_button_binding(struct weston_compositor *compositor,
b - > key = button ;
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 = = pointer - > seat - > modifier_state ) {
weston_button_binding_handler_t handler = b - > handler ;
handler ( seat - > pointer , time , button , b - > data ) ;
handler ( pointer , time , button , b - > data ) ;
}
}
}
void
weston_compositor_run_touch_binding ( struct weston_compositor * compositor ,
struct weston_sea t * sea t, uint32_t time ,
struct weston_touch * touch , uint32_t time ,
int touch_type )
{
struct weston_binding * b , * tmp ;
if ( seat - > touch - > num_tp ! = 1 | | touch_type ! = WL_TOUCH_DOWN )
if ( touch - > num_tp ! = 1 | | touch_type ! = WL_TOUCH_DOWN )
return ;
wl_list_for_each_safe ( b , tmp , & compositor - > touch_binding_list , link ) {
if ( b - > modifier = = seat - > modifier_state ) {
if ( b - > modifier = = touch - > seat - > modifier_state ) {
weston_touch_binding_handler_t handler = b - > handler ;
handler ( seat - > touch , time , b - > data ) ;
handler ( touch , time , b - > data ) ;
}
}
}
int
weston_compositor_run_axis_binding ( struct weston_compositor * compositor ,
struct weston_seat * seat ,
struct weston_pointer * pointer ,
uint32_t time , uint32_t axis ,
wl_fixed_t value )
{
@ -398,9 +400,10 @@ weston_compositor_run_axis_binding(struct weston_compositor *compositor,
b - > key = axis ;
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 = = pointer - > seat - > modifier_state ) {
weston_axis_binding_handler_t handler = b - > handler ;
handler ( seat - > pointer , time , axis , value , b - > data ) ;
handler ( pointer , time , axis , value , b - > data ) ;
return 1 ;
}
}
@ -410,7 +413,7 @@ weston_compositor_run_axis_binding(struct weston_compositor *compositor,
int
weston_compositor_run_debug_binding ( struct weston_compositor * compositor ,
struct weston_seat * seat ,
struct weston_keyboard * keyboard ,
uint32_t time , uint32_t key ,
enum wl_keyboard_key_state state )
{
@ -424,7 +427,7 @@ weston_compositor_run_debug_binding(struct weston_compositor *compositor,
count + + ;
handler = binding - > handler ;
handler ( seat - > keyboard , time , key , binding - > data ) ;
handler ( keyboard , time , key , binding - > data ) ;
}
return count ;
@ -480,8 +483,8 @@ debug_binding_key(struct weston_keyboard_grab *grab, uint32_t time,
}
if ( check_binding ) {
if ( weston_compositor_run_debug_binding ( ec , db - > seat , time ,
key , state ) ) {
if ( weston_compositor_run_debug_binding ( ec , grab - > keyboard ,
time , key , state ) ) {
/* We ran a binding so swallow the press and keep the
* grab to swallow the released too . */
send = 0 ;