From d0ebbe9d77740eb0d10fd12142d84dead559321d Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 6 Mar 2002 00:36:08 +0000 Subject: [PATCH] Bypass calls to the grab/ungrab functions in gdkinput-win32.c, as they 2002-03-06 Tor Lillqvist * gdk/win32/gdkevents-win32.c (gdk_pointer_grab, gdk_pointer_ungrab): Bypass calls to the grab/ungrab functions in gdkinput-win32.c, as they don't effectively do anything anyway. (build_key_event_state): Set MOD2 bit if key is in AltGr group. (gdk_event_translate): Call _gdk_windowing_window_get_offsets() each time the offsets are used, on the window they refer to, instead of once in the beginning. The window in question might change due to event propagation. (gdk_event_translate): Set key event group to 0 for non-AltGr keys. Do set the SHIFT bit in the key event state also for ISO_Left_Tab. Now backtabbing finally works again. * gdk/win32/gdkunput-win32.c: Minor debugging output change. * gdk/win32/gdkkeys-win32.c (update_keymap): Set VK_TAB mapping to Gdk_Tab and GDK_ISO_Left_Tab, like on X11. (gdk_keymap_translate_keyboard_state): Add similar code as in the non-XKB case on X11 to generate a more correct consumed_modifiers. Add debugging output. (gdk_keyval_name): Use the U+xxxx format for UCS characters encoded as keyvals. Never return NULL, but hex number representation if keyval not in table. * gdk/win32/gdkwindow-win32.c (gdk_window_focus): Call SetFocus(). Doesn't seem to have any harmful effect, and probably is close to what this function is supposed to do. But it didn't fix GtkCombo as I had hoped. (gdk_window_set_type_hint): Don't intern the _NET_WM_* atoms that weren't used and wouldn't have any meaning on Win32 anyway. --- ChangeLog | 34 +++++++++++- ChangeLog.pre-2-0 | 34 +++++++++++- ChangeLog.pre-2-10 | 34 +++++++++++- ChangeLog.pre-2-2 | 34 +++++++++++- ChangeLog.pre-2-4 | 34 +++++++++++- ChangeLog.pre-2-6 | 34 +++++++++++- ChangeLog.pre-2-8 | 34 +++++++++++- gdk/win32/gdkevents-win32.c | 69 ++++++++++++++---------- gdk/win32/gdkinput-win32.c | 6 +-- gdk/win32/gdkkeys-win32.c | 101 +++++++++++++++++++++++++++++------- gdk/win32/gdkwindow-win32.c | 17 +++--- 11 files changed, 362 insertions(+), 69 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1cac638a6..67e15dd17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +2002-03-06 Tor Lillqvist + + * gdk/win32/gdkevents-win32.c (gdk_pointer_grab, + gdk_pointer_ungrab): Bypass calls to the grab/ungrab functions in + gdkinput-win32.c, as they don't effectively do anything anyway. + (build_key_event_state): Set MOD2 bit if key is in AltGr group. + (gdk_event_translate): Call _gdk_windowing_window_get_offsets() + each time the offsets are used, on the window they refer to, + instead of once in the beginning. The window in question might + change due to event propagation. + (gdk_event_translate): Set key event group to 0 for non-AltGr + keys. Do set the SHIFT bit in the key event state also for + ISO_Left_Tab. Now backtabbing finally works again. + + * gdk/win32/gdkunput-win32.c: Minor debugging output change. + + * gdk/win32/gdkkeys-win32.c (update_keymap): Set VK_TAB mapping to + Gdk_Tab and GDK_ISO_Left_Tab, like on X11. + (gdk_keymap_translate_keyboard_state): Add similar code as in the + non-XKB case on X11 to generate a more correct + consumed_modifiers. Add debugging output. + (gdk_keyval_name): Use the U+xxxx format for UCS characters + encoded as keyvals. Never return NULL, but hex number + representation if keyval not in table. + + * gdk/win32/gdkwindow-win32.c (gdk_window_focus): Call + SetFocus(). Doesn't seem to have any harmful effect, and probably + is close to what this function is supposed to do. But it didn't + fix GtkCombo as I had hoped. + (gdk_window_set_type_hint): Don't intern the _NET_WM_* atoms that + weren't used and wouldn't have any meaning on Win32 anyway. + Tue Mar 5 19:19:19 2002 Owen Taylor * gtk/gtkwindow.c (gtk_window_set_focus): When setting @@ -107,7 +139,7 @@ Mon Mar 4 12:43:48 2002 Owen Taylor * gdk/x11/gdkkeys-x11.c (gdk_keymap_translate_keyboard_state): When calling XKeycodeToKeysym, use group * keysyms_per_keycode / 2 - not group * keysyms_per_keycode. (Tor Lillquist) + not group * keysyms_per_keycode. (Tor Lillqvist) * gdk/x11/gdkkeys-x11.c (gdk_keymap_translate_keyboard_state): Remove the hack to fudge the return value for GDK_Tab + Shift diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 1cac638a6..67e15dd17 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,35 @@ +2002-03-06 Tor Lillqvist + + * gdk/win32/gdkevents-win32.c (gdk_pointer_grab, + gdk_pointer_ungrab): Bypass calls to the grab/ungrab functions in + gdkinput-win32.c, as they don't effectively do anything anyway. + (build_key_event_state): Set MOD2 bit if key is in AltGr group. + (gdk_event_translate): Call _gdk_windowing_window_get_offsets() + each time the offsets are used, on the window they refer to, + instead of once in the beginning. The window in question might + change due to event propagation. + (gdk_event_translate): Set key event group to 0 for non-AltGr + keys. Do set the SHIFT bit in the key event state also for + ISO_Left_Tab. Now backtabbing finally works again. + + * gdk/win32/gdkunput-win32.c: Minor debugging output change. + + * gdk/win32/gdkkeys-win32.c (update_keymap): Set VK_TAB mapping to + Gdk_Tab and GDK_ISO_Left_Tab, like on X11. + (gdk_keymap_translate_keyboard_state): Add similar code as in the + non-XKB case on X11 to generate a more correct + consumed_modifiers. Add debugging output. + (gdk_keyval_name): Use the U+xxxx format for UCS characters + encoded as keyvals. Never return NULL, but hex number + representation if keyval not in table. + + * gdk/win32/gdkwindow-win32.c (gdk_window_focus): Call + SetFocus(). Doesn't seem to have any harmful effect, and probably + is close to what this function is supposed to do. But it didn't + fix GtkCombo as I had hoped. + (gdk_window_set_type_hint): Don't intern the _NET_WM_* atoms that + weren't used and wouldn't have any meaning on Win32 anyway. + Tue Mar 5 19:19:19 2002 Owen Taylor * gtk/gtkwindow.c (gtk_window_set_focus): When setting @@ -107,7 +139,7 @@ Mon Mar 4 12:43:48 2002 Owen Taylor * gdk/x11/gdkkeys-x11.c (gdk_keymap_translate_keyboard_state): When calling XKeycodeToKeysym, use group * keysyms_per_keycode / 2 - not group * keysyms_per_keycode. (Tor Lillquist) + not group * keysyms_per_keycode. (Tor Lillqvist) * gdk/x11/gdkkeys-x11.c (gdk_keymap_translate_keyboard_state): Remove the hack to fudge the return value for GDK_Tab + Shift diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 1cac638a6..67e15dd17 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,35 @@ +2002-03-06 Tor Lillqvist + + * gdk/win32/gdkevents-win32.c (gdk_pointer_grab, + gdk_pointer_ungrab): Bypass calls to the grab/ungrab functions in + gdkinput-win32.c, as they don't effectively do anything anyway. + (build_key_event_state): Set MOD2 bit if key is in AltGr group. + (gdk_event_translate): Call _gdk_windowing_window_get_offsets() + each time the offsets are used, on the window they refer to, + instead of once in the beginning. The window in question might + change due to event propagation. + (gdk_event_translate): Set key event group to 0 for non-AltGr + keys. Do set the SHIFT bit in the key event state also for + ISO_Left_Tab. Now backtabbing finally works again. + + * gdk/win32/gdkunput-win32.c: Minor debugging output change. + + * gdk/win32/gdkkeys-win32.c (update_keymap): Set VK_TAB mapping to + Gdk_Tab and GDK_ISO_Left_Tab, like on X11. + (gdk_keymap_translate_keyboard_state): Add similar code as in the + non-XKB case on X11 to generate a more correct + consumed_modifiers. Add debugging output. + (gdk_keyval_name): Use the U+xxxx format for UCS characters + encoded as keyvals. Never return NULL, but hex number + representation if keyval not in table. + + * gdk/win32/gdkwindow-win32.c (gdk_window_focus): Call + SetFocus(). Doesn't seem to have any harmful effect, and probably + is close to what this function is supposed to do. But it didn't + fix GtkCombo as I had hoped. + (gdk_window_set_type_hint): Don't intern the _NET_WM_* atoms that + weren't used and wouldn't have any meaning on Win32 anyway. + Tue Mar 5 19:19:19 2002 Owen Taylor * gtk/gtkwindow.c (gtk_window_set_focus): When setting @@ -107,7 +139,7 @@ Mon Mar 4 12:43:48 2002 Owen Taylor * gdk/x11/gdkkeys-x11.c (gdk_keymap_translate_keyboard_state): When calling XKeycodeToKeysym, use group * keysyms_per_keycode / 2 - not group * keysyms_per_keycode. (Tor Lillquist) + not group * keysyms_per_keycode. (Tor Lillqvist) * gdk/x11/gdkkeys-x11.c (gdk_keymap_translate_keyboard_state): Remove the hack to fudge the return value for GDK_Tab + Shift diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 1cac638a6..67e15dd17 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,35 @@ +2002-03-06 Tor Lillqvist + + * gdk/win32/gdkevents-win32.c (gdk_pointer_grab, + gdk_pointer_ungrab): Bypass calls to the grab/ungrab functions in + gdkinput-win32.c, as they don't effectively do anything anyway. + (build_key_event_state): Set MOD2 bit if key is in AltGr group. + (gdk_event_translate): Call _gdk_windowing_window_get_offsets() + each time the offsets are used, on the window they refer to, + instead of once in the beginning. The window in question might + change due to event propagation. + (gdk_event_translate): Set key event group to 0 for non-AltGr + keys. Do set the SHIFT bit in the key event state also for + ISO_Left_Tab. Now backtabbing finally works again. + + * gdk/win32/gdkunput-win32.c: Minor debugging output change. + + * gdk/win32/gdkkeys-win32.c (update_keymap): Set VK_TAB mapping to + Gdk_Tab and GDK_ISO_Left_Tab, like on X11. + (gdk_keymap_translate_keyboard_state): Add similar code as in the + non-XKB case on X11 to generate a more correct + consumed_modifiers. Add debugging output. + (gdk_keyval_name): Use the U+xxxx format for UCS characters + encoded as keyvals. Never return NULL, but hex number + representation if keyval not in table. + + * gdk/win32/gdkwindow-win32.c (gdk_window_focus): Call + SetFocus(). Doesn't seem to have any harmful effect, and probably + is close to what this function is supposed to do. But it didn't + fix GtkCombo as I had hoped. + (gdk_window_set_type_hint): Don't intern the _NET_WM_* atoms that + weren't used and wouldn't have any meaning on Win32 anyway. + Tue Mar 5 19:19:19 2002 Owen Taylor * gtk/gtkwindow.c (gtk_window_set_focus): When setting @@ -107,7 +139,7 @@ Mon Mar 4 12:43:48 2002 Owen Taylor * gdk/x11/gdkkeys-x11.c (gdk_keymap_translate_keyboard_state): When calling XKeycodeToKeysym, use group * keysyms_per_keycode / 2 - not group * keysyms_per_keycode. (Tor Lillquist) + not group * keysyms_per_keycode. (Tor Lillqvist) * gdk/x11/gdkkeys-x11.c (gdk_keymap_translate_keyboard_state): Remove the hack to fudge the return value for GDK_Tab + Shift diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 1cac638a6..67e15dd17 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,35 @@ +2002-03-06 Tor Lillqvist + + * gdk/win32/gdkevents-win32.c (gdk_pointer_grab, + gdk_pointer_ungrab): Bypass calls to the grab/ungrab functions in + gdkinput-win32.c, as they don't effectively do anything anyway. + (build_key_event_state): Set MOD2 bit if key is in AltGr group. + (gdk_event_translate): Call _gdk_windowing_window_get_offsets() + each time the offsets are used, on the window they refer to, + instead of once in the beginning. The window in question might + change due to event propagation. + (gdk_event_translate): Set key event group to 0 for non-AltGr + keys. Do set the SHIFT bit in the key event state also for + ISO_Left_Tab. Now backtabbing finally works again. + + * gdk/win32/gdkunput-win32.c: Minor debugging output change. + + * gdk/win32/gdkkeys-win32.c (update_keymap): Set VK_TAB mapping to + Gdk_Tab and GDK_ISO_Left_Tab, like on X11. + (gdk_keymap_translate_keyboard_state): Add similar code as in the + non-XKB case on X11 to generate a more correct + consumed_modifiers. Add debugging output. + (gdk_keyval_name): Use the U+xxxx format for UCS characters + encoded as keyvals. Never return NULL, but hex number + representation if keyval not in table. + + * gdk/win32/gdkwindow-win32.c (gdk_window_focus): Call + SetFocus(). Doesn't seem to have any harmful effect, and probably + is close to what this function is supposed to do. But it didn't + fix GtkCombo as I had hoped. + (gdk_window_set_type_hint): Don't intern the _NET_WM_* atoms that + weren't used and wouldn't have any meaning on Win32 anyway. + Tue Mar 5 19:19:19 2002 Owen Taylor * gtk/gtkwindow.c (gtk_window_set_focus): When setting @@ -107,7 +139,7 @@ Mon Mar 4 12:43:48 2002 Owen Taylor * gdk/x11/gdkkeys-x11.c (gdk_keymap_translate_keyboard_state): When calling XKeycodeToKeysym, use group * keysyms_per_keycode / 2 - not group * keysyms_per_keycode. (Tor Lillquist) + not group * keysyms_per_keycode. (Tor Lillqvist) * gdk/x11/gdkkeys-x11.c (gdk_keymap_translate_keyboard_state): Remove the hack to fudge the return value for GDK_Tab + Shift diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 1cac638a6..67e15dd17 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,35 @@ +2002-03-06 Tor Lillqvist + + * gdk/win32/gdkevents-win32.c (gdk_pointer_grab, + gdk_pointer_ungrab): Bypass calls to the grab/ungrab functions in + gdkinput-win32.c, as they don't effectively do anything anyway. + (build_key_event_state): Set MOD2 bit if key is in AltGr group. + (gdk_event_translate): Call _gdk_windowing_window_get_offsets() + each time the offsets are used, on the window they refer to, + instead of once in the beginning. The window in question might + change due to event propagation. + (gdk_event_translate): Set key event group to 0 for non-AltGr + keys. Do set the SHIFT bit in the key event state also for + ISO_Left_Tab. Now backtabbing finally works again. + + * gdk/win32/gdkunput-win32.c: Minor debugging output change. + + * gdk/win32/gdkkeys-win32.c (update_keymap): Set VK_TAB mapping to + Gdk_Tab and GDK_ISO_Left_Tab, like on X11. + (gdk_keymap_translate_keyboard_state): Add similar code as in the + non-XKB case on X11 to generate a more correct + consumed_modifiers. Add debugging output. + (gdk_keyval_name): Use the U+xxxx format for UCS characters + encoded as keyvals. Never return NULL, but hex number + representation if keyval not in table. + + * gdk/win32/gdkwindow-win32.c (gdk_window_focus): Call + SetFocus(). Doesn't seem to have any harmful effect, and probably + is close to what this function is supposed to do. But it didn't + fix GtkCombo as I had hoped. + (gdk_window_set_type_hint): Don't intern the _NET_WM_* atoms that + weren't used and wouldn't have any meaning on Win32 anyway. + Tue Mar 5 19:19:19 2002 Owen Taylor * gtk/gtkwindow.c (gtk_window_set_focus): When setting @@ -107,7 +139,7 @@ Mon Mar 4 12:43:48 2002 Owen Taylor * gdk/x11/gdkkeys-x11.c (gdk_keymap_translate_keyboard_state): When calling XKeycodeToKeysym, use group * keysyms_per_keycode / 2 - not group * keysyms_per_keycode. (Tor Lillquist) + not group * keysyms_per_keycode. (Tor Lillqvist) * gdk/x11/gdkkeys-x11.c (gdk_keymap_translate_keyboard_state): Remove the hack to fudge the return value for GDK_Tab + Shift diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 1cac638a6..67e15dd17 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,35 @@ +2002-03-06 Tor Lillqvist + + * gdk/win32/gdkevents-win32.c (gdk_pointer_grab, + gdk_pointer_ungrab): Bypass calls to the grab/ungrab functions in + gdkinput-win32.c, as they don't effectively do anything anyway. + (build_key_event_state): Set MOD2 bit if key is in AltGr group. + (gdk_event_translate): Call _gdk_windowing_window_get_offsets() + each time the offsets are used, on the window they refer to, + instead of once in the beginning. The window in question might + change due to event propagation. + (gdk_event_translate): Set key event group to 0 for non-AltGr + keys. Do set the SHIFT bit in the key event state also for + ISO_Left_Tab. Now backtabbing finally works again. + + * gdk/win32/gdkunput-win32.c: Minor debugging output change. + + * gdk/win32/gdkkeys-win32.c (update_keymap): Set VK_TAB mapping to + Gdk_Tab and GDK_ISO_Left_Tab, like on X11. + (gdk_keymap_translate_keyboard_state): Add similar code as in the + non-XKB case on X11 to generate a more correct + consumed_modifiers. Add debugging output. + (gdk_keyval_name): Use the U+xxxx format for UCS characters + encoded as keyvals. Never return NULL, but hex number + representation if keyval not in table. + + * gdk/win32/gdkwindow-win32.c (gdk_window_focus): Call + SetFocus(). Doesn't seem to have any harmful effect, and probably + is close to what this function is supposed to do. But it didn't + fix GtkCombo as I had hoped. + (gdk_window_set_type_hint): Don't intern the _NET_WM_* atoms that + weren't used and wouldn't have any meaning on Win32 anyway. + Tue Mar 5 19:19:19 2002 Owen Taylor * gtk/gtkwindow.c (gtk_window_set_focus): When setting @@ -107,7 +139,7 @@ Mon Mar 4 12:43:48 2002 Owen Taylor * gdk/x11/gdkkeys-x11.c (gdk_keymap_translate_keyboard_state): When calling XKeycodeToKeysym, use group * keysyms_per_keycode / 2 - not group * keysyms_per_keycode. (Tor Lillquist) + not group * keysyms_per_keycode. (Tor Lillqvist) * gdk/x11/gdkkeys-x11.c (gdk_keymap_translate_keyboard_state): Remove the hack to fudge the return value for GDK_Tab + Shift diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index fc6d9c7fd..1189f9524 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -505,7 +505,7 @@ gdk_pointer_grab (GdkWindow *window, HWND hwnd_confined_to; HCURSOR hcursor; GdkCursorPrivate *cursor_private; - gint return_val; + gint return_val = GDK_GRAB_SUCCESS; g_return_val_if_fail (window != NULL, 0); g_return_val_if_fail (GDK_IS_WINDOW (window), 0); @@ -522,13 +522,13 @@ gdk_pointer_grab (GdkWindow *window, hcursor = NULL; else hcursor = cursor_private->hcursor; - +#if 0 return_val = _gdk_input_grab_pointer (window, owner_events, event_mask, confine_to, time); - +#endif if (return_val == GDK_GRAB_SUCCESS) { if (!GDK_WINDOW_DESTROYED (window)) @@ -579,9 +579,10 @@ void gdk_pointer_ungrab (guint32 time) { GDK_NOTE (EVENTS, g_print ("gdk_pointer_ungrab\n")); - +#if 0 _gdk_input_ungrab_pointer (time); - +#endif + #if USE_SETCAPTURE if (GetCapture () != NULL) ReleaseCapture (); @@ -638,8 +639,8 @@ find_window_for_pointer_event (GdkWindow* reported_window, if (other_window == NULL) return reported_window; - GDK_NOTE (EVENTS, g_print ("Found window %#x for point (%ld, %ld)\n", - (guint) hwnd, pt.x, pt.y)); + GDK_NOTE (EVENTS, g_print ("Found window %p for point (%ld, %ld)\n", + hwnd, pt.x, pt.y)); gdk_window_unref (reported_window); gdk_window_ref (other_window); @@ -665,6 +666,8 @@ find_window_for_pointer_event (GdkWindow* reported_window, gboolean gdk_pointer_is_grabbed (void) { + GDK_NOTE (EVENTS, g_print ("gdk_pointer_is_grabbed: %s\n", + p_grab_window != NULL ? "TRUE" : "FALSE")); return p_grab_window != NULL; } @@ -850,7 +853,10 @@ build_key_event_state (GdkEvent *event) event->key.state |= GDK_MOD1_MASK; } else - event->key.group = 1; + { + event->key.state |= GDK_MOD2_MASK; + event->key.group = 1; + } } static gint @@ -1032,9 +1038,15 @@ print_event_state (gint state) CASE (LOCK); CASE (CONTROL); CASE (MOD1); + CASE (MOD2); + CASE (MOD3); + CASE (MOD4); + CASE (MOD5); CASE (BUTTON1); CASE (BUTTON2); CASE (BUTTON3); + CASE (BUTTON4); + CASE (BUTTON5); #undef CASE } @@ -1649,7 +1661,7 @@ decode_key_lparam (LPARAM lParam) p += sprintf (p, "KF_ALTDOWN "); if (HIWORD (lParam) & KF_EXTENDED) p += sprintf (p, "KF_EXTENDED "); - p += sprintf (p, "sc%d rep%d", LOBYTE (HIWORD (lParam)), LOWORD (lParam)); + p += sprintf (p, "sc:%d rep:%d", LOBYTE (HIWORD (lParam)), LOWORD (lParam)); return buf; } @@ -1974,9 +1986,6 @@ gdk_event_translate (GdkEvent *event, } } - /* to translate coordinates to the internal > 16 bit system */ - _gdk_windowing_window_get_offsets (window, &xoffset, &yoffset); - if (msg->message == msh_mousewheel_msg) { GDK_NOTE (EVENTS, g_print ("MSH_MOUSEWHEEL: %p %d\n", @@ -2024,6 +2033,7 @@ gdk_event_translate (GdkEvent *event, GDK_SCROLL_UP : GDK_SCROLL_DOWN; event->scroll.window = window; event->scroll.time = msg->time; + _gdk_windowing_window_get_offsets (window, &xoffset, &yoffset); event->scroll.x = (gint16) pt.x + xoffset; event->scroll.y = (gint16) pt.y + yoffset; event->scroll.x_root = (gint16) LOWORD (msg->lParam); @@ -2101,7 +2111,7 @@ gdk_event_translate (GdkEvent *event, case WM_SYSKEYUP: case WM_SYSKEYDOWN: GDK_NOTE (EVENTS, - g_print ("WM_SYSKEY%s: %p %s vk%.02x %s\n", + g_print ("WM_SYSKEY%s: %p %s vk:%.02x %s\n", (msg->message == WM_SYSKEYUP ? "UP" : "DOWN"), msg->hwnd, (GetKeyNameText (msg->lParam, buf, @@ -2118,10 +2128,6 @@ gdk_event_translate (GdkEvent *event, || msg->wParam == VK_RETURN || msg->wParam == VK_F4) break; - /* Ignore auto-repeated Shift or Alt keypresses (good idea???) */ - if ((msg->wParam == VK_SHIFT || msg->wParam == VK_MENU) && - (HIWORD (msg->lParam) & KF_REPEAT)) - break; /* Jump to code in common with WM_KEYUP and WM_KEYDOWN */ goto keyup_or_down; @@ -2129,7 +2135,7 @@ gdk_event_translate (GdkEvent *event, case WM_KEYUP: case WM_KEYDOWN: GDK_NOTE (EVENTS, - g_print ("WM_KEY%s: %p %s vk%.02x %s\n", + g_print ("WM_KEY%s: %p %s vk:%.02x %s\n", (msg->message == WM_KEYUP ? "UP" : "DOWN"), msg->hwnd, (GetKeyNameText (msg->lParam, buf, @@ -2396,7 +2402,7 @@ gdk_event_translate (GdkEvent *event, GDK_KEY_PRESS : GDK_KEY_RELEASE); event->key.time = msg->time; event->key.state = 0; - if (event->key.keyval != GDK_ISO_Left_Tab && GetKeyState (VK_SHIFT) < 0) + if (GetKeyState (VK_SHIFT) < 0) event->key.state |= GDK_SHIFT_MASK; if (GetKeyState (VK_CAPITAL) & 0x1) event->key.state |= GDK_LOCK_MASK; @@ -2405,7 +2411,7 @@ gdk_event_translate (GdkEvent *event, if (msg->wParam != VK_MENU && GetKeyState (VK_MENU) < 0) event->key.state |= GDK_MOD1_MASK; event->key.hardware_keycode = msg->wParam; - event->key.group = (event->key.state & GDK_MOD1_MASK) != 0; + event->key.group = 0; event->key.string = NULL; event->key.length = 0; return_val = !GDK_WINDOW_DESTROYED (window); @@ -2544,10 +2550,11 @@ gdk_event_translate (GdkEvent *event, translate_mouse_coords (orig_window, window, msg); event->button.x = current_x = (gint16) LOWORD (msg->lParam); event->button.y = current_y = (gint16) HIWORD (msg->lParam); + _gdk_windowing_window_get_offsets (window, &xoffset, &yoffset); event->button.x += xoffset; /* XXX translate current_x, y too? */ event->button.y += yoffset; - event->button.x_root = msg->pt.x; - event->button.y_root = msg->pt.y; + event->button.x_root = current_x_root = msg->pt.x; + event->button.y_root = current_y_root = msg->pt.y; event->button.axes = NULL; event->button.state = build_pointer_event_state (msg); event->button.button = button; @@ -2600,10 +2607,11 @@ gdk_event_translate (GdkEvent *event, event->button.time = msg->time; if (window != orig_window) translate_mouse_coords (orig_window, window, msg); + _gdk_windowing_window_get_offsets (window, &xoffset, &yoffset); event->button.x = (gint16) LOWORD (msg->lParam) + xoffset; event->button.y = (gint16) HIWORD (msg->lParam) + yoffset; - event->button.x_root = msg->pt.x; - event->button.y_root = msg->pt.y; + event->button.x_root = current_x_root = msg->pt.x; + event->button.y_root = current_y_root = msg->pt.y; event->button.axes = NULL; event->button.state = build_pointer_event_state (msg); event->button.button = button; @@ -2664,6 +2672,7 @@ gdk_event_translate (GdkEvent *event, translate_mouse_coords (orig_window, window, msg); event->motion.x = current_x = (gint16) LOWORD (msg->lParam); event->motion.y = current_y = (gint16) HIWORD (msg->lParam); + _gdk_windowing_window_get_offsets (window, &xoffset, &yoffset); event->motion.x += xoffset; event->motion.y += yoffset; event->motion.x_root = current_x_root = msg->pt.x; @@ -2691,7 +2700,8 @@ gdk_event_translate (GdkEvent *event, event->crossing.window = current_window; event->crossing.subwindow = NULL; event->crossing.time = msg->time; - event->crossing.x = current_x + xoffset; /* XXX translated current_x */ + _gdk_windowing_window_get_offsets (current_window, &xoffset, &yoffset); + event->crossing.x = current_x + xoffset; event->crossing.y = current_y + yoffset; event->crossing.x_root = current_x_root; event->crossing.y_root = current_y_root; @@ -2758,6 +2768,7 @@ gdk_event_translate (GdkEvent *event, GDK_SCROLL_UP : GDK_SCROLL_DOWN; event->scroll.window = window; event->scroll.time = msg->time; + _gdk_windowing_window_get_offsets (window, &xoffset, &yoffset); event->scroll.x = (gint16) pt.x + xoffset; event->scroll.y = (gint16) pt.y + yoffset; event->scroll.x_root = (gint16) LOWORD (msg->lParam); @@ -2779,10 +2790,11 @@ gdk_event_translate (GdkEvent *event, event->crossing.window = window; event->crossing.subwindow = NULL; event->crossing.time = msg->time; - event->crossing.x = current_x + xoffset; /* XXX translated current_x */ + _gdk_windowing_window_get_offsets (window, &xoffset, &yoffset); + event->crossing.x = current_x + xoffset; event->crossing.y = current_y + yoffset; - event->crossing.x_root = current_xroot; - event->crossing.y_root = current_yroot; + event->crossing.x_root = current_x_root; + event->crossing.y_root = current_y_root; event->crossing.mode = GDK_CROSSING_NORMAL; if (current_window && IsChild (GDK_WINDOW_HWND (current_window), GDK_WINDOW_HWND (window))) @@ -2951,6 +2963,7 @@ gdk_event_translate (GdkEvent *event, { GdkRectangle expose_rect; + _gdk_windowing_window_get_offsets (window, &xoffset, &yoffset); expose_rect.x = paintstruct.rcPaint.left + xoffset; expose_rect.y = paintstruct.rcPaint.top + yoffset; expose_rect.width = paintstruct.rcPaint.right - paintstruct.rcPaint.left; diff --git a/gdk/win32/gdkinput-win32.c b/gdk/win32/gdkinput-win32.c index 736518ee2..d98dd46d2 100644 --- a/gdk/win32/gdkinput-win32.c +++ b/gdk/win32/gdkinput-win32.c @@ -1000,10 +1000,10 @@ _gdk_input_grab_pointer (GdkWindow *window, new_window = NULL; need_ungrab = FALSE; - GDK_NOTE (INPUT, g_print ("gdk_input_win32_grab_pointer: %#x %d %#x\n", - (guint) GDK_WINDOW_HWND (window), + GDK_NOTE (INPUT, g_print ("gdk_input_win32_grab_pointer: %p %d %p\n", + GDK_WINDOW_HWND (window), owner_events, - (confine_to ? (guint) GDK_WINDOW_HWND (confine_to) : 0))); + (confine_to ? GDK_WINDOW_HWND (confine_to) : 0))); while (tmp_list) { diff --git a/gdk/win32/gdkkeys-win32.c b/gdk/win32/gdkkeys-win32.c index eaf324120..394348d3a 100644 --- a/gdk/win32/gdkkeys-win32.c +++ b/gdk/win32/gdkkeys-win32.c @@ -113,7 +113,11 @@ update_keymap (void) case VK_BACK: *ksymp = GDK_BackSpace; break; case VK_TAB: - *ksymp = GDK_Tab; break; + if (i & 1) + *ksymp = GDK_ISO_Left_Tab; + else + *ksymp = GDK_Tab; + break; case VK_CLEAR: *ksymp = GDK_Clear; break; case VK_RETURN: @@ -261,15 +265,17 @@ update_keymap (void) #ifdef G_ENABLE_DEBUG if (_gdk_debug_flags & GDK_DEBUG_EVENTS) { - gint i, j; + gint vk; g_print ("keymap:\n"); - for (i = 0; i < 256; i++) + for (vk = 0; vk < 256; vk++) { - g_print ("%#.02x: ", i); - for (j = 0; j < 4; j++) + gint state; + + g_print ("%#.02x: ", vk); + for (state = 0; state < 4; state++) { - gchar *name = gdk_keyval_name (keysym_tab[i*4 + j]); + gchar *name = gdk_keyval_name (keysym_tab[vk*4 + state]); if (name == NULL) name = "(none)"; g_print ("%s ", name); @@ -597,11 +603,18 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap, GdkModifierType *consumed_modifiers) { guint tmp_keyval; + guint tmp_modifiers; + guint *keyvals; gint shift_level; + gboolean ignore_shift = FALSE; + gboolean ignore_group = FALSE; g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), FALSE); g_return_val_if_fail (group < 4, FALSE); + GDK_NOTE (EVENTS, g_print ("gdk_keymap_translate_keyboard_state: keycode=%#x state=%#x group=%d\n", + hardware_keycode, state, group)); + if (keyval) *keyval = 0; if (effective_group) @@ -630,7 +643,51 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap, update_keymap (); - tmp_keyval = keysym_tab[hardware_keycode*4 + group*2 + shift_level]; + keyvals = keysym_tab + hardware_keycode*4; + + /* Drop group and shift if there are no keysymbols on + * the key for those. + */ + if (shift_level == 1 && + keyvals[group*2 + 1] == GDK_VoidSymbol && + keyvals[group*2] != GDK_VoidSymbol) + { + shift_level = 0; + ignore_shift = TRUE; + } + + if (group == 1 && + keyvals[2 + shift_level] == GDK_VoidSymbol && + keyvals[0 + shift_level] != GDK_VoidSymbol) + { + group = 0; + ignore_group = TRUE; + } + + if (keyvals[group *2 + shift_level] == GDK_VoidSymbol && + keyvals[0 + 0] != GDK_VoidSymbol) + { + shift_level = 0; + group = 0; + ignore_group = TRUE; + ignore_shift = TRUE; + } + + /* See whether the group and shift level actually mattered + * to know what to put in consumed_modifiers + */ + if (keyvals[group*2 + 1] == GDK_VoidSymbol || + keyvals[group*2 + 0] == keyvals[group*2 + 1]) + ignore_shift = TRUE; + + if (keyvals[2 + shift_level] == GDK_VoidSymbol || + keyvals[0 + shift_level] == keyvals[2 + shift_level]) + ignore_group = TRUE; + + tmp_keyval = keyvals[group*2 + shift_level]; + + tmp_modifiers = ignore_group ? 0 : GDK_MOD2_MASK; + tmp_modifiers |= ignore_shift ? 0 : (GDK_SHIFT_MASK | GDK_LOCK_MASK); if (effective_group) *effective_group = group; @@ -638,22 +695,15 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap, if (level) *level = shift_level; - /* GDK_ISO_Left_Tab, as usually configured through XKB, really messes - * up the whole idea of "consumed modifiers" because shift is consumed. - * However, Tab is not _consistently_ GDK_ISO_Left_Tab, so people - * can't bind to GDK_ISO_Left_Tab instead. So, we force consistency here. - */ - if (tmp_keyval == GDK_Tab && shift_level == 1) - { - tmp_keyval = GDK_ISO_Left_Tab; - } - if (consumed_modifiers) - *consumed_modifiers = GDK_SHIFT_MASK | GDK_LOCK_MASK; + *consumed_modifiers = tmp_modifiers; if (keyval) *keyval = tmp_keyval; + GDK_NOTE (EVENTS, g_print ("...group=%d level=%d cmods=%#x keyval=%s\n", + group, shift_level, tmp_modifiers, gdk_keyval_name (tmp_keyval))); + return tmp_keyval != GDK_VoidSymbol; } @@ -1979,10 +2029,18 @@ gdk_keys_keyval_compare (const void *pkey, const void *pbase) } gchar* -gdk_keyval_name (guint keyval) +gdk_keyval_name (guint keyval) { + static gchar buf[100]; struct gdk_key *found; + /* Check for directly encoded 24-bit UCS characters: */ + if ((keyval & 0xff000000) == 0x01000000) + { + sprintf (buf, "U+%.04X", (keyval & 0x00ffffff)); + return buf; + } + found = bsearch (&keyval, gdk_keys_by_keyval, GDK_NUM_KEYS, sizeof (struct gdk_key), gdk_keys_keyval_compare); @@ -1996,7 +2054,10 @@ gdk_keyval_name (guint keyval) return (gchar *) found->name; } else - return NULL; + { + sprintf (buf, "%#x", keyval); + return buf; + } } static int diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index a4457d9a9..da6b50d83 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -2302,8 +2302,7 @@ gdk_window_set_static_win_gravity (GdkWindow *window, gboolean on) { g_return_if_fail (window != NULL); - GDK_NOTE (MISC, - g_print ("gdk_window_set_static_win_gravity: Not implemented\n")); + GDK_NOTE (MISC, g_print ("gdk_window_set_static_win_gravity: Not implemented\n")); } /************************************************************* @@ -2485,7 +2484,10 @@ gdk_window_focus (GdkWindow *window, if (GDK_WINDOW_DESTROYED (window)) return; + GDK_NOTE (MISC, g_print ("gdk_window_focus: %p\n", GDK_WINDOW_HWND (window))); + ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL); + SetFocus (GDK_WINDOW_HWND (window)); } void @@ -2514,8 +2516,6 @@ void gdk_window_set_type_hint (GdkWindow *window, GdkWindowTypeHint hint) { - GdkAtom atom; - g_return_if_fail (window != NULL); g_return_if_fail (GDK_IS_WINDOW (window)); @@ -2525,27 +2525,22 @@ gdk_window_set_type_hint (GdkWindow *window, switch (hint) { case GDK_WINDOW_TYPE_HINT_DIALOG: - atom = gdk_atom_intern ("_NET_WM_WINDOW_TYPE_DIALOG", FALSE); break; case GDK_WINDOW_TYPE_HINT_MENU: - atom = gdk_atom_intern ("_NET_WM_WINDOW_TYPE_MENU", FALSE); break; case GDK_WINDOW_TYPE_HINT_TOOLBAR: - atom = gdk_atom_intern ("_NET_WM_WINDOW_TYPE_TOOLBAR", FALSE); break; default: g_warning ("Unknown hint %d passed to gdk_window_set_type_hint", hint); /* Fall thru */ case GDK_WINDOW_TYPE_HINT_NORMAL: - atom = gdk_atom_intern ("_NET_WM_WINDOW_TYPE_NORMAL", FALSE); break; } /* * XXX ??? */ - GDK_NOTE (MISC, - g_print ("gdk_window_set_type_hint (%p)\n", - GDK_WINDOW_HWND (window))); + GDK_NOTE (MISC, g_print ("gdk_window_set_type_hint (%p)\n", + GDK_WINDOW_HWND (window))); } void -- 2.43.2