From 905f021bbddacc013fed9d4060e8f71ef4136e59 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Mon, 17 Jan 2022 11:15:51 +0800 Subject: [PATCH 1/2] Revert "Bug 676077: Fix handling of Keyboard Input on Windows" The actual code that does the IM context code handling on Windows now uses the native Windows APIs to handle keystrokes, so this patch is no longer needed, as it was found that it instead caused issues. Pointed out in issue #2865. This reverts commit fd6ce9975e4cc9c090d07e7a6b0013d02b49ce26. --- gdk/gdkkeyuni.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/gdk/gdkkeyuni.c b/gdk/gdkkeyuni.c index e19167f9ad..bf7e399d77 100644 --- a/gdk/gdkkeyuni.c +++ b/gdk/gdkkeyuni.c @@ -835,18 +835,13 @@ static const struct { /* Following items added to GTK, not in the xterm table */ /* A few ASCII control characters */ -#ifndef GDK_WINDOWING_WIN32 + { 0xFF08 /* Backspace */, '\b' }, { 0xFF09 /* Tab */, '\t' }, -#endif - { 0xFF0A /* Linefeed */, '\n' }, { 0xFF0B /* Vert. Tab */, '\v' }, - -#ifndef GDK_WINDOWING_WIN32 { 0xFF0D /* Return */, '\r' }, { 0xFF1B /* Escape */, '\033' }, -#endif /* Numeric keypad */ @@ -871,9 +866,7 @@ static const struct { /* End numeric keypad */ -#ifndef GDK_WINDOWING_WIN32 { 0xFFFF /* Delete */, '\177' } -#endif }; /** From 52616dee8e00e0191098bb7140a1dd5e3a7c211d Mon Sep 17 00:00:00 2001 From: Philip Zander Date: Mon, 17 Jan 2022 11:56:48 +0100 Subject: [PATCH 2/2] GtkIMContextIME: Ignore ASCII control characters Make GtkIMContextIME ignore ASCII control characters just like other IMContext implementations (e.G. GtkIMContextSimple). Fixes bogus characters appearing in text input fields (old bug 676077). --- gtk/gtkimcontextime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtkimcontextime.c b/gtk/gtkimcontextime.c index 6025239543..5c9282b59d 100644 --- a/gtk/gtkimcontextime.c +++ b/gtk/gtkimcontextime.c @@ -382,7 +382,7 @@ gtk_im_context_ime_filter_keypress (GtkIMContext *context, c = gdk_keyval_to_unicode (keyval); - if (c) + if (c && !g_unichar_iscntrl(c)) { _gtk_im_context_ime_commit_unichar (context_ime, c); retval = TRUE;