* [Qemu-devel] [PATCH] Fix virtual console switching with SDL on Mac OS X
@ 2005-07-22 21:24 Christian Walther
2005-07-22 22:40 ` Jim C. Brown
0 siblings, 1 reply; 4+ messages in thread
From: Christian Walther @ 2005-07-22 21:24 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 327 bytes --]
Has switching virtual consoles actually been broken with SDL on non-X11,
non-win32 platforms (i.e. Mac OS X) for 7 months without anyone noticing
?? Anyway, here's a patch that fixes it. Just a small change that was
forgotten in the keymaps support (sdl.c rev. 1.20). Applies to current
CVS as well as 0.7.0.
-Christian
[-- Attachment #2: qemu-sdl-vcswitch.patch --]
[-- Type: text/plain, Size: 857 bytes --]
Index: sdl.c
===================================================================
RCS file: /cvsroot/qemu/qemu/sdl.c,v
retrieving revision 1.21
diff -u -r1.21 sdl.c
--- sdl.c 17 Jan 2005 22:32:23 -0000 1.21
+++ sdl.c 22 Jul 2005 21:14:11 -0000
@@ -334,7 +334,11 @@
gui_key_modifier_pressed = mod_state;
if (gui_key_modifier_pressed) {
int keycode;
- keycode = sdl_keyevent_to_keycode(&ev->key);
+ if (kbd_layout) {
+ keycode = sdl_keyevent_to_keycode_generic(&ev->key);
+ } else {
+ keycode = sdl_keyevent_to_keycode(&ev->key);
+ }
switch(keycode) {
case 0x21: /* 'f' key on US keyboard */
toggle_full_screen(ds);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix virtual console switching with SDL on Mac OS X
2005-07-22 21:24 [Qemu-devel] [PATCH] Fix virtual console switching with SDL on Mac OS X Christian Walther
@ 2005-07-22 22:40 ` Jim C. Brown
2005-07-23 12:42 ` [Qemu-devel] " Christian Walther
0 siblings, 1 reply; 4+ messages in thread
From: Jim C. Brown @ 2005-07-22 22:40 UTC (permalink / raw)
To: qemu-devel
On Fri, Jul 22, 2005 at 11:24:21PM +0200, Christian Walther wrote:
> Has switching virtual consoles actually been broken with SDL on non-X11,
> non-win32 platforms (i.e. Mac OS X) for 7 months without anyone noticing
> ?? Anyway, here's a patch that fixes it. Just a small change that was
> forgotten in the keymaps support (sdl.c rev. 1.20). Applies to current
> CVS as well as 0.7.0.
>
> -Christian
Interesting.
Looks like the bug affects X11 and W32 as well, if you are not using a
US keymap.
--
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] Re: [PATCH] Fix virtual console switching with SDL on Mac OS X
2005-07-22 22:40 ` Jim C. Brown
@ 2005-07-23 12:42 ` Christian Walther
2005-07-23 18:46 ` Jim C. Brown
0 siblings, 1 reply; 4+ messages in thread
From: Christian Walther @ 2005-07-23 12:42 UTC (permalink / raw)
To: qemu-devel
Jim C. Brown wrote:
> On Fri, Jul 22, 2005 at 11:24:21PM +0200, Christian Walther wrote:
>
>>Has switching virtual consoles actually been broken with SDL on non-X11,
>>non-win32 platforms (i.e. Mac OS X) for 7 months without anyone noticing
>>?? Anyway, here's a patch that fixes it. Just a small change that was
>>forgotten in the keymaps support (sdl.c rev. 1.20). Applies to current
>>CVS as well as 0.7.0.
>>
>> -Christian
>
>
> Interesting.
>
> Looks like the bug affects X11 and W32 as well, if you are not using a
> US keymap.
I don't think so. The non-keymap code that was used before my patch
(sdl_keyevent_to_keycode()) uses event.key.keysym.scancode, which is
platform-dependent, but refers to the location of the keys, not their
value under the current keyboard mapping (apparently X keycodes on X11,
PC keycodes on Windows, ADB keycodes on Mac OS). The with-keymap code
(sdl_keyevent_to_keycode_generic()) on the other hand uses
event.key.keysym.sym (one of the SDLK_xxx constants), which is affected
by the OS's keyboard mapping. (Although IMHO it shouldn't be, but when
that topic was brought up on the SDL mailing list, the answer IIRC was
that that would be too difficult to fix on all platforms supported by
SDL. I'm not convinced by that, but I didn't investigate any further at
that time.)
It's just that in sdl_keyevent_to_keycode, the X11 and win32 cases are
handled, but not the Mac OS case.
-Christian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] Fix virtual console switching with SDL on Mac OS X
2005-07-23 12:42 ` [Qemu-devel] " Christian Walther
@ 2005-07-23 18:46 ` Jim C. Brown
0 siblings, 0 replies; 4+ messages in thread
From: Jim C. Brown @ 2005-07-23 18:46 UTC (permalink / raw)
To: qemu-devel
On Sat, Jul 23, 2005 at 02:42:12PM +0200, Christian Walther wrote:
> >Looks like the bug affects X11 and W32 as well, if you are not using a
> >US keymap.
>
Oops, I meant only X11, as W32 doesnt use qemu's keymaps. Only the X11 SDL
driver, and the not-yet-committed X11 GTK driver, use it.
> I don't think so. The non-keymap code that was used before my patch
> (sdl_keyevent_to_keycode()) uses event.key.keysym.scancode, which is
> platform-dependent, but refers to the location of the keys, not their
> value under the current keyboard mapping (apparently X keycodes on X11,
> PC keycodes on Windows, ADB keycodes on Mac OS).
Well, the X keycodes returned actually do change depending on what kind of
hardware keyboard you are using.
But if eveyone was running SDL under X11 with PC keyboards, then it is possible
that no one would have noticed. I'll have to investigate how keycodes and X11
keysyms are handled further.
> The with-keymap code
> (sdl_keyevent_to_keycode_generic()) on the other hand uses
> event.key.keysym.sym (one of the SDLK_xxx constants), which is affected
> by the OS's keyboard mapping.
Which is converted back into a raw X11 keycode, based on the given keymap
file passed via "-k keymap".
So for the bug to not affect X11, the keycode in the keymap file and the
keycode returned by SDL would have to be the same, or at least map to the
same character. Curious.
--
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-07-23 19:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-22 21:24 [Qemu-devel] [PATCH] Fix virtual console switching with SDL on Mac OS X Christian Walther
2005-07-22 22:40 ` Jim C. Brown
2005-07-23 12:42 ` [Qemu-devel] " Christian Walther
2005-07-23 18:46 ` Jim C. Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).