@ -1731,13 +1731,16 @@ notify_axis(struct wl_seat *seat, uint32_t time, uint32_t axis, int32_t value)
static int
static int
update_modifier_state ( struct weston_seat * seat , uint32_t key , uint32_t state )
update_modifier_state ( struct weston_seat * seat , uint32_t key , uint32_t state )
{
{
enum weston_keyboard_modifier modifier ;
uint32_t mods_depressed , mods_latched , mods_locked , group ;
uint32_t mods_depressed , mods_latched , mods_locked , group ;
uint32_t mods_lookup ;
int ret = 0 ;
int ret = 0 ;
/* First update the XKB state object with the keypress. */
xkb_state_update_key ( seat - > xkb_state . state , key + 8 ,
xkb_state_update_key ( seat - > xkb_state . state , key + 8 ,
state ? XKB_KEY_DOWN : XKB_KEY_UP ) ;
state ? XKB_KEY_DOWN : XKB_KEY_UP ) ;
/* Serialize and update our internal state, checking to see if it's
* different to the previous state . */
mods_depressed = xkb_state_serialize_mods ( seat - > xkb_state . state ,
mods_depressed = xkb_state_serialize_mods ( seat - > xkb_state . state ,
XKB_STATE_DEPRESSED ) ;
XKB_STATE_DEPRESSED ) ;
mods_latched = xkb_state_serialize_mods ( seat - > xkb_state . state ,
mods_latched = xkb_state_serialize_mods ( seat - > xkb_state . state ,
@ -1758,31 +1761,15 @@ update_modifier_state(struct weston_seat *seat, uint32_t key, uint32_t state)
seat - > xkb_state . mods_locked = mods_locked ;
seat - > xkb_state . mods_locked = mods_locked ;
seat - > xkb_state . group = group ;
seat - > xkb_state . group = group ;
switch ( key ) {
/* And update the modifier_state for bindings. */
case KEY_LEFTCTRL :
mods_lookup = mods_depressed | mods_latched ;
case KEY_RIGHTCTRL :
seat - > modifier_state = 0 ;
modifier = MODIFIER_CTRL ;
if ( ( mods_lookup & seat - > compositor - > xkb_info . ctrl_mod ) )
break ;
seat - > modifier_state | = MODIFIER_CTRL ;
if ( ( mods_lookup & seat - > compositor - > xkb_info . alt_mod ) )
case KEY_LEFTALT :
seat - > modifier_state | = MODIFIER_ALT ;
case KEY_RIGHTALT :
if ( ( mods_lookup & seat - > compositor - > xkb_info . super_mod ) )
modifier = MODIFIER_ALT ;
seat - > modifier_state | = MODIFIER_SUPER ;
break ;
case KEY_LEFTMETA :
case KEY_RIGHTMETA :
modifier = MODIFIER_SUPER ;
break ;
default :
modifier = 0 ;
break ;
}
if ( state )
seat - > modifier_state | = modifier ;
else
seat - > modifier_state & = ~ modifier ;
return ret ;
return ret ;
}
}
@ -2243,6 +2230,13 @@ static int weston_compositor_xkb_init(struct weston_compositor *ec,
return - 1 ;
return - 1 ;
}
}
ec - > xkb_info . ctrl_mod = xkb_map_mod_get_index ( ec - > xkb_info . keymap ,
XKB_MOD_NAME_CTRL ) ;
ec - > xkb_info . alt_mod = xkb_map_mod_get_index ( ec - > xkb_info . keymap ,
XKB_MOD_NAME_ALT ) ;
ec - > xkb_info . super_mod = xkb_map_mod_get_index ( ec - > xkb_info . keymap ,
XKB_MOD_NAME_LOGO ) ;
return 0 ;
return 0 ;
}
}