weston_xkb_info: Cache all modifier indices for X11

X11 has a set of eight modifiers which we want to represent.  Cache
their indices when we create a weston_xkb_info, so we can use this from
compositor-x11 to keep the state synchronised exactly between the host X
server and a nested Weston instance.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
Daniel Stone 2012-06-22 13:21:33 +01:00 committed by Kristian Høgsberg
parent ef17267d38
commit abb9dcdd1f
2 changed files with 12 additions and 0 deletions

View File

@ -2380,12 +2380,19 @@ weston_xkb_info_new_keymap(struct weston_xkb_info *xkb_info)
{ {
char *keymap_str; char *keymap_str;
xkb_info->shift_mod = xkb_map_mod_get_index(xkb_info->keymap,
XKB_MOD_NAME_SHIFT);
xkb_info->caps_mod = xkb_map_mod_get_index(xkb_info->keymap,
XKB_MOD_NAME_CAPS);
xkb_info->ctrl_mod = xkb_map_mod_get_index(xkb_info->keymap, xkb_info->ctrl_mod = xkb_map_mod_get_index(xkb_info->keymap,
XKB_MOD_NAME_CTRL); XKB_MOD_NAME_CTRL);
xkb_info->alt_mod = xkb_map_mod_get_index(xkb_info->keymap, xkb_info->alt_mod = xkb_map_mod_get_index(xkb_info->keymap,
XKB_MOD_NAME_ALT); XKB_MOD_NAME_ALT);
xkb_info->mod2_mod = xkb_map_mod_get_index(xkb_info->keymap, "Mod2");
xkb_info->mod3_mod = xkb_map_mod_get_index(xkb_info->keymap, "Mod3");
xkb_info->super_mod = xkb_map_mod_get_index(xkb_info->keymap, xkb_info->super_mod = xkb_map_mod_get_index(xkb_info->keymap,
XKB_MOD_NAME_LOGO); XKB_MOD_NAME_LOGO);
xkb_info->mod5_mod = xkb_map_mod_get_index(xkb_info->keymap, "Mod5");
xkb_info->num_led = xkb_map_led_get_index(xkb_info->keymap, xkb_info->num_led = xkb_map_led_get_index(xkb_info->keymap,
XKB_LED_NAME_NUM); XKB_LED_NAME_NUM);

View File

@ -189,9 +189,14 @@ struct weston_xkb_info {
int keymap_fd; int keymap_fd;
size_t keymap_size; size_t keymap_size;
char *keymap_area; char *keymap_area;
xkb_mod_index_t shift_mod;
xkb_mod_index_t caps_mod;
xkb_mod_index_t ctrl_mod; xkb_mod_index_t ctrl_mod;
xkb_mod_index_t alt_mod; xkb_mod_index_t alt_mod;
xkb_mod_index_t mod2_mod;
xkb_mod_index_t mod3_mod;
xkb_mod_index_t super_mod; xkb_mod_index_t super_mod;
xkb_mod_index_t mod5_mod;
xkb_led_index_t num_led; xkb_led_index_t num_led;
xkb_led_index_t caps_led; xkb_led_index_t caps_led;
xkb_led_index_t scroll_led; xkb_led_index_t scroll_led;