Portable key codes in X11?

I want to get display-independent codes, but the documentation says that the “keycode” in the XKeyEvent structure is hardware and driver dependent, and I cannot rely on it. How can I get some portable keycodes like VK_ * on Windows?

+3
source share
1 answer

You need key sims, not key codes. See XKeycodeToKeysym () and / usr / include / X 11 / keysymdef.h

To be strictly correct (especially with internationalization), you need a whole bunch of code according to http://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkkeys-x11.c However, if you use raw Xlib instead of a set of tools, you probably don’t care if you have been working for many years, and XKeycodeToKeysym () is good enough for American keyboards.

+4
source

Source: https://habr.com/ru/post/1761466/


All Articles