diff options
author | Ran Benita <ran234@gmail.com> | 2012-10-23 20:29:39 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@googlemail.com> | 2012-10-27 18:05:59 +0200 |
commit | ae78864cc96b7980f59b3540b73027d2cfae87ba (patch) | |
tree | 6255a8848e908418be5016f06d0b690019d64bb5 | |
parent | 5be89722708f5071ff6630fad1331d3f6d149ae3 (diff) |
xkb: don't use deprecated libxkbcommon symbols
Now that libxkbcommon had a release, that has some API breakage (in
particular to xkb_keysym_from_name), we should update our code against
it and advise users to just use the xkbcommon release.
This should not happen anymore, for the foreseeable future at least.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
-rw-r--r-- | src/shl_misc.h | 12 | ||||
-rw-r--r-- | src/uterm_input_uxkb.c | 21 | ||||
-rw-r--r-- | src/wlt_toolkit.c | 10 |
3 files changed, 22 insertions, 21 deletions
diff --git a/src/shl_misc.h b/src/shl_misc.h index 4731190..eb21ad4 100644 --- a/src/shl_misc.h +++ b/src/shl_misc.h @@ -205,19 +205,19 @@ static inline unsigned int shl_get_xkb_mods(struct xkb_state *state) unsigned int mods = 0; if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_SHIFT, - XKB_STATE_EFFECTIVE) > 0) + XKB_STATE_MODS_EFFECTIVE) > 0) mods |= SHL_SHIFT_MASK; if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CAPS, - XKB_STATE_EFFECTIVE) > 0) + XKB_STATE_MODS_EFFECTIVE) > 0) mods |= SHL_LOCK_MASK; if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CTRL, - XKB_STATE_EFFECTIVE) > 0) + XKB_STATE_MODS_EFFECTIVE) > 0) mods |= SHL_CONTROL_MASK; if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_ALT, - XKB_STATE_EFFECTIVE) > 0) + XKB_STATE_MODS_EFFECTIVE) > 0) mods |= SHL_ALT_MASK; if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_LOGO, - XKB_STATE_EFFECTIVE) > 0) + XKB_STATE_MODS_EFFECTIVE) > 0) mods |= SHL_LOGO_MASK; return mods; @@ -237,7 +237,7 @@ static inline uint32_t shl_get_ascii(struct xkb_state *state, uint32_t keycode, if (num_keysyms == 1 && keysyms[0] < 128) return keysyms[0]; - keymap = xkb_state_get_map(state); + keymap = xkb_state_get_keymap(state); num_layouts = xkb_keymap_num_layouts_for_key(keymap, keycode); for (layout = 0; layout < num_layouts; layout++) { diff --git a/src/uterm_input_uxkb.c b/src/uterm_input_uxkb.c index 5ba4557..246abe7 100644 --- a/src/uterm_input_uxkb.c +++ b/src/uterm_input_uxkb.c @@ -59,7 +59,7 @@ int uxkb_desc_init(struct uterm_input *input, return -ENOMEM; } - input->keymap = xkb_map_new_from_names(input->ctx, &rmlvo, 0); + input->keymap = xkb_keymap_new_from_names(input->ctx, &rmlvo, 0); if (!input->keymap) { log_warn("failed to create keymap (%s, %s, %s), " "reverting to default US keymap", @@ -69,7 +69,8 @@ int uxkb_desc_init(struct uterm_input *input, rmlvo.variant = ""; rmlvo.options = ""; - input->keymap = xkb_map_new_from_names(input->ctx, &rmlvo, 0); + input->keymap = xkb_keymap_new_from_names(input->ctx, + &rmlvo, 0); if (!input->keymap) { log_warn("failed to create XKB keymap"); ret = -EFAULT; @@ -88,7 +89,7 @@ err_ctx: void uxkb_desc_destroy(struct uterm_input *input) { - xkb_map_unref(input->keymap); + xkb_keymap_unref(input->keymap); xkb_context_unref(input->ctx); } @@ -208,7 +209,7 @@ static int uxkb_dev_fill_event(struct uterm_input_dev *dev, static void uxkb_dev_repeat(struct uterm_input_dev *dev, unsigned int state) { - struct xkb_keymap *keymap = xkb_state_get_map(dev->state); + struct xkb_keymap *keymap = xkb_state_get_keymap(dev->state); unsigned int i; int num_keysyms, ret; const uint32_t *keysyms; @@ -223,7 +224,7 @@ static void uxkb_dev_repeat(struct uterm_input_dev *dev, unsigned int state) } if (state == KEY_PRESSED && - xkb_key_repeats(keymap, dev->event.keycode)) { + xkb_keymap_key_repeats(keymap, dev->event.keycode)) { dev->repeat_event.keycode = dev->event.keycode; dev->repeat_event.ascii = dev->event.ascii; dev->repeat_event.mods = dev->event.mods; @@ -235,10 +236,10 @@ static void uxkb_dev_repeat(struct uterm_input_dev *dev, unsigned int state) dev->event.codepoints[i]; } } else if (dev->repeating && - !xkb_key_repeats(keymap, dev->event.keycode)) { - num_keysyms = xkb_key_get_syms(dev->state, - dev->repeat_event.keycode, - &keysyms); + !xkb_keymap_key_repeats(keymap, dev->event.keycode)) { + num_keysyms = xkb_state_key_get_syms(dev->state, + dev->repeat_event.keycode, + &keysyms); if (num_keysyms <= 0) return; @@ -275,7 +276,7 @@ int uxkb_dev_process(struct uterm_input_dev *dev, state = dev->state; keycode = code + EVDEV_KEYCODE_OFFSET; - num_keysyms = xkb_key_get_syms(state, keycode, &keysyms); + num_keysyms = xkb_state_key_get_syms(state, keycode, &keysyms); if (key_state == KEY_PRESSED) xkb_state_update_key(state, keycode, XKB_KEY_DOWN); diff --git a/src/wlt_toolkit.c b/src/wlt_toolkit.c index c9f9741..7ae6fdc 100644 --- a/src/wlt_toolkit.c +++ b/src/wlt_toolkit.c @@ -584,9 +584,9 @@ static void keyboard_keymap(void *data, struct wl_keyboard *keyboard, return; } - disp->xkb_keymap = xkb_map_new_from_string(disp->xkb_ctx, map, - XKB_KEYMAP_FORMAT_TEXT_V1, - 0); + disp->xkb_keymap = xkb_keymap_new_from_string(disp->xkb_ctx, map, + XKB_KEYMAP_FORMAT_TEXT_V1, + 0); munmap(map, size); close(fd); @@ -598,7 +598,7 @@ static void keyboard_keymap(void *data, struct wl_keyboard *keyboard, disp->xkb_state = xkb_state_new(disp->xkb_keymap); if (!disp->xkb_state) { log_error("cannot create XKB state object"); - xkb_map_unref(disp->xkb_keymap); + xkb_keymap_unref(disp->xkb_keymap); disp->xkb_keymap = NULL; return; } @@ -666,7 +666,7 @@ static void keyboard_key(void *data, struct wl_keyboard *keyboard, return; mask = shl_get_xkb_mods(disp->xkb_state); - num_syms = xkb_key_get_syms(disp->xkb_state, code, &syms); + num_syms = xkb_state_key_get_syms(disp->xkb_state, code, &syms); ascii = shl_get_ascii(disp->xkb_state, code, syms, num_syms); sym = XKB_KEY_NoSymbol; if (num_syms == 1) |