diff options
author | Tor Lillqvist <tml@iki.fi> | 2003-05-06 21:44:55 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2003-05-06 21:44:55 +0000 |
commit | 2e58122c793a66f6241ff4bfe74e8966a043eeb3 (patch) | |
tree | df7221a8d8a6e20c41df8c4f37badd6ba0addf88 /gdk/win32/gdkevents-win32.c | |
parent | ae0bb11c8eb3bef34e00e9297b1f01c337c130b2 (diff) | |
download | gdk-pixbuf-2e58122c793a66f6241ff4bfe74e8966a043eeb3.tar.gz |
Fix for #110165 (thanks to Arnaud Charlet):
2003-05-06 Tor Lillqvist <tml@iki.fi>
Fix for #110165 (thanks to Arnaud Charlet):
* gdk/win32/gdkevents-win32.c (build_keypress_event,
build_keyrelease_event): For unshifted control char, use
lowercase ASCII keyval.
(gdk_event_translate): Similarily, when handling WM_SYSKEYDOWN and
UP (i.e. Alt-something), if it's an unshifted ASCII letter, use
lowercase keyval. Use build_key_event_state() here, too, instead
of minor code duplication.
Diffstat (limited to 'gdk/win32/gdkevents-win32.c')
-rw-r--r-- | gdk/win32/gdkevents-win32.c | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index 6474f38fa..e35476086 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -894,6 +894,8 @@ build_keypress_event (GdkEvent *event, event->key.group = 0; /* ??? */ event->key.keyval = GDK_VoidSymbol; + build_key_event_state (event); + if (msg->message == WM_IME_COMPOSITION) { himc = ImmGetContext (msg->hwnd); @@ -917,7 +919,11 @@ build_keypress_event (GdkEvent *event, /* For ASCII control chars, the keyval should be the * corresponding ASCII character. */ - event->key.keyval = msg->wParam + '@'; + if ((event->key.state & GDK_SHIFT_MASK) == 0) + event->key.keyval = msg->wParam + '`'; + else + event->key.keyval = msg->wParam + '@'; + /* This is needed in case of Alt+nnn or Alt+0nnn (on the numpad) * where nnn<32 */ @@ -951,8 +957,6 @@ build_keypress_event (GdkEvent *event, wbuf, G_N_ELEMENTS (wbuf)); } - build_key_event_state (event); - /* Build UTF-8 string */ if (ucount > 0) { @@ -985,12 +989,18 @@ build_keyrelease_event (GdkEvent *event, event->key.state = 0; event->key.group = 0; /* ??? */ + build_key_event_state (event); + if (msg->message == WM_CHAR || msg->message == WM_SYSCHAR) { event->key.hardware_keycode = vk_from_char (msg->wParam); if (msg->wParam < ' ') { - event->key.keyval = msg->wParam + '@'; + if ((event->key.state & GDK_SHIFT_MASK) == 0) + event->key.keyval = msg->wParam + '`'; + else + event->key.keyval = msg->wParam + '@'; + event->key.state |= GDK_CONTROL_MASK; } else @@ -1007,7 +1017,7 @@ build_keyrelease_event (GdkEvent *event, event->key.keyval = GDK_VoidSymbol; event->key.hardware_keycode = 0; /* ??? */ } - build_key_event_state (event); + event->key.string = NULL; event->key.length = 0; } @@ -2377,7 +2387,20 @@ gdk_event_translate (GdkDisplay *display, break; default: if (msg->message == WM_SYSKEYDOWN || msg->message == WM_SYSKEYUP) - event->key.keyval = msg->wParam; + { + if (msg->wParam >= 'A' && msg->wParam <= 'Z') + { + /* If Alt-unshifted ASCII letter, lowercase */ + if (GetKeyState (VK_SHIFT) < 0) + event->key.keyval = msg->wParam; + else + event->key.keyval = msg->wParam + 0x20; + } + else + { + event->key.keyval = msg->wParam; + } + } else ignore_wm_char = FALSE; break; @@ -2398,14 +2421,10 @@ gdk_event_translate (GdkDisplay *display, GDK_KEY_PRESS : GDK_KEY_RELEASE); event->key.time = _gdk_win32_get_next_tick (msg->time); event->key.state = 0; - if (GetKeyState (VK_SHIFT) < 0) - event->key.state |= GDK_SHIFT_MASK; - if (GetKeyState (VK_CAPITAL) & 0x1) - event->key.state |= GDK_LOCK_MASK; - if (GetKeyState (VK_CONTROL) < 0) - event->key.state |= GDK_CONTROL_MASK; - if (msg->wParam != VK_MENU && GetKeyState (VK_MENU) < 0) - event->key.state |= GDK_MOD1_MASK; + build_key_event_state (event); + /* Reset MOD1_MASK if it is the Alt key itself */ + if (msg->wParam == VK_MENU) + event->key.state &= ~GDK_MOD1_MASK; event->key.hardware_keycode = msg->wParam; event->key.group = 0; event->key.string = NULL; |