diff options
author | Ran Benita <ran234@gmail.com> | 2012-09-21 14:44:17 +0300 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2012-09-24 09:08:53 +1000 |
commit | fcd202909bd558074885c8a35400e180646e115b (patch) | |
tree | 8e1f203c01fa0854f3c859668bda52a4f792dc4f /test | |
parent | bf19408078824f96d2c265ad15e4ff12505166cc (diff) | |
download | libxkbcommon-fcd202909bd558074885c8a35400e180646e115b.tar.gz libxkbcommon-fcd202909bd558074885c8a35400e180646e115b.tar.bz2 libxkbcommon-fcd202909bd558074885c8a35400e180646e115b.zip |
Don't use xkbcommon-compat names in internal code
Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/common.c | 10 | ||||
-rw-r--r-- | test/filecomp.c | 2 | ||||
-rw-r--r-- | test/interactive.c | 30 | ||||
-rw-r--r-- | test/keyseq.c | 4 | ||||
-rw-r--r-- | test/print-compiled-keymap.c | 4 | ||||
-rw-r--r-- | test/rulescomp.c | 4 | ||||
-rw-r--r-- | test/state.c | 69 | ||||
-rw-r--r-- | test/stringcomp.c | 5 | ||||
-rw-r--r-- | test/test.h | 2 |
9 files changed, 65 insertions, 65 deletions
diff --git a/test/common.c b/test/common.c index 372c642..f960501 100644 --- a/test/common.c +++ b/test/common.c @@ -117,8 +117,8 @@ test_compile_file(struct xkb_context *context, const char *path_rel) } assert(file != NULL); - keymap = xkb_map_new_from_file(context, file, - XKB_KEYMAP_FORMAT_TEXT_V1, 0); + keymap = xkb_keymap_new_from_file(context, file, + XKB_KEYMAP_FORMAT_TEXT_V1, 0); fclose(file); if (!keymap) { @@ -136,8 +136,8 @@ test_compile_string(struct xkb_context *context, const char *string) { struct xkb_keymap *keymap; - keymap = xkb_map_new_from_string(context, string, - XKB_KEYMAP_FORMAT_TEXT_V1, 0); + keymap = xkb_keymap_new_from_string(context, string, + XKB_KEYMAP_FORMAT_TEXT_V1, 0); if (!keymap) { fprintf(stderr, "Failed to compile string\n"); return NULL; @@ -160,7 +160,7 @@ test_compile_rules(struct xkb_context *context, const char *rules, .options = options }; - keymap = xkb_map_new_from_names(context, &rmlvo, 0); + keymap = xkb_keymap_new_from_names(context, &rmlvo, 0); if (!keymap) { fprintf(stderr, "Failed to compile RMLVO: '%s', '%s', '%s', '%s', '%s'\n", diff --git a/test/filecomp.c b/test/filecomp.c index dca4fe5..1d7a127 100644 --- a/test/filecomp.c +++ b/test/filecomp.c @@ -31,7 +31,7 @@ test_file(struct xkb_context *ctx, const char *path_rel) if (!keymap) return 0; - xkb_map_unref(keymap); + xkb_keymap_unref(keymap); return 1; } diff --git a/test/interactive.c b/test/interactive.c index 332f57c..3d91dc6 100644 --- a/test/interactive.c +++ b/test/interactive.c @@ -221,14 +221,14 @@ print_keycode(struct keyboard *kbd, xkb_keycode_t keycode) unsigned int nsyms; char s[16]; uint32_t unicode; - xkb_group_index_t group; + xkb_layout_index_t group; xkb_mod_index_t mod; xkb_led_index_t led; state = kbd->state; - keymap = xkb_state_get_map(state); + keymap = xkb_state_get_keymap(state); - nsyms = xkb_key_get_syms(state, keycode, &syms); + nsyms = xkb_state_key_get_syms(state, keycode, &syms); if (nsyms <= 0) return; @@ -254,29 +254,29 @@ print_keycode(struct keyboard *kbd, xkb_keycode_t keycode) #endif printf("groups [ "); - for (group = 0; group < xkb_map_num_groups(keymap); group++) { - if (!xkb_state_group_index_is_active(state, group, XKB_STATE_EFFECTIVE)) + for (group = 0; group < xkb_keymap_num_layouts(keymap); group++) { + if (!xkb_state_layout_index_is_active(state, group, XKB_STATE_EFFECTIVE)) continue; - printf("%s (%d) ", xkb_map_group_get_name(keymap, group), group); + printf("%s (%d) ", xkb_keymap_layout_get_name(keymap, group), group); } printf("] "); printf("mods [ "); - for (mod = 0; mod < xkb_map_num_mods(keymap); mod++) { + for (mod = 0; mod < xkb_keymap_num_mods(keymap); mod++) { if (!xkb_state_mod_index_is_active(state, mod, XKB_STATE_EFFECTIVE)) continue; - if (xkb_key_mod_index_is_consumed(state, keycode, mod)) - printf("-%s ", xkb_map_mod_get_name(keymap, mod)); + if (xkb_state_mod_index_is_consumed(state, keycode, mod)) + printf("-%s ", xkb_keymap_mod_get_name(keymap, mod)); else - printf("%s ", xkb_map_mod_get_name(keymap, mod)); + printf("%s ", xkb_keymap_mod_get_name(keymap, mod)); } printf("] "); printf("leds [ "); - for (led = 0; led < xkb_map_num_leds(keymap); led++) { + for (led = 0; led < xkb_keymap_num_leds(keymap); led++) { if (!xkb_state_led_index_is_active(state, led)) continue; - printf("%s ", xkb_map_led_get_name(keymap, led)); + printf("%s ", xkb_keymap_led_get_name(keymap, led)); } printf("] "); @@ -302,9 +302,9 @@ process_event(struct keyboard *kbd, uint16_t type, uint16_t code, int32_t value) return; keycode = EVDEV_OFFSET + code; - keymap = xkb_state_get_map(kbd->state); + keymap = xkb_state_get_keymap(kbd->state); - if (value == KEY_STATE_REPEAT && !xkb_key_repeats(keymap, keycode)) + if (value == KEY_STATE_REPEAT && !xkb_keymap_key_repeats(keymap, keycode)) return; if (value != KEY_STATE_RELEASE) @@ -492,7 +492,7 @@ err_stty: system("stty echo"); free_keyboards(kbds); err_xkb: - xkb_map_unref(keymap); + xkb_keymap_unref(keymap); err_ctx: xkb_context_unref(ctx); err_out: diff --git a/test/keyseq.c b/test/keyseq.c index 2e827fc..4508ab1 100644 --- a/test/keyseq.c +++ b/test/keyseq.c @@ -75,7 +75,7 @@ test_key_seq(struct xkb_keymap *keymap, ...) kc = va_arg(ap, int) + EVDEV_OFFSET; op = va_arg(ap, int); - nsyms = xkb_key_get_syms(state, kc, &syms); + nsyms = xkb_state_key_get_syms(state, kc, &syms); fprintf(stderr, "got %d syms for key 0x%x: [", nsyms, kc); if (op == DOWN || op == BOTH) @@ -378,7 +378,7 @@ main(void) KEY_V, BOTH, XKB_KEY_p, FINISH)); - xkb_map_unref(keymap); + xkb_keymap_unref(keymap); xkb_context_unref(ctx); return 0; } diff --git a/test/print-compiled-keymap.c b/test/print-compiled-keymap.c index 34be4d4..95bd85a 100644 --- a/test/print-compiled-keymap.c +++ b/test/print-compiled-keymap.c @@ -87,7 +87,7 @@ main(int argc, char *argv[]) goto err_ctx; } - dump = xkb_map_get_as_string(keymap); + dump = xkb_keymap_get_as_string(keymap); if (!dump) { fprintf(stderr, "Couldn't get the keymap string\n"); goto err_map; @@ -98,7 +98,7 @@ main(int argc, char *argv[]) ret = EXIT_SUCCESS; free(dump); err_map: - xkb_map_unref(keymap); + xkb_keymap_unref(keymap); err_ctx: xkb_context_unref(ctx); err_out: diff --git a/test/rulescomp.c b/test/rulescomp.c index 3fb8a30..1c16dc8 100644 --- a/test/rulescomp.c +++ b/test/rulescomp.c @@ -40,7 +40,7 @@ test_rmlvo(struct xkb_context *context, const char *rules, fprintf(stderr, "Compiled '%s' '%s' '%s' '%s' '%s'\n", strnull(rules), strnull(model), strnull(layout), strnull(variant), strnull(options)); - xkb_map_unref(keymap); + xkb_keymap_unref(keymap); } return keymap != NULL; @@ -56,7 +56,7 @@ test_rmlvo_silent(struct xkb_context *context, const char *rules, keymap = test_compile_rules(context, rules, model, layout, variant, options); if (keymap) - xkb_map_unref(keymap); + xkb_keymap_unref(keymap); return keymap != NULL; } diff --git a/test/state.c b/test/state.c index 367c686..cdb7583 100644 --- a/test/state.c +++ b/test/state.c @@ -28,7 +28,6 @@ #include <stdlib.h> #include <linux/input.h> -#include "xkbcommon/xkbcommon.h" #include "test.h" /* Offset between evdev keycodes (where KEY_ESCAPE is 1), and the evdev XKB @@ -39,11 +38,11 @@ static void print_state(struct xkb_state *state) { struct xkb_keymap *keymap; - xkb_group_index_t group; + xkb_layout_index_t group; xkb_mod_index_t mod; xkb_led_index_t led; - group = xkb_state_serialize_group(state, XKB_STATE_EFFECTIVE); + group = xkb_state_serialize_layout(state, XKB_STATE_EFFECTIVE); mod = xkb_state_serialize_mods(state, XKB_STATE_EFFECTIVE); /* led = xkb_state_serialize_leds(state, XKB_STATE_EFFECTIVE); */ if (!group && !mod /* && !led */) { @@ -51,29 +50,29 @@ print_state(struct xkb_state *state) return; } - keymap = xkb_state_get_map(state); + keymap = xkb_state_get_keymap(state); - for (group = 0; group < xkb_map_num_groups(keymap); group++) { - if (xkb_state_group_index_is_active(state, group, XKB_STATE_EFFECTIVE) != 1) + for (group = 0; group < xkb_keymap_num_layouts(keymap); group++) { + if (xkb_state_layout_index_is_active(state, group, XKB_STATE_EFFECTIVE) != 1) continue; fprintf(stderr, "\tgroup %s (%d): %s%s%s%s\n", - xkb_map_group_get_name(keymap, group), + xkb_keymap_layout_get_name(keymap, group), group, - xkb_state_group_index_is_active(state, group, XKB_STATE_EFFECTIVE) > 0 ? + xkb_state_layout_index_is_active(state, group, XKB_STATE_EFFECTIVE) > 0 ? "effective " : "", - xkb_state_group_index_is_active(state, group, XKB_STATE_DEPRESSED) > 0 ? + xkb_state_layout_index_is_active(state, group, XKB_STATE_DEPRESSED) > 0 ? "depressed " : "", - xkb_state_group_index_is_active(state, group, XKB_STATE_LATCHED) > 0 ? + xkb_state_layout_index_is_active(state, group, XKB_STATE_LATCHED) > 0 ? "latched " : "", - xkb_state_group_index_is_active(state, group, XKB_STATE_LOCKED) > 0 ? + xkb_state_layout_index_is_active(state, group, XKB_STATE_LOCKED) > 0 ? "locked " : ""); } - for (mod = 0; mod < xkb_map_num_mods(keymap); mod++) { + for (mod = 0; mod < xkb_keymap_num_mods(keymap); mod++) { if (!xkb_state_mod_index_is_active(state, mod, XKB_STATE_EFFECTIVE)) continue; fprintf(stderr, "\tmod %s (%d): %s%s%s\n", - xkb_map_mod_get_name(keymap, mod), + xkb_keymap_mod_get_name(keymap, mod), mod, xkb_state_mod_index_is_active(state, mod, XKB_STATE_DEPRESSED) > 0 ? "depressed " : "", @@ -83,11 +82,11 @@ print_state(struct xkb_state *state) "locked " : ""); } - for (led = 0; led < xkb_map_num_leds(keymap); led++) { + for (led = 0; led < xkb_keymap_num_leds(keymap); led++) { if (!xkb_state_led_index_is_active(state, led)) continue; fprintf(stderr, "\tled %s (%d): active\n", - xkb_map_led_get_name(keymap, led), + xkb_keymap_led_get_name(keymap, led), led); } } @@ -123,8 +122,8 @@ test_update_key(struct xkb_keymap *keymap) NULL) > 0); assert(xkb_state_mod_indices_are_active(state, XKB_STATE_DEPRESSED, XKB_STATE_MATCH_ALL, - xkb_map_mod_get_index(keymap, XKB_MOD_NAME_CTRL), - xkb_map_mod_get_index(keymap, XKB_MOD_NAME_ALT), + xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_CTRL), + xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_ALT), XKB_MOD_INVALID) > 0); assert(!xkb_state_mod_names_are_active(state, XKB_STATE_DEPRESSED, XKB_STATE_MATCH_ALL, @@ -163,7 +162,7 @@ test_update_key(struct xkb_keymap *keymap) assert(xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CAPS, XKB_STATE_LOCKED) > 0); assert(xkb_state_led_name_is_active(state, XKB_LED_NAME_CAPS) > 0); - num_syms = xkb_key_get_syms(state, KEY_Q + EVDEV_OFFSET, &syms); + num_syms = xkb_state_key_get_syms(state, KEY_Q + EVDEV_OFFSET, &syms); assert(num_syms == 1 && syms[0] == XKB_KEY_Q); /* Caps unlocked */ @@ -172,7 +171,7 @@ test_update_key(struct xkb_keymap *keymap) assert(!xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CAPS, XKB_STATE_EFFECTIVE) > 0); assert(!xkb_state_led_name_is_active(state, XKB_LED_NAME_CAPS) > 0); - num_syms = xkb_key_get_syms(state, KEY_Q + EVDEV_OFFSET, &syms); + num_syms = xkb_state_key_get_syms(state, KEY_Q + EVDEV_OFFSET, &syms); assert(num_syms == 1 && syms[0] == XKB_KEY_q); xkb_state_unref(state); @@ -187,17 +186,17 @@ test_serialisation(struct xkb_keymap *keymap) xkb_mod_mask_t locked_mods; xkb_mod_mask_t effective_mods; xkb_mod_index_t caps, shift, ctrl; - xkb_group_index_t base_group = 0; - xkb_group_index_t latched_group = 0; - xkb_group_index_t locked_group = 0; + xkb_layout_index_t base_group = 0; + xkb_layout_index_t latched_group = 0; + xkb_layout_index_t locked_group = 0; assert(state); - caps = xkb_map_mod_get_index(keymap, XKB_MOD_NAME_CAPS); + caps = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_CAPS); assert(caps != XKB_MOD_INVALID); - shift = xkb_map_mod_get_index(keymap, XKB_MOD_NAME_SHIFT); + shift = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_SHIFT); assert(shift != XKB_MOD_INVALID); - ctrl = xkb_map_mod_get_index(keymap, XKB_MOD_NAME_CTRL); + ctrl = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_CTRL); assert(ctrl != XKB_MOD_INVALID); xkb_state_update_key(state, KEY_CAPSLOCK + EVDEV_OFFSET, XKB_KEY_DOWN); @@ -234,11 +233,11 @@ test_serialisation(struct xkb_keymap *keymap) static void test_repeat(struct xkb_keymap *keymap) { - assert(!xkb_key_repeats(keymap, KEY_LEFTSHIFT + 8)); - assert(xkb_key_repeats(keymap, KEY_A + 8)); - assert(xkb_key_repeats(keymap, KEY_8 + 8)); - assert(xkb_key_repeats(keymap, KEY_DOWN + 8)); - assert(xkb_key_repeats(keymap, KEY_KBDILLUMDOWN + 8)); + assert(!xkb_keymap_key_repeats(keymap, KEY_LEFTSHIFT + 8)); + assert(xkb_keymap_key_repeats(keymap, KEY_A + 8)); + assert(xkb_keymap_key_repeats(keymap, KEY_8 + 8)); + assert(xkb_keymap_key_repeats(keymap, KEY_DOWN + 8)); + assert(xkb_keymap_key_repeats(keymap, KEY_KBDILLUMDOWN + 8)); } static void @@ -250,9 +249,9 @@ test_consume(struct xkb_keymap *keymap) assert(state); - alt = xkb_map_mod_get_index(keymap, XKB_MOD_NAME_ALT); + alt = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_ALT); assert(alt != XKB_MOD_INVALID); - shift = xkb_map_mod_get_index(keymap, XKB_MOD_NAME_SHIFT); + shift = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_SHIFT); assert(shift != XKB_MOD_INVALID); xkb_state_update_key(state, KEY_LEFTALT + EVDEV_OFFSET, XKB_KEY_DOWN); @@ -264,8 +263,8 @@ test_consume(struct xkb_keymap *keymap) mask = xkb_state_serialize_mods(state, XKB_STATE_EFFECTIVE); assert(mask == ((1 << alt) | (1 << shift))); - mask = xkb_key_mod_mask_remove_consumed(state, KEY_EQUAL + EVDEV_OFFSET, - mask); + mask = xkb_state_mod_mask_remove_consumed(state, KEY_EQUAL + EVDEV_OFFSET, + mask); assert(mask == (1 << alt)); xkb_state_unref(state); @@ -287,6 +286,6 @@ main(void) test_repeat(keymap); test_consume(keymap); - xkb_map_unref(keymap); + xkb_keymap_unref(keymap); xkb_context_unref(context); } diff --git a/test/stringcomp.c b/test/stringcomp.c index 402b9a6..e00e92f 100644 --- a/test/stringcomp.c +++ b/test/stringcomp.c @@ -25,7 +25,6 @@ #include <stdio.h> #include <stdlib.h> -#include "xkbcommon/xkbcommon.h" #include "test.h" #define DATA_PATH "keymaps/stringcomp.data" @@ -48,7 +47,7 @@ main(int argc, char *argv[]) keymap = test_compile_string(ctx, original); assert(keymap); - dump = xkb_map_get_as_string(keymap); + dump = xkb_keymap_get_as_string(keymap); assert(dump); if (!streq(original, dump)) { @@ -66,7 +65,7 @@ main(int argc, char *argv[]) free(original); free(dump); - xkb_map_unref(keymap); + xkb_keymap_unref(keymap); /* Make sure we can't (falsely claim to) compile an empty string. */ keymap = test_compile_string(ctx, ""); diff --git a/test/test.h b/test/test.h index 2a9b0fa..046b64e 100644 --- a/test/test.h +++ b/test/test.h @@ -25,6 +25,8 @@ #include <assert.h> + /* Don't use compat names in internal code. */ +#define _XKBCOMMON_COMPAT_H #include "xkbcommon/xkbcommon.h" #include "utils.h" |