qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Bug in SDL key event processing


From: Tomas Carnecky
Subject: Re: [Qemu-devel] Bug in SDL key event processing
Date: Thu, 10 Jul 2008 02:09:04 +0200
User-agent: Thunderbird 2.0.0.14 (X11/20080621)

Samuel Thibault wrote:
Tomas Carnecky, le Thu 10 Jul 2008 01:46:58 +0200, a écrit :
Samuel Thibault wrote:
Tomas Carnecky, le Thu 10 Jul 2008 01:27:49 +0200, a écrit :
Why is there OS (X11/Windows) specific code in the SDL frontend? And why does qemu need keymaps anyway?
The keymaps are for the VNC case, where you get a keyboard symbol, not a
keycode, so you need to know how to translate back into a scancode.
Well, every 'frontend' needs some kind of keymap table to map the events into bios scancodes.

The VNC frontend can not do that without keymap information, and that
information can be shared, and should be shared

There is a fundamental difference between SDL and VNC:

- SDL gets keycode, i.e. the _positional_ number of a key, i.e. for
instance the 1st key of the second row, which happens to be a Q on a
qwerty keyboard. That can be translated into scancodes with a fixed map
table.
- VNC gets symbols, i.e. the _semantic_ of a key, i.e. for instance 'Q',
which has to be translated into a scancode, and there you have the
problem of the expected layout of the keyboard: should that be
translated into scancode for the 1st key of the 2nd row, or for the 1st
key of the 3rd row (because the user has an azerty keyboard).


Fair enough. I didn't know that.

But you said it yourself, SDL doesn't need the keymap table, it can translate the keycodes on its own. So where is the need to share the keymaps? Do other frontends need the keymaps as well? Anyway, whatever you do, please don't try to be smart, parse the SDL 'scancode' (which is the X11 keycode) and use that to get the 'real' scancode. Maybe that works under win32, but under linux, the SDL scancode isn't guaranteed to be usable as an index into your x_keycode_to_pc_keycode table.

tom




reply via email to

[Prev in Thread] Current Thread [Next in Thread]