qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Keyboard patch for windows


From: Fabrice Bellard
Subject: Re: [Qemu-devel] Keyboard patch for windows
Date: Wed, 04 Aug 2004 23:03:05 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624

From the windows API it seems that the bit 24 of lParam in the message WM_KEYDOWN contains what you want. From the SDL source code, it seems to be passed in the scancode field...

Fabrice.

Erik Karlsson wrote:
The problem is that some of the keycodes are prefixed with an e0 prefix.

Examples:
Numpad right arrow/6: 4d        Right arrow:   e0,4d
Numpad left arrow/4:  4b        Left arrow:    e0,4b
Left alt:             38        Right alt:     e0,38
Left control:         1d        Right control: e0,1d

The problem withs SDL is that SDL strips off the e0 prefix. The result
is that it is impossible to distinguish between e.g. the arrow keys and
the arrow on the numeric keypad and between left and right alt and
contol keys.

Another advantage with low level keyboard hooks is that you can capture
system key combinations such as Alt-Tab and Ctrl-Esc. sdl_grab_start()
does not do that on windows.

I agree that it is unclean to have native windows code in an SDL driver.
It would of course be better to have a separate keyboard driver for
windows. The problem is that the qemu architecture does not allow
separate drivers for keyboard, mouse and display. This makes a windows
driver just for the keybord impossible. A windows driver would then need
to implement keyboard, mouse and display natively on windows.

Erik


Strange since Windows should send the raw keycodes directly to SDL. I think your patch is too complicated to be integrated in an SDL target. Can you find a simpler solution ?

Fabrice.

Erik Karlsson wrote:

Keyboard input via SDL on windows it not working well. It is for example
impossible to distinguish between left and rihgt alt and control and
between the arrow keys and the numpad arrow keys.

I have fixed this problem by using windows low level keyboadrd hooks
(SetWindowsHookEx, WH_KEYBOARD_LL) instead of SDL for keyboard input.

Low level keybord hooks should work on windows NT 4.0 SP3 or later, eg.
windows 2000 and windows XP but not on windows 9x. For this reason I use
another method if low level keyboard hooks are unsupported. Tihis method
involves hooking up the winidow procedure and using some ugly fixes and
there is still problems when you press the two shift keys simultaneously.
I have however not tested this method on win9x because i have no win9x
machine to test it on.

Erik




_______________________________________________
Qemu-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/qemu-devel







reply via email to

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