Hi,
I´m currently implementing keyboard input for my game engine. For communication with the X Server (Ubuntu,Linux) I use xlib with the XKB extension. As far as I understand it the keyboard sends a hardware dependent scancode which gets somehow transformed into a device independent keycode (i guess via evdev ?). Every keycode can also have multiple keysyms associated with it which encode the character on the key cap depending on the modifier keys (shift, alt, numlock …).
Most of the time some keys should not depend on the keyboard layout like the famous W A S D movement. Thats why we need a way to describe the “physical location” of a key rather than the “logical value” (if this makes sense). In some sources it is stated that the X11 keycodes are device independent but after some testing with my razor huntsman and my keychron k6 (65% keyboard) I can say that some keys produce different keycodes altough they keys have the same physical key location. For example the windows key (last row, second key from left) on my huntsman produces keycode 133 while the key in the same location on my keychron produces keycode 64. Other keys like A-Z, 0-9, PageUp, PageDown produces the same keycodes.
Now my problem is that I dont know how I can describe the physical key location in a device independent manner with xlib on linux across keyboards with different physical layouts. Can you give me some tips in how to “solve” this problem ? Maybe I´m also confused and got something wrong D:
Thank you !