From 165375eb5c44bd3e2fc97ff2cb70404299088233 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sun, 27 Jul 2003 21:58:44 +0000 Subject: [PATCH] On Win9x, the keyboard state returned by GetKeyboardState() doesn't 2003-07-27 Tor Lillqvist * gdk/win32/gdkevents-win32.c (build_key_event_state): On Win9x, the keyboard state returned by GetKeyboardState() doesn't distinguish between the left and right Control and Alt keys. Thus we cannot detect AltGr (which is supposed to be left Control + right Alt) the same way as on NT-based systems, but have to accept either Control + either Alt as AltGr. --- ChangeLog | 19 +++++++++++++++---- ChangeLog.pre-2-10 | 19 +++++++++++++++---- ChangeLog.pre-2-4 | 19 +++++++++++++++---- ChangeLog.pre-2-6 | 19 +++++++++++++++---- ChangeLog.pre-2-8 | 19 +++++++++++++++---- gdk/win32/gdkevents-win32.c | 17 ++++++++++++++++- 6 files changed, 91 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 351c492296..774d827995 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,21 @@ +2003-07-27 Tor Lillqvist + + * gdk/win32/gdkevents-win32.c (build_key_event_state): On Win9x, + the keyboard state returned by GetKeyboardState() doesn't + distinguish between the left and right Control and Alt keys. Thus + we cannot detect AltGr (which is supposed to be left Control + + right Alt) the same way as on NT-based systems, but have to accept + either Control + either Alt as AltGr. + 2003-07-27 Matthias Clasen - * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach): Fix function name in - warning message. (#118156, Tim-Philipp Müller) + * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach): + Fix function name in warning message. (#118156, Tim-Philipp + Müller) - * gtk/gtkcellrenderer.c (gtk_cell_renderer_get_property): is-expander and is-expanded are - boolean properties, not ints. (#118359, Josh Parsons) + * gtk/gtkcellrenderer.c (gtk_cell_renderer_get_property): + is-expander and is-expanded are boolean properties, not ints. + (#118359, Josh Parsons) Sat Jul 26 15:21:27 2003 Soeren Sandmann diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 351c492296..774d827995 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,10 +1,21 @@ +2003-07-27 Tor Lillqvist + + * gdk/win32/gdkevents-win32.c (build_key_event_state): On Win9x, + the keyboard state returned by GetKeyboardState() doesn't + distinguish between the left and right Control and Alt keys. Thus + we cannot detect AltGr (which is supposed to be left Control + + right Alt) the same way as on NT-based systems, but have to accept + either Control + either Alt as AltGr. + 2003-07-27 Matthias Clasen - * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach): Fix function name in - warning message. (#118156, Tim-Philipp Müller) + * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach): + Fix function name in warning message. (#118156, Tim-Philipp + Müller) - * gtk/gtkcellrenderer.c (gtk_cell_renderer_get_property): is-expander and is-expanded are - boolean properties, not ints. (#118359, Josh Parsons) + * gtk/gtkcellrenderer.c (gtk_cell_renderer_get_property): + is-expander and is-expanded are boolean properties, not ints. + (#118359, Josh Parsons) Sat Jul 26 15:21:27 2003 Soeren Sandmann diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 351c492296..774d827995 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,10 +1,21 @@ +2003-07-27 Tor Lillqvist + + * gdk/win32/gdkevents-win32.c (build_key_event_state): On Win9x, + the keyboard state returned by GetKeyboardState() doesn't + distinguish between the left and right Control and Alt keys. Thus + we cannot detect AltGr (which is supposed to be left Control + + right Alt) the same way as on NT-based systems, but have to accept + either Control + either Alt as AltGr. + 2003-07-27 Matthias Clasen - * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach): Fix function name in - warning message. (#118156, Tim-Philipp Müller) + * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach): + Fix function name in warning message. (#118156, Tim-Philipp + Müller) - * gtk/gtkcellrenderer.c (gtk_cell_renderer_get_property): is-expander and is-expanded are - boolean properties, not ints. (#118359, Josh Parsons) + * gtk/gtkcellrenderer.c (gtk_cell_renderer_get_property): + is-expander and is-expanded are boolean properties, not ints. + (#118359, Josh Parsons) Sat Jul 26 15:21:27 2003 Soeren Sandmann diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 351c492296..774d827995 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,10 +1,21 @@ +2003-07-27 Tor Lillqvist + + * gdk/win32/gdkevents-win32.c (build_key_event_state): On Win9x, + the keyboard state returned by GetKeyboardState() doesn't + distinguish between the left and right Control and Alt keys. Thus + we cannot detect AltGr (which is supposed to be left Control + + right Alt) the same way as on NT-based systems, but have to accept + either Control + either Alt as AltGr. + 2003-07-27 Matthias Clasen - * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach): Fix function name in - warning message. (#118156, Tim-Philipp Müller) + * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach): + Fix function name in warning message. (#118156, Tim-Philipp + Müller) - * gtk/gtkcellrenderer.c (gtk_cell_renderer_get_property): is-expander and is-expanded are - boolean properties, not ints. (#118359, Josh Parsons) + * gtk/gtkcellrenderer.c (gtk_cell_renderer_get_property): + is-expander and is-expanded are boolean properties, not ints. + (#118359, Josh Parsons) Sat Jul 26 15:21:27 2003 Soeren Sandmann diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 351c492296..774d827995 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,10 +1,21 @@ +2003-07-27 Tor Lillqvist + + * gdk/win32/gdkevents-win32.c (build_key_event_state): On Win9x, + the keyboard state returned by GetKeyboardState() doesn't + distinguish between the left and right Control and Alt keys. Thus + we cannot detect AltGr (which is supposed to be left Control + + right Alt) the same way as on NT-based systems, but have to accept + either Control + either Alt as AltGr. + 2003-07-27 Matthias Clasen - * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach): Fix function name in - warning message. (#118156, Tim-Philipp Müller) + * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach): + Fix function name in warning message. (#118156, Tim-Philipp + Müller) - * gtk/gtkcellrenderer.c (gtk_cell_renderer_get_property): is-expander and is-expanded are - boolean properties, not ints. (#118359, Josh Parsons) + * gtk/gtkcellrenderer.c (gtk_cell_renderer_get_property): + is-expander and is-expanded are boolean properties, not ints. + (#118359, Josh Parsons) Sat Jul 26 15:21:27 2003 Soeren Sandmann diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index ebc274eaa0..0e4fb543ea 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -754,6 +754,21 @@ build_key_event_state (GdkEvent *event, if (key_state[VK_CAPITAL] & 0x01) event->key.state |= GDK_LOCK_MASK; + /* Win9x doesn't distinguish between left and right Control and Alt + * in the keyboard state as returned by GetKeyboardState(), so we + * have to punt, and accept either Control + either Alt to be AltGr. + * + * Alternatively, we could have some state saved when the Control + * and Alt keys messages come in, as the KF_EXTENDED bit in lParam + * does indicate correctly whether it is the right Control or Alt + * key. But that would be a bit messy. + */ + if (!IS_WIN_NT () && + _gdk_keyboard_has_altgr && + key_state[VK_CONTROL] & 0x80 && + key_state[VK_MENU] & 0x80) + key_state[VK_LCONTROL] = key_state[VK_RMENU] = 0x80; + if (_gdk_keyboard_has_altgr && (key_state[VK_LCONTROL] & 0x80) && (key_state[VK_RMENU] & 0x80)) @@ -2071,7 +2086,7 @@ gdk_event_translate (GdkDisplay *display, API_CALL (GetKeyboardState, (key_state)); - /* g_print ("ctrl:%#x lctrl:%#x rctrl:%#x alt:%#x lalt:%#x ralt:%#x\n", key_state[VK_CONTROL], key_state[VK_LCONTROL], key_state[VK_RCONTROL], key_state[VK_MENU], key_state[VK_LMENU], key_state[VK_RMENU]); */ + /* g_print ("ctrl:%02x lctrl:%02x rctrl:%02x alt:%02x lalt:%02x ralt:%02x\n", key_state[VK_CONTROL], key_state[VK_LCONTROL], key_state[VK_RCONTROL], key_state[VK_MENU], key_state[VK_LMENU], key_state[VK_RMENU]); */ build_key_event_state (event, key_state);