Replace deprecated xkbcommon symbols with current names

These symbols (xkb_map_* and others) were replaced in xkbcommon with more
consistent names. See the header xkbcommon/xkbcommon-compat.h for how
the old names map to the new.

The new names have been available since the first stable xkbcommon
release (0.2.0).

Signed-off-by: Ran Benita <ran234@gmail.com>
dev
Ran Benita 10 years ago committed by Daniel Stone
parent 3f5e906268
commit 2e1968fa1f
  1. 22
      clients/weston-simple-im.c
  2. 24
      clients/window.c
  3. 10
      src/compositor-wayland.c
  4. 4
      src/compositor-x11.c
  5. 70
      src/input.c
  6. 10
      src/screen-share.c

@ -187,10 +187,10 @@ input_method_keyboard_keymap(void *data,
} }
keyboard->keymap = keyboard->keymap =
xkb_map_new_from_string(keyboard->xkb_context, xkb_keymap_new_from_string(keyboard->xkb_context,
map_str, map_str,
XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_FORMAT_TEXT_V1,
0); 0);
munmap(map_str, size); munmap(map_str, size);
close(fd); close(fd);
@ -203,16 +203,16 @@ input_method_keyboard_keymap(void *data,
keyboard->state = xkb_state_new(keyboard->keymap); keyboard->state = xkb_state_new(keyboard->keymap);
if (!keyboard->state) { if (!keyboard->state) {
fprintf(stderr, "failed to create XKB state\n"); fprintf(stderr, "failed to create XKB state\n");
xkb_map_unref(keyboard->keymap); xkb_keymap_unref(keyboard->keymap);
return; return;
} }
keyboard->control_mask = keyboard->control_mask =
1 << xkb_map_mod_get_index(keyboard->keymap, "Control"); 1 << xkb_keymap_mod_get_index(keyboard->keymap, "Control");
keyboard->alt_mask = keyboard->alt_mask =
1 << xkb_map_mod_get_index(keyboard->keymap, "Mod1"); 1 << xkb_keymap_mod_get_index(keyboard->keymap, "Mod1");
keyboard->shift_mask = keyboard->shift_mask =
1 << xkb_map_mod_get_index(keyboard->keymap, "Shift"); 1 << xkb_keymap_mod_get_index(keyboard->keymap, "Shift");
} }
static void static void
@ -234,7 +234,7 @@ input_method_keyboard_key(void *data,
return; return;
code = key + 8; code = key + 8;
num_syms = xkb_key_get_syms(keyboard->state, code, &syms); num_syms = xkb_state_key_get_syms(keyboard->state, code, &syms);
sym = XKB_KEY_NoSymbol; sym = XKB_KEY_NoSymbol;
if (num_syms == 1) if (num_syms == 1)
@ -261,8 +261,8 @@ input_method_keyboard_modifiers(void *data,
xkb_state_update_mask(keyboard->state, mods_depressed, xkb_state_update_mask(keyboard->state, mods_depressed,
mods_latched, mods_locked, 0, 0, group); mods_latched, mods_locked, 0, 0, group);
mask = xkb_state_serialize_mods(keyboard->state, mask = xkb_state_serialize_mods(keyboard->state,
XKB_STATE_DEPRESSED | XKB_STATE_MODS_DEPRESSED |
XKB_STATE_LATCHED); XKB_STATE_MODS_LATCHED);
keyboard->modifiers = 0; keyboard->modifiers = 0;
if (mask & keyboard->control_mask) if (mask & keyboard->control_mask)

@ -2749,10 +2749,10 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
return; return;
} }
keymap = xkb_map_new_from_string(input->display->xkb_context, keymap = xkb_keymap_new_from_string(input->display->xkb_context,
map_str, map_str,
XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_FORMAT_TEXT_V1,
0); 0);
munmap(map_str, size); munmap(map_str, size);
close(fd); close(fd);
@ -2764,7 +2764,7 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
state = xkb_state_new(keymap); state = xkb_state_new(keymap);
if (!state) { if (!state) {
fprintf(stderr, "failed to create XKB state\n"); fprintf(stderr, "failed to create XKB state\n");
xkb_map_unref(keymap); xkb_keymap_unref(keymap);
return; return;
} }
@ -2774,11 +2774,11 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
input->xkb.state = state; input->xkb.state = state;
input->xkb.control_mask = input->xkb.control_mask =
1 << xkb_map_mod_get_index(input->xkb.keymap, "Control"); 1 << xkb_keymap_mod_get_index(input->xkb.keymap, "Control");
input->xkb.alt_mask = input->xkb.alt_mask =
1 << xkb_map_mod_get_index(input->xkb.keymap, "Mod1"); 1 << xkb_keymap_mod_get_index(input->xkb.keymap, "Mod1");
input->xkb.shift_mask = input->xkb.shift_mask =
1 << xkb_map_mod_get_index(input->xkb.keymap, "Shift"); 1 << xkb_keymap_mod_get_index(input->xkb.keymap, "Shift");
} }
static void static void
@ -2834,7 +2834,7 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
if (input->grab && input->grab_button == 0) if (input->grab && input->grab_button == 0)
return; return;
num_syms = xkb_key_get_syms(input->xkb.state, code, &syms); num_syms = xkb_state_key_get_syms(input->xkb.state, code, &syms);
sym = XKB_KEY_NoSymbol; sym = XKB_KEY_NoSymbol;
if (num_syms == 1) if (num_syms == 1)
@ -2893,8 +2893,8 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched, xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched,
mods_locked, 0, 0, group); mods_locked, 0, 0, group);
mask = xkb_state_serialize_mods(input->xkb.state, mask = xkb_state_serialize_mods(input->xkb.state,
XKB_STATE_DEPRESSED | XKB_STATE_MODS_DEPRESSED |
XKB_STATE_LATCHED); XKB_STATE_MODS_LATCHED);
input->modifiers = 0; input->modifiers = 0;
if (mask & input->xkb.control_mask) if (mask & input->xkb.control_mask)
input->modifiers |= MOD_CONTROL_MASK; input->modifiers |= MOD_CONTROL_MASK;
@ -4993,7 +4993,7 @@ static void
fini_xkb(struct input *input) fini_xkb(struct input *input)
{ {
xkb_state_unref(input->xkb.state); xkb_state_unref(input->xkb.state);
xkb_map_unref(input->xkb.keymap); xkb_keymap_unref(input->xkb.keymap);
} }
#define MIN(a,b) ((a) < (b) ? a : b) #define MIN(a,b) ((a) < (b) ? a : b)

