Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BsHLn-0007Zu-7l for qemu-devel@nongnu.org; Wed, 04 Aug 2004 04:42:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BsHLm-0007ZK-2I for qemu-devel@nongnu.org; Wed, 04 Aug 2004 04:42:18 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BsHLl-0007Ys-Q6 for qemu-devel@nongnu.org; Wed, 04 Aug 2004 04:42:17 -0400 Received: from [213.238.211.114] (helo=klotjohan.mine.nu) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1BsHI6-0002mk-9d for qemu-devel@nongnu.org; Wed, 04 Aug 2004 04:38:30 -0400 Received: from [192.168.0.4] (oxen [192.168.0.4]) by klotjohan.mine.nu (8.12.8/8.12.8) with ESMTP id i748cQ0G032482 for ; Wed, 4 Aug 2004 10:38:26 +0200 Date: Wed, 04 Aug 2004 10:38:26 +0200 From: Erik Karlsson Subject: Re: [Qemu-devel] Keyboard patch for windows In-Reply-To: <410FFF70.5070207@bellard.org> References: <20040719143203.B8E8.ERIK.KARLSSON@bonetmail.com> <410FFF70.5070207@bellard.org> Message-Id: <20040804103148.10A7.ERIK.KARLSSON@bonetmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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