2012-03-20 20:20:07 -06:00
|
|
|
/*
|
|
|
|
* Copyright © 2012 Intel Corporation
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Author: Daniel Stone <daniel@fooishbar.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2012-03-30 17:44:39 -06:00
|
|
|
|
2014-09-06 02:29:15 -06:00
|
|
|
#include "evdev-scancodes.h"
|
2012-07-12 07:15:08 -06:00
|
|
|
#include "test.h"
|
2012-03-20 20:20:07 -06:00
|
|
|
|
|
|
|
/* Offset between evdev keycodes (where KEY_ESCAPE is 1), and the evdev XKB
|
|
|
|
* keycode set (where ESC is 9). */
|
|
|
|
#define EVDEV_OFFSET 8
|
|
|
|
|
2012-03-21 09:25:32 -06:00
|
|
|
static void
|
|
|
|
print_state(struct xkb_state *state)
|
|
|
|
{
|
2012-06-06 01:38:45 -06:00
|
|
|
struct xkb_keymap *keymap;
|
2012-09-21 05:44:17 -06:00
|
|
|
xkb_layout_index_t group;
|
2012-03-21 09:25:32 -06:00
|
|
|
xkb_mod_index_t mod;
|
2012-03-22 08:32:53 -06:00
|
|
|
xkb_led_index_t led;
|
2012-03-21 09:25:32 -06:00
|
|
|
|
2012-10-22 12:49:44 -06:00
|
|
|
group = xkb_state_serialize_layout(state, XKB_STATE_LAYOUT_EFFECTIVE);
|
|
|
|
mod = xkb_state_serialize_mods(state, XKB_STATE_MODS_EFFECTIVE);
|
|
|
|
/* led = xkb_state_serialize_leds(state, XKB_STATE_LEDS); */
|
2012-06-06 01:38:45 -06:00
|
|
|
if (!group && !mod /* && !led */) {
|
2012-03-21 09:25:32 -06:00
|
|
|
fprintf(stderr, "\tno state\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-09-21 05:44:17 -06:00
|
|
|
keymap = xkb_state_get_keymap(state);
|
2012-06-06 01:38:45 -06:00
|
|
|
|
2012-09-21 05:44:17 -06:00
|
|
|
for (group = 0; group < xkb_keymap_num_layouts(keymap); group++) {
|
2012-10-22 12:49:44 -06:00
|
|
|
if (xkb_state_layout_index_is_active(state, group,
|
|
|
|
XKB_STATE_LAYOUT_EFFECTIVE |
|
|
|
|
XKB_STATE_LAYOUT_DEPRESSED |
|
|
|
|
XKB_STATE_LAYOUT_LATCHED |
|
|
|
|
XKB_STATE_LAYOUT_LOCKED) <= 0)
|
2012-03-21 09:25:32 -06:00
|
|
|
continue;
|
|
|
|
fprintf(stderr, "\tgroup %s (%d): %s%s%s%s\n",
|
2012-09-21 05:44:17 -06:00
|
|
|
xkb_keymap_layout_get_name(keymap, group),
|
2012-03-21 09:25:32 -06:00
|
|
|
group,
|
2012-10-22 12:49:44 -06:00
|
|
|
xkb_state_layout_index_is_active(state, group, XKB_STATE_LAYOUT_EFFECTIVE) > 0 ?
|
2012-03-22 08:32:53 -06:00
|
|
|
"effective " : "",
|
2012-10-22 12:49:44 -06:00
|
|
|
xkb_state_layout_index_is_active(state, group, XKB_STATE_LAYOUT_DEPRESSED) > 0 ?
|
2012-03-22 08:32:53 -06:00
|
|
|
"depressed " : "",
|
2012-10-22 12:49:44 -06:00
|
|
|
xkb_state_layout_index_is_active(state, group, XKB_STATE_LAYOUT_LATCHED) > 0 ?
|
2012-03-22 08:32:53 -06:00
|
|
|
"latched " : "",
|
2012-10-22 12:49:44 -06:00
|
|
|
xkb_state_layout_index_is_active(state, group, XKB_STATE_LAYOUT_LOCKED) > 0 ?
|
2012-03-22 08:32:53 -06:00
|
|
|
"locked " : "");
|
2012-03-21 09:25:32 -06:00
|
|
|
}
|
|
|
|
|
2012-09-21 05:44:17 -06:00
|
|
|
for (mod = 0; mod < xkb_keymap_num_mods(keymap); mod++) {
|
2012-10-22 12:49:44 -06:00
|
|
|
if (xkb_state_mod_index_is_active(state, mod,
|
|
|
|
XKB_STATE_MODS_EFFECTIVE |
|
|
|
|
XKB_STATE_MODS_DEPRESSED |
|
|
|
|
XKB_STATE_MODS_LATCHED |
|
|
|
|
XKB_STATE_MODS_LOCKED) <= 0)
|
2012-03-21 09:25:32 -06:00
|
|
|
continue;
|
2012-10-22 12:49:44 -06:00
|
|
|
fprintf(stderr, "\tmod %s (%d): %s%s%s%s\n",
|
2012-09-21 05:44:17 -06:00
|
|
|
xkb_keymap_mod_get_name(keymap, mod),
|
2012-03-21 09:25:32 -06:00
|
|
|
mod,
|
2012-10-22 12:49:44 -06:00
|
|
|
xkb_state_mod_index_is_active(state, mod, XKB_STATE_MODS_EFFECTIVE) > 0 ?
|
|
|
|
"effective " : "",
|
|
|
|
xkb_state_mod_index_is_active(state, mod, XKB_STATE_MODS_DEPRESSED) > 0 ?
|
2012-03-22 08:32:53 -06:00
|
|
|
"depressed " : "",
|
2012-10-22 12:49:44 -06:00
|
|
|
xkb_state_mod_index_is_active(state, mod, XKB_STATE_MODS_LATCHED) > 0 ?
|
2012-03-22 08:32:53 -06:00
|
|
|
"latched " : "",
|
2012-10-22 12:49:44 -06:00
|
|
|
xkb_state_mod_index_is_active(state, mod, XKB_STATE_MODS_LOCKED) > 0 ?
|
2012-03-22 08:32:53 -06:00
|
|
|
"locked " : "");
|
|
|
|
}
|
|
|
|
|
2012-10-11 08:54:17 -06:00
|
|
|
for (led = 0; led < xkb_keymap_num_leds(keymap); led++) {
|
2012-10-10 01:47:31 -06:00
|
|
|
if (xkb_state_led_index_is_active(state, led) <= 0)
|
2012-03-22 08:32:53 -06:00
|
|
|
continue;
|
|
|
|
fprintf(stderr, "\tled %s (%d): active\n",
|
2012-09-21 05:44:17 -06:00
|
|
|
xkb_keymap_led_get_name(keymap, led),
|
2012-03-22 08:32:53 -06:00
|
|
|
led);
|
2012-03-21 09:25:32 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-27 05:07:57 -06:00
|
|
|
static void
|
2012-05-09 08:15:30 -06:00
|
|
|
test_update_key(struct xkb_keymap *keymap)
|
2012-03-20 20:20:07 -06:00
|
|
|
{
|
2012-05-09 08:15:30 -06:00
|
|
|
struct xkb_state *state = xkb_state_new(keymap);
|
2012-03-30 17:44:39 -06:00
|
|
|
const xkb_keysym_t *syms;
|
2012-09-27 07:27:49 -06:00
|
|
|
xkb_keysym_t one_sym;
|
2012-03-27 05:07:57 -06:00
|
|
|
int num_syms;
|
2012-03-20 20:20:07 -06:00
|
|
|
|
2012-03-27 05:07:57 -06:00
|
|
|
assert(state);
|
2012-03-20 20:20:07 -06:00
|
|
|
|
|
|
|
/* LCtrl down */
|
2012-03-27 05:11:45 -06:00
|
|
|
xkb_state_update_key(state, KEY_LEFTCTRL + EVDEV_OFFSET, XKB_KEY_DOWN);
|
2012-03-21 09:25:32 -06:00
|
|
|
fprintf(stderr, "dumping state for LCtrl down:\n");
|
|
|
|
print_state(state);
|
2012-05-08 10:59:35 -06:00
|
|
|
assert(xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CTRL,
|
2012-10-22 12:49:44 -06:00
|
|
|
XKB_STATE_MODS_DEPRESSED) > 0);
|
2012-03-20 20:20:07 -06:00
|
|
|
|
|
|
|
/* LCtrl + RAlt down */
|
2012-03-27 05:11:45 -06:00
|
|
|
xkb_state_update_key(state, KEY_RIGHTALT + EVDEV_OFFSET, XKB_KEY_DOWN);
|
2012-03-21 09:25:32 -06:00
|
|
|
fprintf(stderr, "dumping state for LCtrl + RAlt down:\n");
|
|
|
|
print_state(state);
|
2012-05-08 10:59:35 -06:00
|
|
|
assert(xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CTRL,
|
2012-10-22 12:49:44 -06:00
|
|
|
XKB_STATE_MODS_DEPRESSED) > 0);
|
2012-05-08 10:59:35 -06:00
|
|
|
assert(xkb_state_mod_name_is_active(state, XKB_MOD_NAME_ALT,
|
2012-10-22 12:49:44 -06:00
|
|
|
XKB_STATE_MODS_DEPRESSED) > 0);
|
|
|
|
assert(xkb_state_mod_names_are_active(state, XKB_STATE_MODS_DEPRESSED,
|
2012-05-08 18:06:10 -06:00
|
|
|
XKB_STATE_MATCH_ALL,
|
|
|
|
XKB_MOD_NAME_CTRL,
|
|
|
|
XKB_MOD_NAME_ALT,
|
2012-08-30 03:13:37 -06:00
|
|
|
NULL) > 0);
|
2012-10-22 12:49:44 -06:00
|
|
|
assert(xkb_state_mod_indices_are_active(state, XKB_STATE_MODS_DEPRESSED,
|
2014-01-11 07:56:20 -07:00
|
|
|
XKB_STATE_MATCH_ALL,
|
|
|
|
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_MODS_DEPRESSED,
|
2012-08-30 03:13:37 -06:00
|
|
|
XKB_STATE_MATCH_ALL,
|
2014-01-11 07:56:20 -07:00
|
|
|
XKB_MOD_NAME_ALT,
|
|
|
|
NULL) == 0);
|
|
|
|
assert(xkb_state_mod_names_are_active(state, XKB_STATE_MODS_DEPRESSED,
|
|
|
|
XKB_STATE_MATCH_ALL |
|
|
|
|
XKB_STATE_MATCH_NON_EXCLUSIVE,
|
|
|
|
XKB_MOD_NAME_ALT,
|
|
|
|
NULL) > 0);
|
2012-10-22 12:49:44 -06:00
|
|
|
assert(xkb_state_mod_names_are_active(state, XKB_STATE_MODS_DEPRESSED,
|
2012-05-08 18:06:10 -06:00
|
|
|
(XKB_STATE_MATCH_ANY |
|
|
|
|
XKB_STATE_MATCH_NON_EXCLUSIVE),
|
|
|
|
XKB_MOD_NAME_ALT,
|
2014-01-11 07:56:20 -07:00
|
|
|
NULL) > 0);
|
2012-03-20 20:20:07 -06:00
|
|
|
|
|
|
|
/* RAlt down */
|
2012-03-27 05:11:45 -06:00
|
|
|
xkb_state_update_key(state, KEY_LEFTCTRL + EVDEV_OFFSET, XKB_KEY_UP);
|
2012-03-21 09:25:32 -06:00
|
|
|
fprintf(stderr, "dumping state for RAlt down:\n");
|
|
|
|
print_state(state);
|
2014-01-11 07:56:20 -07:00
|
|
|
assert(xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CTRL,
|
|
|
|
XKB_STATE_MODS_EFFECTIVE) == 0);
|
2012-05-08 10:59:35 -06:00
|
|
|
assert(xkb_state_mod_name_is_active(state, XKB_MOD_NAME_ALT,
|
2012-10-22 12:49:44 -06:00
|
|
|
XKB_STATE_MODS_DEPRESSED) > 0);
|
|
|
|
assert(xkb_state_mod_names_are_active(state, XKB_STATE_MODS_DEPRESSED,
|
2012-05-08 18:06:10 -06:00
|
|
|
XKB_STATE_MATCH_ANY,
|
|
|
|
XKB_MOD_NAME_CTRL,
|
|
|
|
XKB_MOD_NAME_ALT,
|
2012-08-30 03:13:37 -06:00
|
|
|
NULL) > 0);
|
2012-10-22 12:49:44 -06:00
|
|
|
assert(xkb_state_mod_names_are_active(state, XKB_STATE_MODS_LATCHED,
|
2012-10-03 11:41:22 -06:00
|
|
|
XKB_STATE_MATCH_ANY,
|
|
|
|
XKB_MOD_NAME_CTRL,
|
|
|
|
XKB_MOD_NAME_ALT,
|
|
|
|
NULL) == 0);
|
2012-03-20 20:20:07 -06:00
|
|
|
|
|
|
|
/* none down */
|
2012-03-27 05:11:45 -06:00
|
|
|
xkb_state_update_key(state, KEY_RIGHTALT + EVDEV_OFFSET, XKB_KEY_UP);
|
2014-01-11 07:56:20 -07:00
|
|
|
assert(xkb_state_mod_name_is_active(state, XKB_MOD_NAME_ALT,
|
|
|
|
XKB_STATE_MODS_EFFECTIVE) == 0);
|
2012-03-20 20:20:07 -06:00
|
|
|
|
|
|
|
/* Caps locked */
|
2012-03-27 05:11:45 -06:00
|
|
|
xkb_state_update_key(state, KEY_CAPSLOCK + EVDEV_OFFSET, XKB_KEY_DOWN);
|
2012-10-03 11:41:22 -06:00
|
|
|
assert(xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CAPS,
|
2012-10-22 12:49:44 -06:00
|
|
|
XKB_STATE_MODS_DEPRESSED) > 0);
|
2012-03-27 05:11:45 -06:00
|
|
|
xkb_state_update_key(state, KEY_CAPSLOCK + EVDEV_OFFSET, XKB_KEY_UP);
|
2012-03-21 09:25:32 -06:00
|
|
|
fprintf(stderr, "dumping state for Caps Lock:\n");
|
|
|
|
print_state(state);
|
2012-10-03 11:41:22 -06:00
|
|
|
assert(xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CAPS,
|
2012-10-22 12:49:44 -06:00
|
|
|
XKB_STATE_MODS_DEPRESSED) == 0);
|
2012-05-08 10:59:35 -06:00
|
|
|
assert(xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CAPS,
|
2012-10-22 12:49:44 -06:00
|
|
|
XKB_STATE_MODS_LOCKED) > 0);
|
2012-08-30 03:13:37 -06:00
|
|
|
assert(xkb_state_led_name_is_active(state, XKB_LED_NAME_CAPS) > 0);
|
2012-09-21 05:44:17 -06:00
|
|
|
num_syms = xkb_state_key_get_syms(state, KEY_Q + EVDEV_OFFSET, &syms);
|
2012-05-09 07:05:00 -06:00
|
|
|
assert(num_syms == 1 && syms[0] == XKB_KEY_Q);
|
2012-03-20 20:20:07 -06:00
|
|
|
|
2012-10-10 01:47:31 -06:00
|
|
|
/* Num Lock locked */
|
|
|
|
xkb_state_update_key(state, KEY_NUMLOCK + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
xkb_state_update_key(state, KEY_NUMLOCK + EVDEV_OFFSET, XKB_KEY_UP);
|
|
|
|
fprintf(stderr, "dumping state for Caps Lock + Num Lock:\n");
|
|
|
|
print_state(state);
|
|
|
|
assert(xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CAPS,
|
2012-10-22 12:49:44 -06:00
|
|
|
XKB_STATE_MODS_LOCKED) > 0);
|
2012-10-10 01:47:31 -06:00
|
|
|
assert(xkb_state_mod_name_is_active(state, "Mod2",
|
2012-10-22 12:49:44 -06:00
|
|
|
XKB_STATE_MODS_LOCKED) > 0);
|
2012-10-10 01:47:31 -06:00
|
|
|
num_syms = xkb_state_key_get_syms(state, KEY_KP1 + EVDEV_OFFSET, &syms);
|
|
|
|
assert(num_syms == 1 && syms[0] == XKB_KEY_KP_1);
|
|
|
|
assert(xkb_state_led_name_is_active(state, XKB_LED_NAME_NUM) > 0);
|
|
|
|
|
|
|
|
/* Num Lock unlocked */
|
|
|
|
xkb_state_update_key(state, KEY_NUMLOCK + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
xkb_state_update_key(state, KEY_NUMLOCK + EVDEV_OFFSET, XKB_KEY_UP);
|
|
|
|
|
|
|
|
/* Switch to group 2 */
|
|
|
|
xkb_state_update_key(state, KEY_COMPOSE + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
xkb_state_update_key(state, KEY_COMPOSE + EVDEV_OFFSET, XKB_KEY_UP);
|
|
|
|
assert(xkb_state_led_name_is_active(state, "Group 2") > 0);
|
2014-01-11 07:56:20 -07:00
|
|
|
assert(xkb_state_led_name_is_active(state, XKB_LED_NAME_NUM) == 0);
|
2012-10-10 01:47:31 -06:00
|
|
|
|
|
|
|
/* Switch back to group 1. */
|
|
|
|
xkb_state_update_key(state, KEY_COMPOSE + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
xkb_state_update_key(state, KEY_COMPOSE + EVDEV_OFFSET, XKB_KEY_UP);
|
|
|
|
|
2012-03-20 20:20:07 -06:00
|
|
|
/* Caps unlocked */
|
2012-03-27 05:11:45 -06:00
|
|
|
xkb_state_update_key(state, KEY_CAPSLOCK + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
xkb_state_update_key(state, KEY_CAPSLOCK + EVDEV_OFFSET, XKB_KEY_UP);
|
2014-01-11 07:56:20 -07:00
|
|
|
assert(xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CAPS,
|
|
|
|
XKB_STATE_MODS_EFFECTIVE) == 0);
|
|
|
|
assert(xkb_state_led_name_is_active(state, XKB_LED_NAME_CAPS) == 0);
|
2012-09-21 05:44:17 -06:00
|
|
|
num_syms = xkb_state_key_get_syms(state, KEY_Q + EVDEV_OFFSET, &syms);
|
2012-05-09 07:05:00 -06:00
|
|
|
assert(num_syms == 1 && syms[0] == XKB_KEY_q);
|
2012-03-20 20:20:07 -06:00
|
|
|
|
2012-09-27 07:27:49 -06:00
|
|
|
/* Multiple symbols */
|
|
|
|
num_syms = xkb_state_key_get_syms(state, KEY_6 + EVDEV_OFFSET, &syms);
|
|
|
|
assert(num_syms == 5 &&
|
|
|
|
syms[0] == XKB_KEY_H && syms[1] == XKB_KEY_E &&
|
|
|
|
syms[2] == XKB_KEY_L && syms[3] == XKB_KEY_L &&
|
|
|
|
syms[4] == XKB_KEY_O);
|
|
|
|
one_sym = xkb_state_key_get_one_sym(state, KEY_6 + EVDEV_OFFSET);
|
|
|
|
assert(one_sym == XKB_KEY_NoSymbol);
|
|
|
|
xkb_state_update_key(state, KEY_6 + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
xkb_state_update_key(state, KEY_6 + EVDEV_OFFSET, XKB_KEY_UP);
|
|
|
|
|
|
|
|
one_sym = xkb_state_key_get_one_sym(state, KEY_5 + EVDEV_OFFSET);
|
|
|
|
assert(one_sym == XKB_KEY_5);
|
|
|
|
|
2012-03-20 20:20:07 -06:00
|
|
|
xkb_state_unref(state);
|
2012-03-27 05:07:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-05-09 08:15:30 -06:00
|
|
|
test_serialisation(struct xkb_keymap *keymap)
|
2012-03-27 05:07:57 -06:00
|
|
|
{
|
2012-05-09 08:15:30 -06:00
|
|
|
struct xkb_state *state = xkb_state_new(keymap);
|
2012-03-27 05:07:57 -06:00
|
|
|
xkb_mod_mask_t base_mods;
|
|
|
|
xkb_mod_mask_t latched_mods;
|
|
|
|
xkb_mod_mask_t locked_mods;
|
|
|
|
xkb_mod_mask_t effective_mods;
|
|
|
|
xkb_mod_index_t caps, shift, ctrl;
|
2012-09-21 05:44:17 -06:00
|
|
|
xkb_layout_index_t base_group = 0;
|
|
|
|
xkb_layout_index_t latched_group = 0;
|
|
|
|
xkb_layout_index_t locked_group = 0;
|
2012-03-27 05:07:57 -06:00
|
|
|
|
|
|
|
assert(state);
|
|
|
|
|
2012-09-21 05:44:17 -06:00
|
|
|
caps = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_CAPS);
|
2012-03-27 05:07:57 -06:00
|
|
|
assert(caps != XKB_MOD_INVALID);
|
2012-09-21 05:44:17 -06:00
|
|
|
shift = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_SHIFT);
|
2012-03-27 05:07:57 -06:00
|
|
|
assert(shift != XKB_MOD_INVALID);
|
2012-09-21 05:44:17 -06:00
|
|
|
ctrl = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_CTRL);
|
2012-03-27 05:07:57 -06:00
|
|
|
assert(ctrl != XKB_MOD_INVALID);
|
2012-03-20 20:20:07 -06:00
|
|
|
|
2012-03-27 05:11:45 -06:00
|
|
|
xkb_state_update_key(state, KEY_CAPSLOCK + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
xkb_state_update_key(state, KEY_CAPSLOCK + EVDEV_OFFSET, XKB_KEY_UP);
|
2012-10-22 12:49:44 -06:00
|
|
|
base_mods = xkb_state_serialize_mods(state, XKB_STATE_MODS_DEPRESSED);
|
2012-03-27 05:07:57 -06:00
|
|
|
assert(base_mods == 0);
|
2012-10-22 12:49:44 -06:00
|
|
|
latched_mods = xkb_state_serialize_mods(state, XKB_STATE_MODS_LATCHED);
|
2012-03-27 05:07:57 -06:00
|
|
|
assert(latched_mods == 0);
|
2012-10-22 12:49:44 -06:00
|
|
|
locked_mods = xkb_state_serialize_mods(state, XKB_STATE_MODS_LOCKED);
|
2014-02-07 15:27:54 -07:00
|
|
|
assert(locked_mods == (1U << caps));
|
2012-10-22 12:49:44 -06:00
|
|
|
effective_mods = xkb_state_serialize_mods(state, XKB_STATE_MODS_EFFECTIVE);
|
2012-03-27 05:07:57 -06:00
|
|
|
assert(effective_mods == locked_mods);
|
|
|
|
|
2012-03-27 05:11:45 -06:00
|
|
|
xkb_state_update_key(state, KEY_LEFTSHIFT + EVDEV_OFFSET, XKB_KEY_DOWN);
|
2012-10-22 12:49:44 -06:00
|
|
|
base_mods = xkb_state_serialize_mods(state, XKB_STATE_MODS_DEPRESSED);
|
2014-02-07 15:27:54 -07:00
|
|
|
assert(base_mods == (1U << shift));
|
2012-10-22 12:49:44 -06:00
|
|
|
latched_mods = xkb_state_serialize_mods(state, XKB_STATE_MODS_LATCHED);
|
2012-03-27 05:07:57 -06:00
|
|
|
assert(latched_mods == 0);
|
2012-10-22 12:49:44 -06:00
|
|
|
locked_mods = xkb_state_serialize_mods(state, XKB_STATE_MODS_LOCKED);
|
2014-02-07 15:27:54 -07:00
|
|
|
assert(locked_mods == (1U << caps));
|
2012-10-22 12:49:44 -06:00
|
|
|
effective_mods = xkb_state_serialize_mods(state, XKB_STATE_MODS_EFFECTIVE);
|
2012-03-27 05:07:57 -06:00
|
|
|
assert(effective_mods == (base_mods | locked_mods));
|
|
|
|
|
2014-02-07 15:27:54 -07:00
|
|
|
base_mods |= (1U << ctrl);
|
2012-03-27 05:07:57 -06:00
|
|
|
xkb_state_update_mask(state, base_mods, latched_mods, locked_mods,
|
|
|
|
base_group, latched_group, locked_group);
|
|
|
|
|
2014-01-11 07:56:20 -07:00
|
|
|
assert(xkb_state_mod_index_is_active(state, ctrl, XKB_STATE_MODS_DEPRESSED) > 0);
|
|
|
|
assert(xkb_state_mod_index_is_active(state, ctrl, XKB_STATE_MODS_EFFECTIVE) > 0);
|
2012-03-27 05:07:57 -06:00
|
|
|
|
|
|
|
xkb_state_unref(state);
|
|
|
|
}
|
|
|
|
|
2014-08-18 12:03:06 -06:00
|
|
|
static void
|
|
|
|
test_update_mask_mods(struct xkb_keymap *keymap)
|
|
|
|
{
|
|
|
|
struct xkb_state *state = xkb_state_new(keymap);
|
|
|
|
xkb_mod_index_t caps, shift, num, alt, mod1, mod2;
|
|
|
|
enum xkb_state_component changed;
|
|
|
|
|
|
|
|
assert(state);
|
|
|
|
|
|
|
|
caps = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_CAPS);
|
|
|
|
assert(caps != XKB_MOD_INVALID);
|
|
|
|
shift = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_SHIFT);
|
|
|
|
assert(shift != XKB_MOD_INVALID);
|
|
|
|
num = xkb_keymap_mod_get_index(keymap, "NumLock");
|
|
|
|
assert(num != XKB_MOD_INVALID);
|
|
|
|
alt = xkb_keymap_mod_get_index(keymap, "Alt");
|
|
|
|
assert(alt != XKB_MOD_INVALID);
|
|
|
|
mod1 = xkb_keymap_mod_get_index(keymap, "Mod1");
|
|
|
|
assert(mod1 != XKB_MOD_INVALID);
|
|
|
|
mod2 = xkb_keymap_mod_get_index(keymap, "Mod2");
|
|
|
|
assert(mod2 != XKB_MOD_INVALID);
|
|
|
|
|
|
|
|
changed = xkb_state_update_mask(state, 1 << caps, 0, 0, 0, 0, 0);
|
|
|
|
assert(changed == (XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_EFFECTIVE));
|
|
|
|
assert(xkb_state_serialize_mods(state, XKB_STATE_MODS_EFFECTIVE) ==
|
|
|
|
(1u << caps));
|
|
|
|
|
|
|
|
changed = xkb_state_update_mask(state, (1 << caps), 0, (1 << shift), 0, 0, 0);
|
|
|
|
assert(changed == (XKB_STATE_MODS_LOCKED | XKB_STATE_MODS_EFFECTIVE |
|
|
|
|
XKB_STATE_LEDS));
|
|
|
|
assert(xkb_state_serialize_mods(state, XKB_STATE_MODS_EFFECTIVE) ==
|
|
|
|
((1u << caps) | (1u << shift)));
|
|
|
|
assert(xkb_state_serialize_mods(state, XKB_STATE_MODS_DEPRESSED) ==
|
|
|
|
(1u << caps));
|
|
|
|
assert(xkb_state_serialize_mods(state, XKB_STATE_MODS_LATCHED) == 0);
|
|
|
|
assert(xkb_state_serialize_mods(state, XKB_STATE_MODS_LOCKED) ==
|
|
|
|
(1u << shift));
|
|
|
|
|
|
|
|
changed = xkb_state_update_mask(state, 0, 0, 0, 0, 0, 0);
|
|
|
|
assert(changed == (XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LOCKED |
|
|
|
|
XKB_STATE_MODS_EFFECTIVE | XKB_STATE_LEDS));
|
|
|
|
assert(xkb_state_serialize_mods(state, XKB_STATE_MODS_EFFECTIVE) == 0);
|
|
|
|
|
|
|
|
changed = xkb_state_update_mask(state, (1 << alt), 0, 0, 0, 0, 0);
|
|
|
|
assert(changed == (XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_EFFECTIVE));
|
|
|
|
assert(xkb_state_serialize_mods(state, XKB_STATE_MODS_EFFECTIVE) ==
|
|
|
|
((1u << alt) | (1u << mod1)));
|
|
|
|
|
|
|
|
changed = xkb_state_update_mask(state, 0, 0, (1 << num), 0, 0, 0);
|
|
|
|
assert(changed == (XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LOCKED |
|
|
|
|
XKB_STATE_MODS_EFFECTIVE | XKB_STATE_LEDS));
|
|
|
|
assert(xkb_state_serialize_mods(state, XKB_STATE_MODS_EFFECTIVE) ==
|
|
|
|
((1u << num) | (1u << mod2)));
|
|
|
|
|
|
|
|
xkb_state_update_mask(state, 0, 0, 0, 0, 0, 0);
|
|
|
|
|
|
|
|
changed = xkb_state_update_mask(state, (1 << mod2), 0, (1 << num), 0, 0, 0);
|
|
|
|
assert(changed == (XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LOCKED |
|
|
|
|
XKB_STATE_MODS_EFFECTIVE | XKB_STATE_LEDS));
|
|
|
|
assert(xkb_state_serialize_mods(state, XKB_STATE_MODS_EFFECTIVE) ==
|
|
|
|
((1u << mod2) | (1u << num)));
|
|
|
|
assert(xkb_state_serialize_mods(state, XKB_STATE_MODS_DEPRESSED) ==
|
|
|
|
(1u << mod2));
|
|
|
|
assert(xkb_state_serialize_mods(state, XKB_STATE_MODS_LOCKED) ==
|
|
|
|
((1u << num) | (1u << mod2)));
|
|
|
|
|
|
|
|
xkb_state_unref(state);
|
|
|
|
}
|
|
|
|
|
2012-06-22 08:27:05 -06:00
|
|
|
static void
|
|
|
|
test_repeat(struct xkb_keymap *keymap)
|
|
|
|
{
|
2012-09-21 05:44:17 -06:00
|
|
|
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));
|
2012-06-22 08:27:05 -06:00
|
|
|
}
|
|
|
|
|
2012-08-08 06:26:23 -06:00
|
|
|
static void
|
|
|
|
test_consume(struct xkb_keymap *keymap)
|
|
|
|
{
|
state: fix consumed modifier calculation
The current calculation is in short:
entry ? (entry->mask & ~entry->preserve) : 0
This changes it be
type->mask & ~(entry ? entry->preserve : 0)
This is what Xlib does. While less intuitive, it is actually more
correct, if you follow this deduction:
- The key group's type->mask defines which modifiers the key even cares
about. The others are completely irrelevant (and in fact they are
masked out from all sided in the level calculation). Example: NumLock
for an alphabetic key.
- The type->mask, the mods which are not masked out, are *all* relevant
(and in fact in the level calculation they must match *exactly* to the
state). These mods affect which level is chosen for the key, whether
they are active or not.
- Because the type->mask mods are all relevant, they must be considered
as consumed by the calculation *even if they are not active*.
Therefore we use type->mask instead of entry->mask.
The second change is what happens when no entry is found: return 0 or
just take preserve to be 0? Let's consider an example, the basic type
type "ALPHABETIC" {
modifiers = Shift+Lock;
map[Shift] = Level2;
map[Lock] = Level2;
level_name[Level1] = "Base";
level_name[Level2] = "Caps";
};
Suppose Shift+Lock is active - it doesn't match any entry, thus it gets
to level 0. The first interpretation would take them both to be
unconsumed, the second (new one) would take them both to be consumed.
This seems much better: Caps is active, and Shift disables it, they both
do something.
This change also fixes a pretty lousy bug (since 0.3.2), where Shift
appears to apparently *not* disable Caps. What actually happens is that
Caps is not consumed (see above) but active, thus the implicit
capitalization in get_one_sym() kicks in and capitalizes it anyway.
Reported-by: Davinder Pal Singh Bhamra
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-03-27 09:42:20 -06:00
|
|
|
struct xkb_state *state;
|
|
|
|
xkb_mod_index_t alt, shift, caps, ctrl, mod5;
|
2012-08-08 06:26:23 -06:00
|
|
|
xkb_mod_mask_t mask;
|
|
|
|
|
state: fix consumed modifier calculation
The current calculation is in short:
entry ? (entry->mask & ~entry->preserve) : 0
This changes it be
type->mask & ~(entry ? entry->preserve : 0)
This is what Xlib does. While less intuitive, it is actually more
correct, if you follow this deduction:
- The key group's type->mask defines which modifiers the key even cares
about. The others are completely irrelevant (and in fact they are
masked out from all sided in the level calculation). Example: NumLock
for an alphabetic key.
- The type->mask, the mods which are not masked out, are *all* relevant
(and in fact in the level calculation they must match *exactly* to the
state). These mods affect which level is chosen for the key, whether
they are active or not.
- Because the type->mask mods are all relevant, they must be considered
as consumed by the calculation *even if they are not active*.
Therefore we use type->mask instead of entry->mask.
The second change is what happens when no entry is found: return 0 or
just take preserve to be 0? Let's consider an example, the basic type
type "ALPHABETIC" {
modifiers = Shift+Lock;
map[Shift] = Level2;
map[Lock] = Level2;
level_name[Level1] = "Base";
level_name[Level2] = "Caps";
};
Suppose Shift+Lock is active - it doesn't match any entry, thus it gets
to level 0. The first interpretation would take them both to be
unconsumed, the second (new one) would take them both to be consumed.
This seems much better: Caps is active, and Shift disables it, they both
do something.
This change also fixes a pretty lousy bug (since 0.3.2), where Shift
appears to apparently *not* disable Caps. What actually happens is that
Caps is not consumed (see above) but active, thus the implicit
capitalization in get_one_sym() kicks in and capitalizes it anyway.
Reported-by: Davinder Pal Singh Bhamra
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-03-27 09:42:20 -06:00
|
|
|
state = xkb_state_new(keymap);
|
2012-08-08 06:26:23 -06:00
|
|
|
assert(state);
|
|
|
|
|
2012-09-21 05:44:17 -06:00
|
|
|
alt = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_ALT);
|
2012-08-08 06:26:23 -06:00
|
|
|
assert(alt != XKB_MOD_INVALID);
|
2012-09-21 05:44:17 -06:00
|
|
|
shift = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_SHIFT);
|
2012-08-08 06:26:23 -06:00
|
|
|
assert(shift != XKB_MOD_INVALID);
|
state: fix consumed modifier calculation
The current calculation is in short:
entry ? (entry->mask & ~entry->preserve) : 0
This changes it be
type->mask & ~(entry ? entry->preserve : 0)
This is what Xlib does. While less intuitive, it is actually more
correct, if you follow this deduction:
- The key group's type->mask defines which modifiers the key even cares
about. The others are completely irrelevant (and in fact they are
masked out from all sided in the level calculation). Example: NumLock
for an alphabetic key.
- The type->mask, the mods which are not masked out, are *all* relevant
(and in fact in the level calculation they must match *exactly* to the
state). These mods affect which level is chosen for the key, whether
they are active or not.
- Because the type->mask mods are all relevant, they must be considered
as consumed by the calculation *even if they are not active*.
Therefore we use type->mask instead of entry->mask.
The second change is what happens when no entry is found: return 0 or
just take preserve to be 0? Let's consider an example, the basic type
type "ALPHABETIC" {
modifiers = Shift+Lock;
map[Shift] = Level2;
map[Lock] = Level2;
level_name[Level1] = "Base";
level_name[Level2] = "Caps";
};
Suppose Shift+Lock is active - it doesn't match any entry, thus it gets
to level 0. The first interpretation would take them both to be
unconsumed, the second (new one) would take them both to be consumed.
This seems much better: Caps is active, and Shift disables it, they both
do something.
This change also fixes a pretty lousy bug (since 0.3.2), where Shift
appears to apparently *not* disable Caps. What actually happens is that
Caps is not consumed (see above) but active, thus the implicit
capitalization in get_one_sym() kicks in and capitalizes it anyway.
Reported-by: Davinder Pal Singh Bhamra
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-03-27 09:42:20 -06:00
|
|
|
caps = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_CAPS);
|
|
|
|
assert(caps != XKB_MOD_INVALID);
|
|
|
|
ctrl = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_CTRL);
|
|
|
|
assert(ctrl != XKB_MOD_INVALID);
|
|
|
|
mod5 = xkb_keymap_mod_get_index(keymap, "Mod5");
|
|
|
|
assert(mod5 != XKB_MOD_INVALID);
|
2012-08-08 06:26:23 -06:00
|
|
|
|
state: fix consumed modifier calculation
The current calculation is in short:
entry ? (entry->mask & ~entry->preserve) : 0
This changes it be
type->mask & ~(entry ? entry->preserve : 0)
This is what Xlib does. While less intuitive, it is actually more
correct, if you follow this deduction:
- The key group's type->mask defines which modifiers the key even cares
about. The others are completely irrelevant (and in fact they are
masked out from all sided in the level calculation). Example: NumLock
for an alphabetic key.
- The type->mask, the mods which are not masked out, are *all* relevant
(and in fact in the level calculation they must match *exactly* to the
state). These mods affect which level is chosen for the key, whether
they are active or not.
- Because the type->mask mods are all relevant, they must be considered
as consumed by the calculation *even if they are not active*.
Therefore we use type->mask instead of entry->mask.
The second change is what happens when no entry is found: return 0 or
just take preserve to be 0? Let's consider an example, the basic type
type "ALPHABETIC" {
modifiers = Shift+Lock;
map[Shift] = Level2;
map[Lock] = Level2;
level_name[Level1] = "Base";
level_name[Level2] = "Caps";
};
Suppose Shift+Lock is active - it doesn't match any entry, thus it gets
to level 0. The first interpretation would take them both to be
unconsumed, the second (new one) would take them both to be consumed.
This seems much better: Caps is active, and Shift disables it, they both
do something.
This change also fixes a pretty lousy bug (since 0.3.2), where Shift
appears to apparently *not* disable Caps. What actually happens is that
Caps is not consumed (see above) but active, thus the implicit
capitalization in get_one_sym() kicks in and capitalizes it anyway.
Reported-by: Davinder Pal Singh Bhamra
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-03-27 09:42:20 -06:00
|
|
|
/* Test remove_consumed() */
|
2012-08-08 06:26:23 -06:00
|
|
|
xkb_state_update_key(state, KEY_LEFTALT + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
xkb_state_update_key(state, KEY_LEFTSHIFT + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
xkb_state_update_key(state, KEY_EQUAL + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
|
|
|
|
fprintf(stderr, "dumping state for Alt-Shift-+\n");
|
|
|
|
print_state(state);
|
|
|
|
|
2012-10-22 12:49:44 -06:00
|
|
|
mask = xkb_state_serialize_mods(state, XKB_STATE_MODS_EFFECTIVE);
|
2014-02-07 15:27:54 -07:00
|
|
|
assert(mask == ((1U << alt) | (1U << shift)));
|
2012-09-21 05:44:17 -06:00
|
|
|
mask = xkb_state_mod_mask_remove_consumed(state, KEY_EQUAL + EVDEV_OFFSET,
|
|
|
|
mask);
|
2014-02-07 15:27:54 -07:00
|
|
|
assert(mask == (1U << alt));
|
2012-08-08 06:26:23 -06:00
|
|
|
|
state: fix consumed modifier calculation
The current calculation is in short:
entry ? (entry->mask & ~entry->preserve) : 0
This changes it be
type->mask & ~(entry ? entry->preserve : 0)
This is what Xlib does. While less intuitive, it is actually more
correct, if you follow this deduction:
- The key group's type->mask defines which modifiers the key even cares
about. The others are completely irrelevant (and in fact they are
masked out from all sided in the level calculation). Example: NumLock
for an alphabetic key.
- The type->mask, the mods which are not masked out, are *all* relevant
(and in fact in the level calculation they must match *exactly* to the
state). These mods affect which level is chosen for the key, whether
they are active or not.
- Because the type->mask mods are all relevant, they must be considered
as consumed by the calculation *even if they are not active*.
Therefore we use type->mask instead of entry->mask.
The second change is what happens when no entry is found: return 0 or
just take preserve to be 0? Let's consider an example, the basic type
type "ALPHABETIC" {
modifiers = Shift+Lock;
map[Shift] = Level2;
map[Lock] = Level2;
level_name[Level1] = "Base";
level_name[Level2] = "Caps";
};
Suppose Shift+Lock is active - it doesn't match any entry, thus it gets
to level 0. The first interpretation would take them both to be
unconsumed, the second (new one) would take them both to be consumed.
This seems much better: Caps is active, and Shift disables it, they both
do something.
This change also fixes a pretty lousy bug (since 0.3.2), where Shift
appears to apparently *not* disable Caps. What actually happens is that
Caps is not consumed (see above) but active, thus the implicit
capitalization in get_one_sym() kicks in and capitalizes it anyway.
Reported-by: Davinder Pal Singh Bhamra
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-03-27 09:42:20 -06:00
|
|
|
/* Test get_consumed_mods() */
|
2014-02-21 16:09:00 -07:00
|
|
|
mask = xkb_state_key_get_consumed_mods(state, KEY_EQUAL + EVDEV_OFFSET);
|
|
|
|
assert(mask == (1U << shift));
|
|
|
|
|
state: fix consumed modifier calculation
The current calculation is in short:
entry ? (entry->mask & ~entry->preserve) : 0
This changes it be
type->mask & ~(entry ? entry->preserve : 0)
This is what Xlib does. While less intuitive, it is actually more
correct, if you follow this deduction:
- The key group's type->mask defines which modifiers the key even cares
about. The others are completely irrelevant (and in fact they are
masked out from all sided in the level calculation). Example: NumLock
for an alphabetic key.
- The type->mask, the mods which are not masked out, are *all* relevant
(and in fact in the level calculation they must match *exactly* to the
state). These mods affect which level is chosen for the key, whether
they are active or not.
- Because the type->mask mods are all relevant, they must be considered
as consumed by the calculation *even if they are not active*.
Therefore we use type->mask instead of entry->mask.
The second change is what happens when no entry is found: return 0 or
just take preserve to be 0? Let's consider an example, the basic type
type "ALPHABETIC" {
modifiers = Shift+Lock;
map[Shift] = Level2;
map[Lock] = Level2;
level_name[Level1] = "Base";
level_name[Level2] = "Caps";
};
Suppose Shift+Lock is active - it doesn't match any entry, thus it gets
to level 0. The first interpretation would take them both to be
unconsumed, the second (new one) would take them both to be consumed.
This seems much better: Caps is active, and Shift disables it, they both
do something.
This change also fixes a pretty lousy bug (since 0.3.2), where Shift
appears to apparently *not* disable Caps. What actually happens is that
Caps is not consumed (see above) but active, thus the implicit
capitalization in get_one_sym() kicks in and capitalizes it anyway.
Reported-by: Davinder Pal Singh Bhamra
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-03-27 09:42:20 -06:00
|
|
|
mask = xkb_state_key_get_consumed_mods(state, KEY_ESC + EVDEV_OFFSET);
|
|
|
|
assert(mask == 0);
|
|
|
|
|
|
|
|
xkb_state_unref(state);
|
|
|
|
|
|
|
|
/* Test is_consumed() - simple ALPHABETIC type. */
|
|
|
|
state = xkb_state_new(keymap);
|
|
|
|
assert(state);
|
|
|
|
|
|
|
|
mask = xkb_state_key_get_consumed_mods(state, KEY_A + EVDEV_OFFSET);
|
|
|
|
assert(mask == ((1U << shift) | (1U << caps)));
|
|
|
|
|
|
|
|
assert(xkb_state_mod_index_is_consumed(state, KEY_A + EVDEV_OFFSET, caps) > 0);
|
|
|
|
assert(xkb_state_mod_index_is_consumed(state, KEY_A + EVDEV_OFFSET, shift) > 0);
|
|
|
|
xkb_state_update_key(state, KEY_CAPSLOCK + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
xkb_state_update_key(state, KEY_CAPSLOCK + EVDEV_OFFSET, XKB_KEY_UP);
|
|
|
|
assert(xkb_state_mod_index_is_consumed(state, KEY_A + EVDEV_OFFSET, caps) > 0);
|
|
|
|
assert(xkb_state_mod_index_is_consumed(state, KEY_A + EVDEV_OFFSET, shift) > 0);
|
|
|
|
xkb_state_update_key(state, KEY_LEFTSHIFT + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
assert(xkb_state_mod_index_is_consumed(state, KEY_A + EVDEV_OFFSET, caps) > 0);
|
|
|
|
assert(xkb_state_mod_index_is_consumed(state, KEY_A + EVDEV_OFFSET, shift) > 0);
|
|
|
|
xkb_state_update_key(state, KEY_LEFTSHIFT + EVDEV_OFFSET, XKB_KEY_UP);
|
|
|
|
xkb_state_update_key(state, KEY_CAPSLOCK + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
xkb_state_update_key(state, KEY_CAPSLOCK + EVDEV_OFFSET, XKB_KEY_UP);
|
|
|
|
assert(xkb_state_mod_index_is_consumed(state, KEY_A + EVDEV_OFFSET, caps) > 0);
|
|
|
|
assert(xkb_state_mod_index_is_consumed(state, KEY_A + EVDEV_OFFSET, shift) > 0);
|
|
|
|
|
|
|
|
xkb_state_unref(state);
|
|
|
|
|
|
|
|
/* More complicated - CTRL+ALT */
|
|
|
|
state = xkb_state_new(keymap);
|
2016-10-22 11:13:11 -06:00
|
|
|
assert(state);
|
state: fix consumed modifier calculation
The current calculation is in short:
entry ? (entry->mask & ~entry->preserve) : 0
This changes it be
type->mask & ~(entry ? entry->preserve : 0)
This is what Xlib does. While less intuitive, it is actually more
correct, if you follow this deduction:
- The key group's type->mask defines which modifiers the key even cares
about. The others are completely irrelevant (and in fact they are
masked out from all sided in the level calculation). Example: NumLock
for an alphabetic key.
- The type->mask, the mods which are not masked out, are *all* relevant
(and in fact in the level calculation they must match *exactly* to the
state). These mods affect which level is chosen for the key, whether
they are active or not.
- Because the type->mask mods are all relevant, they must be considered
as consumed by the calculation *even if they are not active*.
Therefore we use type->mask instead of entry->mask.
The second change is what happens when no entry is found: return 0 or
just take preserve to be 0? Let's consider an example, the basic type
type "ALPHABETIC" {
modifiers = Shift+Lock;
map[Shift] = Level2;
map[Lock] = Level2;
level_name[Level1] = "Base";
level_name[Level2] = "Caps";
};
Suppose Shift+Lock is active - it doesn't match any entry, thus it gets
to level 0. The first interpretation would take them both to be
unconsumed, the second (new one) would take them both to be consumed.
This seems much better: Caps is active, and Shift disables it, they both
do something.
This change also fixes a pretty lousy bug (since 0.3.2), where Shift
appears to apparently *not* disable Caps. What actually happens is that
Caps is not consumed (see above) but active, thus the implicit
capitalization in get_one_sym() kicks in and capitalizes it anyway.
Reported-by: Davinder Pal Singh Bhamra
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-03-27 09:42:20 -06:00
|
|
|
|
|
|
|
mask = xkb_state_key_get_consumed_mods(state, KEY_F1 + EVDEV_OFFSET);
|
|
|
|
assert(mask == ((1U << shift) | (1U << alt) | (1U << ctrl) | (1U << mod5)));
|
|
|
|
|
|
|
|
/* Shift is preserved. */
|
|
|
|
xkb_state_update_key(state, KEY_LEFTSHIFT + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
mask = xkb_state_key_get_consumed_mods(state, KEY_F1 + EVDEV_OFFSET);
|
|
|
|
assert(mask == ((1U << alt) | (1U << ctrl) | (1U << mod5)));
|
|
|
|
xkb_state_update_key(state, KEY_LEFTSHIFT + EVDEV_OFFSET, XKB_KEY_UP);
|
|
|
|
|
|
|
|
mask = xkb_state_key_get_consumed_mods(state, KEY_F1 + EVDEV_OFFSET);
|
|
|
|
assert(mask == ((1U << shift) | (1U << alt) | (1U << ctrl) | (1U << mod5)));
|
|
|
|
|
2012-08-08 06:26:23 -06:00
|
|
|
xkb_state_unref(state);
|
2016-02-27 13:31:16 -07:00
|
|
|
|
|
|
|
/* Test XKB_CONSUMED_MODE_GTK, CTRL+ALT */
|
|
|
|
state = xkb_state_new(keymap);
|
|
|
|
assert(state);
|
|
|
|
|
|
|
|
mask = xkb_state_key_get_consumed_mods2(state, KEY_F1 + EVDEV_OFFSET,
|
|
|
|
XKB_CONSUMED_MODE_GTK);
|
|
|
|
assert(mask == 0);
|
|
|
|
|
|
|
|
xkb_state_update_key(state, KEY_LEFTCTRL + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
mask = xkb_state_key_get_consumed_mods2(state, KEY_F1 + EVDEV_OFFSET,
|
|
|
|
XKB_CONSUMED_MODE_GTK);
|
|
|
|
assert(mask == 0);
|
|
|
|
|
|
|
|
xkb_state_update_key(state, KEY_LEFTALT + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
mask = xkb_state_key_get_consumed_mods2(state, KEY_F1 + EVDEV_OFFSET,
|
|
|
|
XKB_CONSUMED_MODE_GTK);
|
|
|
|
assert(mask == ((1U << alt) | (1U << ctrl)));
|
|
|
|
|
|
|
|
xkb_state_unref(state);
|
|
|
|
|
|
|
|
/* Test XKB_CONSUMED_MODE_GTK, Simple Shift */
|
|
|
|
state = xkb_state_new(keymap);
|
|
|
|
assert(state);
|
|
|
|
|
|
|
|
mask = xkb_state_key_get_consumed_mods2(state, KEY_A + EVDEV_OFFSET,
|
|
|
|
XKB_CONSUMED_MODE_GTK);
|
|
|
|
assert(mask == ((1U << shift) | (1U << caps)));
|
|
|
|
|
|
|
|
xkb_state_update_key(state, KEY_LEFTALT + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
mask = xkb_state_key_get_consumed_mods2(state, KEY_A + EVDEV_OFFSET,
|
|
|
|
XKB_CONSUMED_MODE_GTK);
|
|
|
|
assert(mask == ((1U << shift) | (1U << caps)));
|
|
|
|
|
|
|
|
xkb_state_unref(state);
|
2012-08-08 06:26:23 -06:00
|
|
|
}
|
|
|
|
|
2013-05-09 08:31:21 -06:00
|
|
|
static void
|
|
|
|
key_iter(struct xkb_keymap *keymap, xkb_keycode_t key, void *data)
|
|
|
|
{
|
2014-02-07 15:27:54 -07:00
|
|
|
xkb_keycode_t *counter = data;
|
2013-05-09 08:31:21 -06:00
|
|
|
|
|
|
|
assert(*counter == key);
|
|
|
|
(*counter)++;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
test_range(struct xkb_keymap *keymap)
|
|
|
|
{
|
2014-02-07 15:27:54 -07:00
|
|
|
xkb_keycode_t counter;
|
2013-05-09 08:31:21 -06:00
|
|
|
|
|
|
|
assert(xkb_keymap_min_keycode(keymap) == 9);
|
|
|
|
assert(xkb_keymap_max_keycode(keymap) == 253);
|
|
|
|
|
|
|
|
counter = xkb_keymap_min_keycode(keymap);
|
|
|
|
xkb_keymap_key_for_each(keymap, key_iter, &counter);
|
|
|
|
assert(counter == xkb_keymap_max_keycode(keymap) + 1);
|
|
|
|
}
|
|
|
|
|
2013-08-13 09:57:43 -06:00
|
|
|
static void
|
|
|
|
test_caps_keysym_transformation(struct xkb_keymap *keymap)
|
|
|
|
{
|
|
|
|
struct xkb_state *state = xkb_state_new(keymap);
|
|
|
|
xkb_mod_index_t caps, shift;
|
|
|
|
int nsyms;
|
|
|
|
xkb_keysym_t sym;
|
|
|
|
const xkb_keysym_t *syms;
|
|
|
|
|
|
|
|
assert(state);
|
|
|
|
|
|
|
|
/* See xkb_state_key_get_one_sym() for what's this all about. */
|
|
|
|
|
|
|
|
caps = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_CAPS);
|
|
|
|
shift = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_SHIFT);
|
2014-02-07 15:42:54 -07:00
|
|
|
assert(caps != XKB_MOD_INVALID && shift != XKB_MOD_INVALID);
|
2013-08-13 09:57:43 -06:00
|
|
|
|
|
|
|
assert(xkb_state_key_get_layout(state, KEY_A + 8) == 0);
|
|
|
|
assert(xkb_state_key_get_layout(state, KEY_SEMICOLON + 8) == 0);
|
|
|
|
|
|
|
|
/* Without caps, no transformation. */
|
|
|
|
assert(xkb_state_mod_index_is_active(state, caps, XKB_STATE_MODS_EFFECTIVE) == 0);
|
|
|
|
assert(xkb_state_mod_index_is_active(state, shift, XKB_STATE_MODS_EFFECTIVE) == 0);
|
|
|
|
assert(xkb_state_key_get_level(state, KEY_A + 8, 0) == 0);
|
|
|
|
sym = xkb_state_key_get_one_sym(state, KEY_A + 8);
|
|
|
|
assert(sym == XKB_KEY_a);
|
|
|
|
assert(xkb_state_key_get_level(state, KEY_SEMICOLON + 8, 0) == 0);
|
|
|
|
sym = xkb_state_key_get_one_sym(state, KEY_SEMICOLON + 8);
|
|
|
|
assert(sym == XKB_KEY_eacute);
|
|
|
|
nsyms = xkb_state_key_get_syms(state, KEY_SEMICOLON + 8, &syms);
|
|
|
|
assert(nsyms == 1 && syms[0] == XKB_KEY_eacute);
|
|
|
|
|
|
|
|
/* With shift, no transformation (only different level). */
|
|
|
|
xkb_state_update_key(state, KEY_LEFTSHIFT + 8, XKB_KEY_DOWN);
|
|
|
|
assert(xkb_state_mod_index_is_active(state, caps, XKB_STATE_MODS_EFFECTIVE) == 0);
|
|
|
|
assert(xkb_state_mod_index_is_active(state, shift, XKB_STATE_MODS_EFFECTIVE) > 0);
|
|
|
|
assert(xkb_state_key_get_level(state, KEY_A + 8, 0) == 1);
|
|
|
|
sym = xkb_state_key_get_one_sym(state, KEY_A + 8);
|
|
|
|
assert(sym == XKB_KEY_A);
|
|
|
|
sym = xkb_state_key_get_one_sym(state, KEY_SEMICOLON + 8);
|
|
|
|
assert(sym == XKB_KEY_odiaeresis);
|
|
|
|
nsyms = xkb_state_key_get_syms(state, KEY_SEMICOLON + 8, &syms);
|
|
|
|
assert(nsyms == 1 && syms[0] == XKB_KEY_odiaeresis);
|
|
|
|
xkb_state_update_key(state, KEY_LEFTSHIFT + 8, XKB_KEY_UP);
|
|
|
|
assert(xkb_state_mod_index_is_active(state, shift, XKB_STATE_MODS_EFFECTIVE) == 0);
|
|
|
|
|
|
|
|
/* With caps, transform in same level, only with _get_one_sym(). */
|
|
|
|
xkb_state_update_key(state, KEY_CAPSLOCK + 8, XKB_KEY_DOWN);
|
|
|
|
xkb_state_update_key(state, KEY_CAPSLOCK + 8, XKB_KEY_UP);
|
|
|
|
assert(xkb_state_mod_index_is_active(state, caps, XKB_STATE_MODS_EFFECTIVE) > 0);
|
|
|
|
assert(xkb_state_mod_index_is_active(state, shift, XKB_STATE_MODS_EFFECTIVE) == 0);
|
|
|
|
assert(xkb_state_key_get_level(state, KEY_A + 8, 0) == 1);
|
|
|
|
sym = xkb_state_key_get_one_sym(state, KEY_A + 8);
|
|
|
|
assert(sym == XKB_KEY_A);
|
|
|
|
assert(xkb_state_key_get_level(state, KEY_SEMICOLON + 8, 0) == 0);
|
|
|
|
sym = xkb_state_key_get_one_sym(state, KEY_SEMICOLON + 8);
|
|
|
|
assert(sym == XKB_KEY_Eacute);
|
|
|
|
nsyms = xkb_state_key_get_syms(state, KEY_SEMICOLON + 8, &syms);
|
|
|
|
assert(nsyms == 1 && syms[0] == XKB_KEY_eacute);
|
|
|
|
xkb_state_update_key(state, KEY_LEFTSHIFT + 8, XKB_KEY_UP);
|
|
|
|
assert(xkb_state_mod_index_is_active(state, shift, XKB_STATE_MODS_EFFECTIVE) == 0);
|
|
|
|
xkb_state_update_key(state, KEY_CAPSLOCK + 8, XKB_KEY_DOWN);
|
|
|
|
xkb_state_update_key(state, KEY_CAPSLOCK + 8, XKB_KEY_UP);
|
2013-09-25 01:05:26 -06:00
|
|
|
|
|
|
|
xkb_state_unref(state);
|
2013-08-13 09:57:43 -06:00
|
|
|
}
|
|
|
|
|
2014-03-21 15:00:17 -06:00
|
|
|
static void
|
|
|
|
test_get_utf8_utf32(struct xkb_keymap *keymap)
|
|
|
|
{
|
|
|
|
char buf[256];
|
|
|
|
struct xkb_state *state = xkb_state_new(keymap);
|
|
|
|
assert(state);
|
|
|
|
|
|
|
|
#define TEST_KEY(key, expected_utf8, expected_utf32) do { \
|
|
|
|
assert(xkb_state_key_get_utf8(state, key + 8, NULL, 0) == strlen(expected_utf8)); \
|
|
|
|
assert(xkb_state_key_get_utf8(state, key + 8, buf, sizeof(buf)) == strlen(expected_utf8)); \
|
|
|
|
assert(memcmp(buf, expected_utf8, sizeof(expected_utf8)) == 0); \
|
|
|
|
assert(xkb_state_key_get_utf32(state, key + 8) == expected_utf32); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
/* Simple ASCII. */
|
|
|
|
TEST_KEY(KEY_A, "a", 0x61);
|
|
|
|
TEST_KEY(KEY_ESC, "\x1B", 0x1B);
|
|
|
|
TEST_KEY(KEY_1, "1", 0x31);
|
|
|
|
|
|
|
|
/* Invalid. */
|
|
|
|
TEST_KEY(XKB_KEYCODE_INVALID - 8, "", 0);
|
|
|
|
TEST_KEY(300, "", 0);
|
|
|
|
|
|
|
|
/* No string. */
|
|
|
|
TEST_KEY(KEY_LEFTCTRL, "", 0);
|
|
|
|
TEST_KEY(KEY_NUMLOCK, "", 0);
|
|
|
|
|
|
|
|
/* Multiple keysyms. */
|
|
|
|
TEST_KEY(KEY_6, "HELLO", 0);
|
|
|
|
TEST_KEY(KEY_7, "YES THIS IS DOG", 0);
|
|
|
|
|
|
|
|
/* Check truncation. */
|
|
|
|
memset(buf, 'X', sizeof(buf));
|
|
|
|
assert(xkb_state_key_get_utf8(state, KEY_6 + 8, buf, 0) == strlen("HELLO"));
|
|
|
|
assert(memcmp(buf, "X", 1) == 0);
|
|
|
|
assert(xkb_state_key_get_utf8(state, KEY_6 + 8, buf, 1) == strlen("HELLO"));
|
|
|
|
assert(memcmp(buf, "", 1) == 0);
|
|
|
|
assert(xkb_state_key_get_utf8(state, KEY_6 + 8, buf, 2) == strlen("HELLO"));
|
|
|
|
assert(memcmp(buf, "H", 2) == 0);
|
|
|
|
assert(xkb_state_key_get_utf8(state, KEY_6 + 8, buf, 3) == strlen("HELLO"));
|
|
|
|
assert(memcmp(buf, "HE", 3) == 0);
|
|
|
|
assert(xkb_state_key_get_utf8(state, KEY_6 + 8, buf, 5) == strlen("HELLO"));
|
|
|
|
assert(memcmp(buf, "HELL", 5) == 0);
|
|
|
|
assert(xkb_state_key_get_utf8(state, KEY_6 + 8, buf, 6) == strlen("HELLO"));
|
|
|
|
assert(memcmp(buf, "HELLO", 6) == 0);
|
|
|
|
assert(xkb_state_key_get_utf8(state, KEY_6 + 8, buf, 7) == strlen("HELLO"));
|
|
|
|
assert(memcmp(buf, "HELLO\0X", 7) == 0);
|
|
|
|
|
|
|
|
/* Switch to ru layout */
|
|
|
|
xkb_state_update_key(state, KEY_COMPOSE + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
xkb_state_update_key(state, KEY_COMPOSE + EVDEV_OFFSET, XKB_KEY_UP);
|
|
|
|
assert(xkb_state_key_get_layout(state, KEY_A + 8) == 1);
|
|
|
|
|
|
|
|
/* Non ASCII. */
|
|
|
|
TEST_KEY(KEY_ESC, "\x1B", 0x1B);
|
|
|
|
TEST_KEY(KEY_A, "ф", 0x0444);
|
|
|
|
TEST_KEY(KEY_Z, "я", 0x044F);
|
|
|
|
|
|
|
|
/* Switch back to us layout */
|
|
|
|
xkb_state_update_key(state, KEY_COMPOSE + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
xkb_state_update_key(state, KEY_COMPOSE + EVDEV_OFFSET, XKB_KEY_UP);
|
|
|
|
assert(xkb_state_key_get_layout(state, KEY_A + 8) == 0);
|
|
|
|
|
|
|
|
xkb_state_update_key(state, KEY_LEFTSHIFT + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
TEST_KEY(KEY_A, "A", 0x41);
|
|
|
|
TEST_KEY(KEY_ESC, "\x1B", 0x1B);
|
|
|
|
TEST_KEY(KEY_1, "!", 0x21);
|
|
|
|
xkb_state_update_key(state, KEY_LEFTSHIFT + EVDEV_OFFSET, XKB_KEY_UP);
|
|
|
|
|
|
|
|
TEST_KEY(KEY_6, "HELLO", 0);
|
|
|
|
TEST_KEY(KEY_7, "YES THIS IS DOG", 0);
|
|
|
|
|
|
|
|
xkb_state_unref(state);
|
|
|
|
}
|
|
|
|
|
2014-03-21 15:00:37 -06:00
|
|
|
static void
|
|
|
|
test_ctrl_string_transformation(struct xkb_keymap *keymap)
|
|
|
|
{
|
|
|
|
char buf[256];
|
|
|
|
struct xkb_state *state = xkb_state_new(keymap);
|
|
|
|
xkb_mod_index_t ctrl;
|
|
|
|
|
|
|
|
assert(state);
|
|
|
|
|
|
|
|
/* See xkb_state_key_get_utf8() for what's this all about. */
|
|
|
|
|
|
|
|
ctrl = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_CTRL);
|
|
|
|
assert(ctrl != XKB_MOD_INVALID);
|
|
|
|
|
|
|
|
/* First without. */
|
|
|
|
TEST_KEY(KEY_A, "a", 0x61);
|
|
|
|
TEST_KEY(KEY_B, "b", 0x62);
|
|
|
|
TEST_KEY(KEY_C, "c", 0x63);
|
|
|
|
TEST_KEY(KEY_ESC, "\x1B", 0x1B);
|
|
|
|
TEST_KEY(KEY_1, "1", 0x31);
|
|
|
|
|
|
|
|
/* And with. */
|
|
|
|
xkb_state_update_key(state, KEY_RIGHTCTRL + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
assert(xkb_state_mod_index_is_active(state, ctrl, XKB_STATE_MODS_EFFECTIVE) > 0);
|
|
|
|
TEST_KEY(KEY_A, "\x01", 0x01);
|
|
|
|
TEST_KEY(KEY_B, "\x02", 0x02);
|
|
|
|
TEST_KEY(KEY_C, "\x03", 0x03);
|
|
|
|
TEST_KEY(KEY_ESC, "\x1B", 0x1B);
|
|
|
|
TEST_KEY(KEY_1, "1", 0x31);
|
|
|
|
xkb_state_update_key(state, KEY_RIGHTCTRL + EVDEV_OFFSET, XKB_KEY_UP);
|
|
|
|
|
|
|
|
/* Switch to ru layout */
|
|
|
|
xkb_state_update_key(state, KEY_COMPOSE + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
xkb_state_update_key(state, KEY_COMPOSE + EVDEV_OFFSET, XKB_KEY_UP);
|
|
|
|
assert(xkb_state_key_get_layout(state, KEY_A + 8) == 1);
|
|
|
|
|
|
|
|
/* Non ASCII. */
|
|
|
|
xkb_state_update_key(state, KEY_RIGHTCTRL + EVDEV_OFFSET, XKB_KEY_DOWN);
|
|
|
|
assert(xkb_state_mod_index_is_active(state, ctrl, XKB_STATE_MODS_EFFECTIVE) > 0);
|
|
|
|
TEST_KEY(KEY_A, "\x01", 0x01);
|
|
|
|
TEST_KEY(KEY_B, "\x02", 0x02);
|
|
|
|
xkb_state_update_key(state, KEY_RIGHTCTRL + EVDEV_OFFSET, XKB_KEY_UP);
|
|
|
|
|
|
|
|
xkb_state_unref(state);
|
|
|
|
}
|
|
|
|
|
2012-03-27 05:07:57 -06:00
|
|
|
int
|
2012-03-30 17:44:39 -06:00
|
|
|
main(void)
|
2012-03-27 05:07:57 -06:00
|
|
|
{
|
2013-03-18 15:02:35 -06:00
|
|
|
struct xkb_context *context = test_get_context(0);
|
2012-05-09 08:15:30 -06:00
|
|
|
struct xkb_keymap *keymap;
|
2012-07-12 07:15:08 -06:00
|
|
|
|
2012-05-11 08:03:43 -06:00
|
|
|
assert(context);
|
2012-03-27 10:22:35 -06:00
|
|
|
|
2012-10-28 17:00:27 -06:00
|
|
|
/* Make sure these are allowed. */
|
|
|
|
xkb_context_unref(NULL);
|
|
|
|
xkb_keymap_unref(NULL);
|
|
|
|
xkb_state_unref(NULL);
|
|
|
|
|
2012-10-10 01:47:31 -06:00
|
|
|
keymap = test_compile_rules(context, "evdev", "pc104", "us,ru", NULL, "grp:menu_toggle");
|
2012-05-09 08:15:30 -06:00
|
|
|
assert(keymap);
|
2012-03-27 05:07:57 -06:00
|
|
|
|
2012-05-09 08:15:30 -06:00
|
|
|
test_update_key(keymap);
|
|
|
|
test_serialisation(keymap);
|
2014-08-18 12:03:06 -06:00
|
|
|
test_update_mask_mods(keymap);
|
2012-06-22 08:27:05 -06:00
|
|
|
test_repeat(keymap);
|
2012-08-08 06:26:23 -06:00
|
|
|
test_consume(keymap);
|
2013-05-09 08:31:21 -06:00
|
|
|
test_range(keymap);
|
2014-03-21 15:00:17 -06:00
|
|
|
test_get_utf8_utf32(keymap);
|
2014-03-21 15:00:37 -06:00
|
|
|
test_ctrl_string_transformation(keymap);
|
2012-03-27 05:07:57 -06:00
|
|
|
|
2013-08-13 09:57:43 -06:00
|
|
|
xkb_keymap_unref(keymap);
|
|
|
|
keymap = test_compile_rules(context, "evdev", NULL, "ch", "fr", NULL);
|
|
|
|
assert(keymap);
|
|
|
|
|
|
|
|
test_caps_keysym_transformation(keymap);
|
|
|
|
|
2012-09-21 05:44:17 -06:00
|
|
|
xkb_keymap_unref(keymap);
|
2012-05-11 08:03:43 -06:00
|
|
|
xkb_context_unref(context);
|
2012-03-20 20:20:07 -06:00
|
|
|
}
|