From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6l8x-00016S-GV for qemu-devel@nongnu.org; Thu, 01 Jan 2015 14:10:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y6l8s-0004vJ-HF for qemu-devel@nongnu.org; Thu, 01 Jan 2015 14:10:47 -0500 Received: from v220110690675601.yourvserver.net ([37.221.199.173]:53580) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6l8s-0004v9-7c for qemu-devel@nongnu.org; Thu, 01 Jan 2015 14:10:42 -0500 Message-ID: <54A59BA4.2090700@weilnetz.de> Date: Thu, 01 Jan 2015 20:10:28 +0100 From: Stefan Weil MIME-Version: 1.0 References: <20141218115528.GB25902@noname.redhat.com> <54A574D4.5050306@suse.de> In-Reply-To: <54A574D4.5050306@suse.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] alt-gr on Windows List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?windows-1252?Q?Andreas_F=E4rber?= , Kevin Wolf , "Thebault, Remi" Cc: Tim Hardeck , qemu-devel@nongnu.org Am 01.01.2015 um 17:24 schrieb Andreas F=E4rber: > Hi, Am 18.12.2014 um 12:55 schrieb Kevin Wolf: >> Am 17.12.2014 um 01:11 hat Thebault, Remi geschrieben: >>> This is not the first post on this topic, but I haven't seen any=20 >>> solution about it. I tested so far linux guest on windows host and=20 >>> the AltGr key is dead in the guest. (using git master branch) On=20 >>> french keyboard, the keys to yield the bar "|" are alt-gr + 6. when=20 >>> executing this combination on keyboard, Windows generates this: -=20 >>> L-CTRL - R-ALT - 6 in Qemu (only digged gtk UI so far), pressing=20 >>> alt-gr + 6 generates the following trace - L-CTRL - L-ALT <-- note=20 >>> left here - 6 This comes from the Win32 call MapVirtualKey in gtk.c=20 >>> that maps to scancodes without left/right distinction. Even when=20 >>> sending the right alt to the guest, the alt-gr key remains dead=20 >>> because of ctrl being virtually pressed. I found out however that if=20 >>> R-ALT + 6 is sent without the ctrl key, the guest finally recognize=20 >>> it and prints the bar, @, # and other [}{]. To make things easier,=20 >>> Windows delivers the ctrl code before the alt code, so catching it=20 >>> cleanly before delivery to the guest is probably tough. I could=20 >>> however come to an easy and quick fix with sending the "ctrl up"=20 >>> signal to the guest before the "r-alt down" is sent. My current code=20 >>> do not handle all corner cases (eg: turbo mode) and only fixes the=20 >>> gtk ui, but would such fix be accepted in the repo? Would this break=20 >>> somehow the windows guest on windows host?=20 >> CCing Stefan Weil, who is both the Windows maintainer and the author=20 >> of commit 2777ccc5, which introduced the MapVirtualKey() call. As=20 >> there is a special case for Alt Gr in the code, I suppose he had this=20 >> working back then. From what I understand (which isn't much when it's=20 >> about Windows), it seems very unlikely to me that the change would=20 >> break anything that is working today; but you should probably give it=20 >> some testing before posting a patch.=20 > Tim and colleagues have been investigating some AltGr issues on Linux=20 > / NoVNC as well, so it may well have been broken before Stefan's=20 > commit. Regards, Andreas=20 Indeed, when I wrote that commit, it fixed an AltGr issue. I spent the=20 last weeks (well, not all the time, but some minutes) to restore my=20 previous test scenario, but without success. Remi's patch is a clear improvement of the current situation, but the=20 problem is more complicated than one would think at a first glance. I suggest calling MapVirtualKey only for those keys which don't need=20 special handling, so it would be in the default case of the switch=20 statement. It looks like Alt-Ctrl is a valid alternative for pressing AltGr on=20 Windows, so we have to take that into account, too. Wine also needs special handling because it sends a single (different)=20 key code instead of two key codes. Regards Stefan