@ -1436,10 +1436,10 @@ input_handle_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format,
goto error; goto error;
} }
keymap = xkb_map_new_from_string(input->compositor->base.xkb_context, keymap = xkb_keymap_new_from_string(input->compositor->base.xkb_context,
map_str, map_str,
XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_FORMAT_TEXT_V1,
0); 0);
munmap(map_str, size); munmap(map_str, size);
if (!keymap) { if (!keymap) {
@ -1465,7 +1465,7 @@ input_handle_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format,
weston_seat_init_keyboard(&input->base, keymap); weston_seat_init_keyboard(&input->base, keymap);
if (keymap) if (keymap)
xkb_map_unref(keymap); xkb_keymap_unref(keymap);
return; return;

@ -154,7 +154,7 @@ x11_compositor_get_keymap(struct x11_compositor *c)
copy_prop_value(options); copy_prop_value(options);
#undef copy_prop_value #undef copy_prop_value
ret = xkb_map_new_from_names(c->base.xkb_context, &names, 0); ret = xkb_keymap_new_from_names(c->base.xkb_context, &names, 0);
free(reply); free(reply);
return ret; return ret;
@ -323,7 +323,7 @@ x11_input_create(struct x11_compositor *c, int no_input)
if (weston_seat_init_keyboard(&c->core_seat, keymap) < 0) if (weston_seat_init_keyboard(&c->core_seat, keymap) < 0)
return -1; return -1;
if (keymap) if (keymap)
xkb_map_unref(keymap); xkb_keymap_unref(keymap);
x11_compositor_setup_xkb(c); x11_compositor_setup_xkb(c);

@ -1078,13 +1078,13 @@ notify_modifiers(struct weston_seat *seat, uint32_t serial)
/* Serialize and update our internal state, checking to see if it's /* Serialize and update our internal state, checking to see if it's
* different to the previous state. */ * different to the previous state. */
mods_depressed = xkb_state_serialize_mods(keyboard->xkb_state.state, mods_depressed = xkb_state_serialize_mods(keyboard->xkb_state.state,
XKB_STATE_DEPRESSED); XKB_STATE_MODS_DEPRESSED);
mods_latched = xkb_state_serialize_mods(keyboard->xkb_state.state, mods_latched = xkb_state_serialize_mods(keyboard->xkb_state.state,
XKB_STATE_LATCHED); XKB_STATE_MODS_LATCHED);
mods_locked = xkb_state_serialize_mods(keyboard->xkb_state.state, mods_locked = xkb_state_serialize_mods(keyboard->xkb_state.state,
XKB_STATE_LOCKED); XKB_STATE_MODS_LOCKED);
group = xkb_state_serialize_group(keyboard->xkb_state.state, group = xkb_state_serialize_layout(keyboard->xkb_state.state,
XKB_STATE_EFFECTIVE); XKB_STATE_LAYOUT_EFFECTIVE);
if (mods_depressed != seat->keyboard->modifiers.mods_depressed || if (mods_depressed != seat->keyboard->modifiers.mods_depressed ||
mods_latched != seat->keyboard->modifiers.mods_latched || mods_latched != seat->keyboard->modifiers.mods_latched ||
@ -1870,7 +1870,7 @@ weston_xkb_info_destroy(struct weston_xkb_info *xkb_info)
return; return;
if (xkb_info->keymap) if (xkb_info->keymap)
xkb_map_unref(xkb_info->keymap); xkb_keymap_unref(xkb_info->keymap);
if (xkb_info->keymap_area) if (xkb_info->keymap_area)
munmap(xkb_info->keymap_area, xkb_info->keymap_size); munmap(xkb_info->keymap_area, xkb_info->keymap_size);
@ -1907,33 +1907,37 @@ weston_xkb_info_create(struct xkb_keymap *keymap)
if (xkb_info == NULL) if (xkb_info == NULL)
return NULL; return NULL;
xkb_info->keymap = xkb_map_ref(keymap); xkb_info->keymap = xkb_keymap_ref(keymap);
xkb_info->ref_count = 1; xkb_info->ref_count = 1;
char *keymap_str; char *keymap_str;
xkb_info->shift_mod = xkb_map_mod_get_index(xkb_info->keymap, xkb_info->shift_mod = xkb_keymap_mod_get_index(xkb_info->keymap,
XKB_MOD_NAME_SHIFT); XKB_MOD_NAME_SHIFT);
xkb_info->caps_mod = xkb_map_mod_get_index(xkb_info->keymap, xkb_info->caps_mod = xkb_keymap_mod_get_index(xkb_info->keymap,
XKB_MOD_NAME_CAPS); XKB_MOD_NAME_CAPS);
xkb_info->ctrl_mod = xkb_map_mod_get_index(xkb_info->keymap, xkb_info->ctrl_mod = xkb_keymap_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_keymap_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->mod2_mod = xkb_keymap_mod_get_index(xkb_info->keymap,
xkb_info->mod3_mod = xkb_map_mod_get_index(xkb_info->keymap, "Mod3"); "Mod2");
xkb_info->super_mod = xkb_map_mod_get_index(xkb_info->keymap, xkb_info->mod3_mod = xkb_keymap_mod_get_index(xkb_info->keymap,
XKB_MOD_NAME_LOGO); "Mod3");
xkb_info->mod5_mod = xkb_map_mod_get_index(xkb_info->keymap, "Mod5"); xkb_info->super_mod = xkb_keymap_mod_get_index(xkb_info->keymap,
XKB_MOD_NAME_LOGO);
xkb_info->num_led = xkb_map_led_get_index(xkb_info->keymap, xkb_info->mod5_mod = xkb_keymap_mod_get_index(xkb_info->keymap,
XKB_LED_NAME_NUM); "Mod5");
xkb_info->caps_led = xkb_map_led_get_index(xkb_info->keymap,
XKB_LED_NAME_CAPS); xkb_info->num_led = xkb_keymap_led_get_index(xkb_info->keymap,
xkb_info->scroll_led = xkb_map_led_get_index(xkb_info->keymap, XKB_LED_NAME_NUM);
XKB_LED_NAME_SCROLL); xkb_info->caps_led = xkb_keymap_led_get_index(xkb_info->keymap,
XKB_LED_NAME_CAPS);
keymap_str = xkb_map_get_as_string(xkb_info->keymap); xkb_info->scroll_led = xkb_keymap_led_get_index(xkb_info->keymap,
XKB_LED_NAME_SCROLL);
keymap_str = xkb_keymap_get_as_string(xkb_info->keymap,
XKB_KEYMAP_FORMAT_TEXT_V1);
if (keymap_str == NULL) { if (keymap_str == NULL) {
weston_log("failed to get string version of keymap\n"); weston_log("failed to get string version of keymap\n");
goto err_keymap; goto err_keymap;
@ -1965,7 +1969,7 @@ err_dev_zero:
err_keymap_str: err_keymap_str:
free(keymap_str); free(keymap_str);
err_keymap: err_keymap:
xkb_map_unref(xkb_info->keymap); xkb_keymap_unref(xkb_info->keymap);
free(xkb_info); free(xkb_info);
return NULL; return NULL;
} }
@ -1978,9 +1982,9 @@ weston_compositor_build_global_keymap(struct weston_compositor *ec)
if (ec->xkb_info != NULL) if (ec->xkb_info != NULL)
return 0; return 0;
keymap = xkb_map_new_from_names(ec->xkb_context, keymap = xkb_keymap_new_from_names(ec->xkb_context,
&ec->xkb_names, &ec->xkb_names,
0); 0);
if (keymap == NULL) { if (keymap == NULL) {
weston_log("failed to compile global XKB keymap\n"); weston_log("failed to compile global XKB keymap\n");
weston_log(" tried rules %s, model %s, layout %s, variant %s, " weston_log(" tried rules %s, model %s, layout %s, variant %s, "

@ -186,10 +186,10 @@ ss_seat_handle_keymap(void *data, struct wl_keyboard *keyboard,
goto error; goto error;
} }
keymap = xkb_map_new_from_string(seat->base.compositor->xkb_context, keymap = xkb_keymap_new_from_string(seat->base.compositor->xkb_context,
map_str, map_str,
XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_FORMAT_TEXT_V1,
0); 0);
munmap(map_str, size); munmap(map_str, size);
if (!keymap) { if (!keymap) {
@ -215,7 +215,7 @@ ss_seat_handle_keymap(void *data, struct wl_keyboard *keyboard,
weston_seat_init_keyboard(&seat->base, keymap); weston_seat_init_keyboard(&seat->base, keymap);
if (keymap) if (keymap)
xkb_map_unref(keymap); xkb_keymap_unref(keymap);
return; return;

Loading…
Cancel
Save