From ca3170ad3813389a3325513130c37e8038fa02f9 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 8 Feb 2013 13:09:33 +0200 Subject: Add struct xkb_mod_set The only thing that the compilation phase needs the keymap for currently is for access to the modifier information (it also modifies it in place!). We want to only pass along the neccessary information, to make it more tractable and testable, so instead of passing the entire keymap we add a new 'mod_set' object and pass a (const) reference to that. The new object is just the old array of 'struct xkb_mod'. Signed-off-by: Ran Benita --- src/x11/keymap.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/x11') diff --git a/src/x11/keymap.c b/src/x11/keymap.c index 76adf74..716fc51 100644 --- a/src/x11/keymap.c +++ b/src/x11/keymap.c @@ -508,13 +508,14 @@ get_vmods(struct xkb_keymap *keymap, xcb_connection_t *conn, { uint8_t *iter = xcb_xkb_get_map_map_vmods_rtrn(map); - darray_resize0(keymap->mods, + darray_resize0(keymap->mods.mods, NUM_REAL_MODS + msb_pos(reply->virtualMods)); for (unsigned i = 0; i < NUM_VMODS; i++) { if (reply->virtualMods & (1u << i)) { uint8_t wire = *iter; - struct xkb_mod *mod = &darray_item(keymap->mods, NUM_REAL_MODS + i); + struct xkb_mod *mod = &darray_item(keymap->mods.mods, + NUM_REAL_MODS + i); mod->type = MOD_VIRT; mod->mapping = translate_mods(wire, 0, 0); @@ -919,12 +920,14 @@ get_vmod_names(struct xkb_keymap *keymap, xcb_connection_t *conn, * tells us which vmods exist (a vmod must have a name), so we fix * up the size here. */ - darray_resize0(keymap->mods, NUM_REAL_MODS + msb_pos(reply->virtualMods)); + darray_resize0(keymap->mods.mods, + NUM_REAL_MODS + msb_pos(reply->virtualMods)); for (unsigned i = 0; i < NUM_VMODS; i++) { if (reply->virtualMods & (1u << i)) { xcb_atom_t wire = *iter; - struct xkb_mod *mod = &darray_item(keymap->mods, NUM_REAL_MODS + i); + struct xkb_mod *mod = &darray_item(keymap->mods.mods, + NUM_REAL_MODS + i); if (!adopt_atom(keymap->ctx, conn, wire, &mod->name)) return false; -- cgit v1.2.1