Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.34) id 1BPwYz-0005TU-L8 for qemu-devel@nongnu.org; Tue, 18 May 2004 00:50:49 -0400 Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.34) id 1BPwYT-0005HI-AF for qemu-devel@nongnu.org; Tue, 18 May 2004 00:50:48 -0400 Received: from [66.54.152.27] (helo=jive.SoftHome.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1BPwYS-0005GT-Kv for qemu-devel@nongnu.org; Tue, 18 May 2004 00:50:17 -0400 From: Mulyadi Santosa Subject: Re: [Qemu-devel] keyboard shift-state problem Date: Tue, 18 May 2004 11:00:36 +0700 References: <40A95713.3050908@easynet.be> In-Reply-To: <40A95713.3050908@easynet.be> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_kpYqA5knPe6dGoC" Message-Id: <200405181100.36966.a_mulyadi@softhome.net> Reply-To: a_mulyadi@softhome.net, 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 Cc: marc.jonckheere@easynet.be --Boundary-00=_kpYqA5knPe6dGoC Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello Marc tested ur patch and confirmed--> IT WORKS !! :-) You really save me from headache..previously I had similar problem with Alt-tab. I use it frequently because I work on KDE 3.1 My box: Redhat 9.0 with SDL-1.2.5-3 and SDL-devel-1.2.5-3 I notice that ur patch is rejected on my box, so I do readjustment....I attach it here for comparison regards Mulyadi --Boundary-00=_kpYqA5knPe6dGoC Content-Type: text/x-diff; charset="iso-8859-15"; name="sdl-fix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="sdl-fix.patch" --- ./before-diff/sdl.c 2004-05-18 10:33:05.000000000 +0700 +++ ./sdl.c 2004-05-18 10:40:55.000000000 +0700 @@ -130,6 +130,7 @@ static void sdl_process_key(SDL_KeyboardEvent *ev) { int keycode, v; + static int modif; /* XXX: not portable, but avoids complicated mappings */ keycode = ev->keysym.scancode; @@ -150,6 +151,78 @@ } else { keycode = 0; } + /* Adjust shift-key states when leaving window */ + + if (ev->keysym.scancode == 0) { + if ((modif ^ ev->keysym.mod) & KMOD_LSHIFT) + kbd_put_keycode(0x2a | (modif & KMOD_LSHIFT ? 0x80 : 0)); + if ((modif ^ ev->keysym.mod) & KMOD_RSHIFT) + kbd_put_keycode(0x36 | (modif & KMOD_RSHIFT ? 0x80 : 0)); + if ((modif ^ ev->keysym.mod) & KMOD_LCTRL) + kbd_put_keycode(0x1d | (modif & KMOD_LCTRL ? 0x80 : 0)); + if ((modif ^ ev->keysym.mod) & KMOD_RCTRL) { + kbd_put_keycode(0xe0 ); + kbd_put_keycode(0x1d | (modif & KMOD_RCTRL ? 0x80 : 0)); + } + if ((modif ^ ev->keysym.mod) & KMOD_LALT) + kbd_put_keycode(0x38 | (modif & KMOD_LALT ? 0x80 : 0)); + if ((modif ^ ev->keysym.mod) & KMOD_RALT) { + kbd_put_keycode(0xe0 ); + kbd_put_keycode(0x38 | (modif & KMOD_RALT ? 0x80 : 0)); + } + modif = ev->keysym.mod; + } + + /* remember shift-key state */ + + switch (keycode) { + case 0x2a: /* Left Shift */ + if (ev->type == SDL_KEYUP) + modif &= ~KMOD_LSHIFT; + else + modif |= KMOD_LSHIFT; + break; + case 0x36: /* Right Shift */ + if (ev->type == SDL_KEYUP) + modif &= ~KMOD_RSHIFT; + else + modif |= KMOD_RSHIFT; + break; + case 0x1d: /* Left CTRL */ + if (ev->type == SDL_KEYUP) + modif &= ~KMOD_LCTRL; + else + modif |= KMOD_LCTRL; + break; + case 0x1de0: /* Right CTRL */ + if (ev->type == SDL_KEYUP) + modif &= ~KMOD_RCTRL; + else + modif |= KMOD_RCTRL; + break; + case 0x38: /* Left ALT */ + if (ev->type == SDL_KEYUP) + modif &= ~KMOD_LALT; + else + modif |= KMOD_LALT; + break; + case 0x38e0: /* Right ALT */ + if (ev->type == SDL_KEYUP) + modif &= ~KMOD_RALT; + else + modif |= KMOD_RALT; + break; + case 0x45: /* Num Lock */ + kbd_put_keycode(0x45); + kbd_put_keycode(0xc5); + return; + case 0x3a: /* Caps Lock */ + kbd_put_keycode(0x3a); + kbd_put_keycode(0xba); + return; + + } + /* now send the key code */ while (keycode != 0) { --Boundary-00=_kpYqA5knPe6dGoC--