Skip to contentSkip to conversation

Bug in SDL key event processing

Qemu-devel Juergen Keil 1 participant 1 message Jul 10, 2008

lore
Share & tools
lore
#0 lore raw
Quoted 11 lines

QEMU assumes that the xserver uses the xfree86 model. See files in /usr/share/X11/xkb/keycodes/, especially 'xfree86' and 'evdev'. The files translate from scancodes that the drivers generate into xserver keycodes. The xfree86 file has '<UP> = 98', meaning that if the xkb driver generates 98 it means the user pressed the UP key. When QEMU uses 98 - 97 as the index into the x_keycode_to_pc_keycode table, which yields the correct Up scancode. But the 'evdev' keycode file in the xkb directory has '<UP> = 111', meaning that the evdev driver generates keycode 111 for the UP key.

Quoted 7 lines

Again, you _can not_ assume that the X keycode (XKeyEvent.keycode or SDL_KeyboardEvent.scancode) has any particular meaning. If you run on pure X11, you have to translate it into a keysym (XKeycodeToKeysym()) and use that instead. If you run on SDL, you have to use keysym.sym.

Am I the only one who uses the evdev driver and runs QEMU? I can't believe that.

Yes, the same issue exists when displaying to a non-Xorg server, e.g. the Xsun server on a Solaris/SPARC.

With an US English layout keyboard on the Solaris/SPARC machine, I get keycode 27 in xev (which translates to keysym 0xff52, "Up").

Qemu's sdl keyboard layout is broken when displaying to Xsun, unless I use "-k en-us".