diff options
author | Etienne Brateau <etienne.brateau@gmail.com> | 2024-03-10 00:48:38 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2024-03-10 17:00:12 +0100 |
commit | 3358b1473f52876c21e3acafe8f7eac41d01a290 (patch) | |
tree | 660b679180fd5254cf41b9d7d3f82bbb0f5ad3b8 /console-client/xkb/kstoucs.c | |
parent | 66c891b1cb9ba42bd1824ef0dbffba503697c405 (diff) | |
download | hurd-3358b1473f52876c21e3acafe8f7eac41d01a290.tar.gz hurd-3358b1473f52876c21e3acafe8f7eac41d01a290.tar.bz2 hurd-3358b1473f52876c21e3acafe8f7eac41d01a290.zip |
console-client: use xkbcommon instead of x11 for xkb extended support
This allow to reduce the dependencies, only xkbcommon (keyboard support
only) is required instead of the whole x11 library + lex + yacc.
This replacement allow to reduce the code size, now features are handled
by xkbcommon itself.
The functionnalites remain the sames (actions are reimplemented
but in the code directly as it’s impossible to add custom actions).
The custom xkb data files are removed as we can now directly use the
standard ones from xkeyboard-config.
The configuration to launch the console keyboard modules changed to now
directly configure the model+layout+variat+options directly.
Tested by compiling with and without xkbcommon.
Tested X11 (ran i3 correctly).
Composing is still working.
Message-ID: <20240309234838.31923-1-etienne.brateau@gmail.com>
Diffstat (limited to 'console-client/xkb/kstoucs.c')
-rw-r--r-- | console-client/xkb/kstoucs.c | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/console-client/xkb/kstoucs.c b/console-client/xkb/kstoucs.c deleted file mode 100644 index 59af1e9f..00000000 --- a/console-client/xkb/kstoucs.c +++ /dev/null @@ -1,58 +0,0 @@ -#include <assert-backtrace.h> - -struct ksmap { - int keysym; - unsigned int ucs; -}; - -#include "kstoucs_map.c" - -/* Binary search through `kstoucs_map'. */ -static unsigned int -find_ucs (int keysym, struct ksmap *first, struct ksmap *last) -{ - struct ksmap *middle = first + (last - first) / 2; - - assert_backtrace (first <= last); - - if (middle->keysym == keysym) - return middle->ucs; /* base case: needle found. */ - else if (first == last) /* empty search space */ - return 0; - /* recursive cases: halve search space. */ - else if (middle->keysym < keysym) - return find_ucs (keysym, middle+1, last); - else if (middle->keysym > keysym) - /* don't remove middle from the range to compensate - for rounding down in it's calculation */ - return find_ucs (keysym, first, middle); - return 0; -} - -unsigned int -KeySymToUcs4 (int keysym) -{ -#ifdef XKB_DEBUG - char *XKeysymToString(int keysym); - printf ("KeySymToUcs4: %s (%d) -> ", XKeysymToString (keysym), keysym); -unsigned int doit (int keysym) -{ -#endif - - /* Control characters not covered by keysym map. */ - if (keysym > 0 && keysym < 32) - return keysym; - - /* 'Unicode keysym' */ - if ((keysym & 0xff000000) == 0x01000000) - return (keysym & 0x00ffffff); - - #define NUM_KEYSYMS (sizeof kstoucs_map / sizeof(struct ksmap)) - return find_ucs(keysym, &kstoucs_map[0], &kstoucs_map[NUM_KEYSYMS - 1]); -#ifdef XKB_DEBUG -} - unsigned int ret = doit (keysym); - printf ("%d\n", ret); - return ret; -#endif -} |