diff --git a/ChangeLog b/ChangeLog index a33d1012f..bf29cea7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,9 +2,44 @@ Merge from gtk-2-0: - * gdk/win32/gdkdrawable-win32.c (render_line_horizontal, - render_line_vertical): Some spacing cleanup. Return TRUE. + * gdk/win32/gdkdrawable-win32.c + * gdk/win32/gdkevents-win32.c: Some spacing and indentation cleanup. + * gdk/win32/gdkdrawable-win32.c (render_line_horizontal, + render_line_vertical): Return TRUE. + + * gdk/win32/gdkevents-win32.c (_gdk_events_init): Search if the + system has some input locale identifier that uses a Latin + keyboard. This is needed to be able to get the virtual-key code + for the latin characters corresponding to ASCII control + characters. If no such keyboard is present, try to load one + then. Will this upset users with no wish to ever use a Latin-based + keyboard layout? + + (vk_from_char): Convert all ASCII control chars to the + corresponding uppercase char before calling VkKeyScanEx(). Idea by + Florent Duguet. Makes Control-C work again. To make it hopefully + work like I think it should on non-Latin keyboards, too, use + latin_locale when looking for the corresponding keycode. + + Fix for #81831 by Tim Evans: + + * gdk/win32/gdkevents-win32.c (gdk_event_translate): Don't call + _gdk_event_button_generate() here, it would append the double- or + triple-click events too early, before the single-click event. + + (real_window_procedure): If we got a single-click event, call + _gdk_event_button_generate() to perhaps append the double- or + triple-click event after that. + + Merge from gtk-1-3-win32-production branch: + + * gdk/win32/gdkevents-win32.c (propagate): Check for parent being + NULL before trying to propagate to it, and return FALSE in that + case. (If parent is NULL, we are handling gdk_parent_root, and + probably should have noticed that and bailed out earlier. But + better late than never.) + Wed Sep 11 15:48:38 2002 Jonathan Blandford * gtk/gtktreemodel.c (gtk_tree_row_reference_get_type): Make diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a33d1012f..bf29cea7c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -2,9 +2,44 @@ Merge from gtk-2-0: - * gdk/win32/gdkdrawable-win32.c (render_line_horizontal, - render_line_vertical): Some spacing cleanup. Return TRUE. + * gdk/win32/gdkdrawable-win32.c + * gdk/win32/gdkevents-win32.c: Some spacing and indentation cleanup. + * gdk/win32/gdkdrawable-win32.c (render_line_horizontal, + render_line_vertical): Return TRUE. + + * gdk/win32/gdkevents-win32.c (_gdk_events_init): Search if the + system has some input locale identifier that uses a Latin + keyboard. This is needed to be able to get the virtual-key code + for the latin characters corresponding to ASCII control + characters. If no such keyboard is present, try to load one + then. Will this upset users with no wish to ever use a Latin-based + keyboard layout? + + (vk_from_char): Convert all ASCII control chars to the + corresponding uppercase char before calling VkKeyScanEx(). Idea by + Florent Duguet. Makes Control-C work again. To make it hopefully + work like I think it should on non-Latin keyboards, too, use + latin_locale when looking for the corresponding keycode. + + Fix for #81831 by Tim Evans: + + * gdk/win32/gdkevents-win32.c (gdk_event_translate): Don't call + _gdk_event_button_generate() here, it would append the double- or + triple-click events too early, before the single-click event. + + (real_window_procedure): If we got a single-click event, call + _gdk_event_button_generate() to perhaps append the double- or + triple-click event after that. + + Merge from gtk-1-3-win32-production branch: + + * gdk/win32/gdkevents-win32.c (propagate): Check for parent being + NULL before trying to propagate to it, and return FALSE in that + case. (If parent is NULL, we are handling gdk_parent_root, and + probably should have noticed that and bailed out earlier. But + better late than never.) + Wed Sep 11 15:48:38 2002 Jonathan Blandford * gtk/gtktreemodel.c (gtk_tree_row_reference_get_type): Make diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index a33d1012f..bf29cea7c 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -2,9 +2,44 @@ Merge from gtk-2-0: - * gdk/win32/gdkdrawable-win32.c (render_line_horizontal, - render_line_vertical): Some spacing cleanup. Return TRUE. + * gdk/win32/gdkdrawable-win32.c + * gdk/win32/gdkevents-win32.c: Some spacing and indentation cleanup. + * gdk/win32/gdkdrawable-win32.c (render_line_horizontal, + render_line_vertical): Return TRUE. + + * gdk/win32/gdkevents-win32.c (_gdk_events_init): Search if the + system has some input locale identifier that uses a Latin + keyboard. This is needed to be able to get the virtual-key code + for the latin characters corresponding to ASCII control + characters. If no such keyboard is present, try to load one + then. Will this upset users with no wish to ever use a Latin-based + keyboard layout? + + (vk_from_char): Convert all ASCII control chars to the + corresponding uppercase char before calling VkKeyScanEx(). Idea by + Florent Duguet. Makes Control-C work again. To make it hopefully + work like I think it should on non-Latin keyboards, too, use + latin_locale when looking for the corresponding keycode. + + Fix for #81831 by Tim Evans: + + * gdk/win32/gdkevents-win32.c (gdk_event_translate): Don't call + _gdk_event_button_generate() here, it would append the double- or + triple-click events too early, before the single-click event. + + (real_window_procedure): If we got a single-click event, call + _gdk_event_button_generate() to perhaps append the double- or + triple-click event after that. + + Merge from gtk-1-3-win32-production branch: + + * gdk/win32/gdkevents-win32.c (propagate): Check for parent being + NULL before trying to propagate to it, and return FALSE in that + case. (If parent is NULL, we are handling gdk_parent_root, and + probably should have noticed that and bailed out earlier. But + better late than never.) + Wed Sep 11 15:48:38 2002 Jonathan Blandford * gtk/gtktreemodel.c (gtk_tree_row_reference_get_type): Make diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index a33d1012f..bf29cea7c 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -2,9 +2,44 @@ Merge from gtk-2-0: - * gdk/win32/gdkdrawable-win32.c (render_line_horizontal, - render_line_vertical): Some spacing cleanup. Return TRUE. + * gdk/win32/gdkdrawable-win32.c + * gdk/win32/gdkevents-win32.c: Some spacing and indentation cleanup. + * gdk/win32/gdkdrawable-win32.c (render_line_horizontal, + render_line_vertical): Return TRUE. + + * gdk/win32/gdkevents-win32.c (_gdk_events_init): Search if the + system has some input locale identifier that uses a Latin + keyboard. This is needed to be able to get the virtual-key code + for the latin characters corresponding to ASCII control + characters. If no such keyboard is present, try to load one + then. Will this upset users with no wish to ever use a Latin-based + keyboard layout? + + (vk_from_char): Convert all ASCII control chars to the + corresponding uppercase char before calling VkKeyScanEx(). Idea by + Florent Duguet. Makes Control-C work again. To make it hopefully + work like I think it should on non-Latin keyboards, too, use + latin_locale when looking for the corresponding keycode. + + Fix for #81831 by Tim Evans: + + * gdk/win32/gdkevents-win32.c (gdk_event_translate): Don't call + _gdk_event_button_generate() here, it would append the double- or + triple-click events too early, before the single-click event. + + (real_window_procedure): If we got a single-click event, call + _gdk_event_button_generate() to perhaps append the double- or + triple-click event after that. + + Merge from gtk-1-3-win32-production branch: + + * gdk/win32/gdkevents-win32.c (propagate): Check for parent being + NULL before trying to propagate to it, and return FALSE in that + case. (If parent is NULL, we are handling gdk_parent_root, and + probably should have noticed that and bailed out earlier. But + better late than never.) + Wed Sep 11 15:48:38 2002 Jonathan Blandford * gtk/gtktreemodel.c (gtk_tree_row_reference_get_type): Make diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a33d1012f..bf29cea7c 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -2,9 +2,44 @@ Merge from gtk-2-0: - * gdk/win32/gdkdrawable-win32.c (render_line_horizontal, - render_line_vertical): Some spacing cleanup. Return TRUE. + * gdk/win32/gdkdrawable-win32.c + * gdk/win32/gdkevents-win32.c: Some spacing and indentation cleanup. + * gdk/win32/gdkdrawable-win32.c (render_line_horizontal, + render_line_vertical): Return TRUE. + + * gdk/win32/gdkevents-win32.c (_gdk_events_init): Search if the + system has some input locale identifier that uses a Latin + keyboard. This is needed to be able to get the virtual-key code + for the latin characters corresponding to ASCII control + characters. If no such keyboard is present, try to load one + then. Will this upset users with no wish to ever use a Latin-based + keyboard layout? + + (vk_from_char): Convert all ASCII control chars to the + corresponding uppercase char before calling VkKeyScanEx(). Idea by + Florent Duguet. Makes Control-C work again. To make it hopefully + work like I think it should on non-Latin keyboards, too, use + latin_locale when looking for the corresponding keycode. + + Fix for #81831 by Tim Evans: + + * gdk/win32/gdkevents-win32.c (gdk_event_translate): Don't call + _gdk_event_button_generate() here, it would append the double- or + triple-click events too early, before the single-click event. + + (real_window_procedure): If we got a single-click event, call + _gdk_event_button_generate() to perhaps append the double- or + triple-click event after that. + + Merge from gtk-1-3-win32-production branch: + + * gdk/win32/gdkevents-win32.c (propagate): Check for parent being + NULL before trying to propagate to it, and return FALSE in that + case. (If parent is NULL, we are handling gdk_parent_root, and + probably should have noticed that and bailed out earlier. But + better late than never.) + Wed Sep 11 15:48:38 2002 Jonathan Blandford * gtk/gtktreemodel.c (gtk_tree_row_reference_get_type): Make diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a33d1012f..bf29cea7c 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -2,9 +2,44 @@ Merge from gtk-2-0: - * gdk/win32/gdkdrawable-win32.c (render_line_horizontal, - render_line_vertical): Some spacing cleanup. Return TRUE. + * gdk/win32/gdkdrawable-win32.c + * gdk/win32/gdkevents-win32.c: Some spacing and indentation cleanup. + * gdk/win32/gdkdrawable-win32.c (render_line_horizontal, + render_line_vertical): Return TRUE. + + * gdk/win32/gdkevents-win32.c (_gdk_events_init): Search if the + system has some input locale identifier that uses a Latin + keyboard. This is needed to be able to get the virtual-key code + for the latin characters corresponding to ASCII control + characters. If no such keyboard is present, try to load one + then. Will this upset users with no wish to ever use a Latin-based + keyboard layout? + + (vk_from_char): Convert all ASCII control chars to the + corresponding uppercase char before calling VkKeyScanEx(). Idea by + Florent Duguet. Makes Control-C work again. To make it hopefully + work like I think it should on non-Latin keyboards, too, use + latin_locale when looking for the corresponding keycode. + + Fix for #81831 by Tim Evans: + + * gdk/win32/gdkevents-win32.c (gdk_event_translate): Don't call + _gdk_event_button_generate() here, it would append the double- or + triple-click events too early, before the single-click event. + + (real_window_procedure): If we got a single-click event, call + _gdk_event_button_generate() to perhaps append the double- or + triple-click event after that. + + Merge from gtk-1-3-win32-production branch: + + * gdk/win32/gdkevents-win32.c (propagate): Check for parent being + NULL before trying to propagate to it, and return FALSE in that + case. (If parent is NULL, we are handling gdk_parent_root, and + probably should have noticed that and bailed out earlier. But + better late than never.) + Wed Sep 11 15:48:38 2002 Jonathan Blandford * gtk/gtktreemodel.c (gtk_tree_row_reference_get_type): Make diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index 0b3bbbdee..eac4b8cb2 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -135,6 +135,9 @@ static PFN_TrackMouseEvent track_mouse_event = NULL; static gboolean use_ime_composition = FALSE; +static HKL latin_locale = NULL; +static gboolean latin_locale_loaded = FALSE; + static LRESULT real_window_procedure (HWND hwnd, UINT message, @@ -235,6 +238,9 @@ real_window_procedure (HWND hwnd, else { _gdk_event_queue_append (display, eventp); + + if (eventp->type == GDK_BUTTON_PRESS) + _gdk_event_button_generate (display, eventp); #if 1 /* Wake up WaitMessage */ PostMessage (NULL, gdk_ping_msg, 0, 0); @@ -293,6 +299,43 @@ _gdk_events_init (void) HMODULE user32, imm32; HINSTANCE commctrl32; #endif + int i, j, n; + + /* List of languages that use a latin keyboard. Somewhat sorted in + * "order of least surprise", in case we have to load one of them if + * the user only has arabic loaded, for instance. + */ + static int latin_languages[] = { + LANG_ENGLISH, + LANG_SPANISH, + LANG_PORTUGUESE, + LANG_FRENCH, + LANG_GERMAN, + /* Rest in numeric order */ + LANG_CZECH, + LANG_DANISH, + LANG_FINNISH, + LANG_HUNGARIAN, + LANG_ICELANDIC, + LANG_ITALIAN, + LANG_DUTCH, + LANG_NORWEGIAN, + LANG_POLISH, + LANG_ROMANIAN, + LANG_SLOVAK, + LANG_ALBANIAN, + LANG_SWEDISH, + LANG_TURKISH, + LANG_INDONESIAN, + LANG_SLOVENIAN, + LANG_ESTONIAN, + LANG_LATVIAN, + LANG_LITHUANIAN, + LANG_VIETNAMESE, + LANG_AFRIKAANS, + LANG_FAEROESE, + LANG_SWAHILI + }; gdk_ping_msg = RegisterWindowMessage ("gdk-ping"); GDK_NOTE (EVENTS, g_print ("gdk-ping = %#x\n", gdk_ping_msg)); @@ -305,6 +348,47 @@ _gdk_events_init (void) msh_mousewheel_msg = RegisterWindowMessage ("MSWHEEL_ROLLMSG"); GDK_NOTE (EVENTS, g_print ("MSH_MOUSEWHEEL = %#x\n", msh_mousewheel_msg)); + /* Check if we have some input locale identifier loaded that uses a + * latin keyboard, to be able to get the virtual-key code for the + * latin characters corresponding to ASCII control characters. + */ + if ((n = GetKeyboardLayoutList (0, NULL)) == 0) + WIN32_API_FAILED ("GetKeyboardLayoutList"); + else + { + HKL *hkl_list = g_new (HKL, n); + if (GetKeyboardLayoutList (n, hkl_list) == 0) + WIN32_API_FAILED ("GetKeyboardLayoutList"); + else + { + for (i = 0; latin_locale == NULL && i < n; i++) + for (j = 0; j < G_N_ELEMENTS (latin_languages); j++) + if (PRIMARYLANGID (LOWORD (hkl_list[i])) == latin_languages[j]) + { + latin_locale = hkl_list [i]; + break; + } + } + g_free (hkl_list); + } + + if (latin_locale == NULL) + { + /* Try to load a keyboard layout with latin characters then. + */ + i = 0; + while (latin_locale == NULL && i < G_N_ELEMENTS (latin_languages)) + { + char id[9]; + sprintf (id, "%08x", MAKELANGID (latin_languages[i++], SUBLANG_DEFAULT)); + latin_locale = LoadKeyboardLayout (id, KLF_NOTELLSHELL|KLF_SUBSTITUTE_OK); + if (latin_locale != NULL) + latin_locale_loaded = TRUE; + } + } + + GDK_NOTE (EVENTS, g_print ("latin_locale = %08x\n", (guint) latin_locale)); + source = g_source_new (&event_funcs, sizeof (GSource)); g_source_set_priority (source, GDK_PRIORITY_EVENTS); @@ -841,15 +925,21 @@ build_pointer_event_state (MSG *msg) static guint vk_from_char (guint c) { - switch (c) + HKL locale = _gdk_input_locale; + + /* For some control characters (control-C, control-J and control-M), + * VkKeyScanEx returns special keycodes (different from the + * corresponding uncontrolified character). Thus, for control + * characters, uncontrolify it first and return the virtual-key code + * it would have on a Latin-based keyboard, otherwise stuff breaks. + */ + if (latin_locale != NULL && c >= '\000' && c <= '\032') { - case '\b': - return 'H'; - case '\t': - return 'I'; - default: - return (VkKeyScanEx (c, _gdk_input_locale) & 0xFF); + c += '@'; + locale = latin_locale; } + + return (VkKeyScanEx (c, locale) & 0xFF); } static void @@ -1111,6 +1201,11 @@ print_event (GdkEvent *event) (event->crossing.detail == GDK_NOTIFY_NONLINEAR ? "NONLINEAR" : "???")))); break; + case GDK_CONFIGURE: + g_print ("x:%d y:%d w:%d h:%d", + event->configure.x, event->configure.y, + event->configure.width, event->configure.height); + break; case GDK_SCROLL: g_print ("%s ", (event->scroll.direction == GDK_SCROLL_UP ? "UP" : @@ -1322,7 +1417,8 @@ synthesize_crossing_events (GdkWindow *window, if (current_window) gdk_window_unref (current_window); current_window = window; - gdk_window_ref (current_window); + if (current_window) + gdk_window_ref (current_window); } #if 0 @@ -1527,6 +1623,11 @@ propagate (GdkWindow **window, return FALSE; } } + else if (GDK_WINDOW_OBJECT (*window)->parent == NULL) + { + GDK_NOTE (EVENTS, g_print ("...parent NULL (?), undelivered\n")); + return FALSE; + } else { gdk_drawable_unref (*window); @@ -1886,10 +1987,10 @@ gdk_event_translate (GdkDisplay *display, * removed it. Repost the same message to our queue so that * we will get it later when we are prepared. */ - GDK_NOTE(MISC, g_print("gdk_event_translate: %p %s posted.\n", - msg->hwnd, - msg->message == WM_MOVE ? - "WM_MOVE" : "WM_SIZE")); + GDK_NOTE (MISC, g_print("gdk_event_translate: %p %s posted.\n", + msg->hwnd, + msg->message == WM_MOVE ? + "WM_MOVE" : "WM_SIZE")); PostMessage (msg->hwnd, msg->message, msg->wParam, msg->lParam); @@ -1899,8 +2000,8 @@ gdk_event_translate (GdkDisplay *display, { window = (UNALIGNED GdkWindow*) (((LPCREATESTRUCT) msg->lParam)->lpCreateParams); GDK_WINDOW_HWND (window) = msg->hwnd; - GDK_NOTE (EVENTS, g_print ("gdk_event_translate: created %#x\n", - (guint) msg->hwnd)); + GDK_NOTE (EVENTS, g_print ("gdk_event_translate: created %p\n", + msg->hwnd)); # if 0 /* This should handle allmost all the other window==NULL cases. * This code is executed while gdk_window_new is in it's @@ -1908,14 +2009,14 @@ gdk_event_translate (GdkDisplay *display, * Don't insert xid there a second time, if it's done here. */ gdk_drawable_ref (window); - gdk_win32_handle_table_insert (&GDK_WINDOW_HWND(window), window); + gdk_win32_handle_table_insert (&GDK_WINDOW_HWND (window), window); # endif } else { - GDK_NOTE (EVENTS, g_print ("gdk_event_translate: %s for %#x (NULL)\n", + GDK_NOTE (EVENTS, g_print ("gdk_event_translate: %s for %p (NULL)\n", gdk_win32_message_name(msg->message), - (guint) msg->hwnd)); + msg->hwnd)); } #endif return FALSE; @@ -2067,7 +2168,7 @@ gdk_event_translate (GdkDisplay *display, 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 ch:%.02x %s\n", (msg->message == WM_SYSKEYUP ? "UP" : "DOWN"), msg->hwnd, (GetKeyNameText (msg->lParam, buf, @@ -2099,7 +2200,7 @@ gdk_event_translate (GdkDisplay *display, 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 ch:%.02x %s\n", (msg->message == WM_KEYUP ? "UP" : "DOWN"), msg->hwnd, (GetKeyNameText (msg->lParam, buf, @@ -2127,7 +2228,7 @@ gdk_event_translate (GdkDisplay *display, case VK_BACK: event->key.keyval = GDK_BackSpace; break; case VK_TAB: - event->key.keyval = (GetKeyState(VK_SHIFT) < 0 ? + event->key.keyval = (GetKeyState (VK_SHIFT) < 0 ? GDK_ISO_Left_Tab : GDK_Tab); break; case VK_CLEAR: @@ -2524,8 +2625,6 @@ gdk_event_translate (GdkDisplay *display, event->button.button = button; event->button.device = display->core_pointer; - _gdk_event_button_generate (display, event); - return_val = !GDK_WINDOW_DESTROYED (window); break; @@ -2608,8 +2707,8 @@ gdk_event_translate (GdkDisplay *display, break; /* HB: only process mouse move messages if we own the active window. */ - GetWindowThreadProcessId(GetActiveWindow(), &pidActWin); - GetWindowThreadProcessId(msg->hwnd, &pidThis); + GetWindowThreadProcessId (GetActiveWindow (), &pidActWin); + GetWindowThreadProcessId (msg->hwnd, &pidThis); if (pidActWin != pidThis) break; @@ -3122,8 +3221,8 @@ gdk_event_translate (GdkDisplay *display, break; if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD - && !IsIconic(msg->hwnd) - && IsWindowVisible(msg->hwnd)) + && !IsIconic (msg->hwnd) + && IsWindowVisible (msg->hwnd)) { event->configure.type = GDK_CONFIGURE; event->configure.window = window; @@ -3150,8 +3249,8 @@ gdk_event_translate (GdkDisplay *display, break; if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD - && !IsIconic(msg->hwnd) - && IsWindowVisible(msg->hwnd)) + && !IsIconic (msg->hwnd) + && IsWindowVisible (msg->hwnd)) { LPWINDOWPOS lpwp = (LPWINDOWPOS) (msg->lParam); @@ -3294,7 +3393,7 @@ gdk_event_translate (GdkDisplay *display, /* Fall through */ wintab: event->any.window = window; - return_val = _gdk_input_other_event(event, msg, window); + return_val = _gdk_input_other_event (event, msg, window); break; #endif @@ -3348,33 +3447,7 @@ _gdk_events_queue (GdkDisplay *display) TranslateMessage (&msg); #endif -#if 1 /* It was like this all the time */ DispatchMessage (&msg); -#else /* but this one is more similar to the X implementation. Any effect ? */ - event = _gdk_event_new (); - - event->any.type = GDK_NOTHING; - event->any.window = NULL; - event->any.send_event = InSendMessage (); - - ((GdkEventPrivate *)event)->flags |= GDK_EVENT_PENDING; - - _gdk_event_queue_append (display, event); - node = _gdk_queued_tail; - - if (gdk_event_translate (display, event, &msg, NULL, NULL, FALSE)) - { - ((GdkEventPrivate *)event)->flags &= ~GDK_EVENT_PENDING; - } - else - { - _gdk_event_queue_remove_link (display, node); - g_list_free_1 (node); - gdk_event_free (event); - DispatchMessage (&msg); - } - -#endif } }