From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KGwkn-0003TY-3T for qemu-devel@nongnu.org; Thu, 10 Jul 2008 10:04:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KGwkl-0003QV-FV for qemu-devel@nongnu.org; Thu, 10 Jul 2008 10:04:11 -0400 Received: from [199.232.76.173] (port=39697 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KGwkl-0003QG-6W for qemu-devel@nongnu.org; Thu, 10 Jul 2008 10:04:11 -0400 Received: from dbservice.com ([213.239.204.14]:45831 helo=matterhorn.dbservice.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KGwkk-0006NZ-D4 for qemu-devel@nongnu.org; Thu, 10 Jul 2008 10:04:10 -0400 Received: from [192.168.0.27] (gw.ptr-62-65-141-13.customer.ch.netstream.com [62.65.141.13]) by matterhorn.dbservice.com (Postfix) with ESMTP id 5F76C20BB3C5 for ; Thu, 10 Jul 2008 16:03:54 +0200 (CEST) Message-ID: <487616BB.8020402@dbservice.com> Date: Thu, 10 Jul 2008 16:03:39 +0200 From: Tomas Carnecky MIME-Version: 1.0 Subject: Re: [Qemu-devel] Bug in SDL key event processing References: <48754975.1050303@dbservice.com> <20080709233752.GL4889@implementation> <48754DF2.2010704@dbservice.com> <20080709235516.GM4889@implementation> <48755320.5090707@dbservice.com> <48757FB8.8010400@codemonkey.ws> <4875C0B6.2060302@dbservice.com> <4876101A.1080800@codemonkey.ws> <487611FC.5070500@dbservice.com> In-Reply-To: <487611FC.5070500@dbservice.com> Content-Type: text/plain; charset=UTF-8; format=flowed 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 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 ' = 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 ' = 111', meaning that the evdev driver generates keycode 111 for the UP key. 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. tom