From 03c9e591430c62354bbf26ef7bd4a2e6acfb7c8f Mon Sep 17 00:00:00 2001 From: Yusuke Sato Date: Thu, 3 Feb 2011 10:15:24 +0900 Subject: [PATCH] Overwrite Gtk+'s default compose table to fix crosbug.com/11421. BUG=chromium-os:11421 TEST=manually done on Chrome OS. Review URL: http://codereview.appspot.com/3989060 --- client/gtk2/ibusimcontext.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c index b1ae0c8..745722f 100644 --- a/client/gtk2/ibusimcontext.c +++ b/client/gtk2/ibusimcontext.c @@ -496,6 +496,24 @@ ibus_im_context_class_init (IBusIMContextClass *class) _key_snooper_id = gtk_key_snooper_install (_key_snooper_cb, NULL); } +/* Copied from gtk+2.0-2.20.1/modules/input/imcedilla.c to fix crosbug.com/11421. + * Overwrite the original Gtk+'s compose table in gtk+-2.x.y/gtk/gtkimcontextsimple.c. */ + +/* The difference between this and the default input method is the handling + * of C+acute - this method produces C WITH CEDILLA rather than C WITH ACUTE. + * For languages that use CCedilla and not acute, this is the preferred mapping, + * and is particularly important for pt_BR, where the us-intl keyboard is + * used extensively. + */ +static guint16 cedilla_compose_seqs[] = { + GDK_dead_acute, GDK_C, 0, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */ + GDK_dead_acute, GDK_c, 0, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */ + GDK_Multi_key, GDK_apostrophe, GDK_C, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */ + GDK_Multi_key, GDK_apostrophe, GDK_c, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */ + GDK_Multi_key, GDK_C, GDK_apostrophe, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */ + GDK_Multi_key, GDK_c, GDK_apostrophe, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */ +}; + static void ibus_im_context_init (GObject *obj) { @@ -528,6 +546,11 @@ ibus_im_context_init (GObject *obj) // Create slave im context ibusimcontext->slave = gtk_im_context_simple_new (); + gtk_im_context_simple_add_table (GTK_IM_CONTEXT_SIMPLE (ibusimcontext->slave), + cedilla_compose_seqs, + 4, + G_N_ELEMENTS (cedilla_compose_seqs) / (4 + 2)); + g_signal_connect (ibusimcontext->slave, "commit", G_CALLBACK (_slave_commit_cb), -- 1.7.3.2 From 2cf859f01912fe41fd36edaeb0efc21f4fabcb0f Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Sat, 5 Feb 2011 03:00:04 +0900 Subject: [PATCH] Added GTK3 definitions. --- client/gtk2/ibusimcontext.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c index 745722f..608f294 100644 --- a/client/gtk2/ibusimcontext.c +++ b/client/gtk2/ibusimcontext.c @@ -506,12 +506,21 @@ ibus_im_context_class_init (IBusIMContextClass *class) * used extensively. */ static guint16 cedilla_compose_seqs[] = { +#ifdef DEPRECATED_GDK_KEYSYMS GDK_dead_acute, GDK_C, 0, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */ GDK_dead_acute, GDK_c, 0, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */ GDK_Multi_key, GDK_apostrophe, GDK_C, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */ GDK_Multi_key, GDK_apostrophe, GDK_c, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */ GDK_Multi_key, GDK_C, GDK_apostrophe, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */ GDK_Multi_key, GDK_c, GDK_apostrophe, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */ +#else + GDK_KEY_dead_acute, GDK_KEY_C, 0, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */ + GDK_KEY_dead_acute, GDK_KEY_c, 0, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */ + GDK_KEY_Multi_key, GDK_KEY_apostrophe, GDK_KEY_C, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */ + GDK_KEY_Multi_key, GDK_KEY_apostrophe, GDK_KEY_c, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */ + GDK_KEY_Multi_key, GDK_KEY_C, GDK_KEY_apostrophe, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */ + GDK_KEY_Multi_key, GDK_KEY_c, GDK_KEY_apostrophe, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */ +#endif }; static void -- 1.7.3.2 From 275087240dfa197177d5c31326d14d943e84bb29 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Fri, 4 Feb 2011 19:40:16 +0900 Subject: [PATCH] Added the optional sync mode in IBusIMContext. Async mode always return TRUE in filter_keypress() so the caller could ignore the events. --- client/gtk2/ibusimcontext.c | 5 +++-- configure.ac | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c index 745722f..ab9c520 100644 --- a/client/gtk2/ibusimcontext.c +++ b/client/gtk2/ibusimcontext.c @@ -79,7 +79,7 @@ static const gchar *_no_snooper_apps = NO_SNOOPER_APPS; static gboolean _use_key_snooper = ENABLE_SNOOPER; static guint _key_snooper_id = 0; -static gboolean _use_sync_mode = FALSE; +static gboolean _use_sync_mode = ENABLE_INPUTCONTEXT_SYNC; static GtkIMContext *_focus_im_context = NULL; static IBusInputContext *_fake_context = NULL; @@ -457,7 +457,8 @@ ibus_im_context_class_init (IBusIMContextClass *class) _use_key_snooper = !_get_boolean_env ("IBUS_DISABLE_SNOOPER", !(ENABLE_SNOOPER)); - _use_sync_mode = _get_boolean_env ("IBUS_ENABLE_SYNC_MODE", FALSE); + _use_sync_mode = _get_boolean_env ("IBUS_ENABLE_SYNC_MODE", + ENABLE_INPUTCONTEXT_SYNC); /* env IBUS_DISABLE_SNOOPER does not exist */ if (_use_key_snooper) { diff --git a/configure.ac b/configure.ac index 1a1e663..05ceb18 100644 --- a/configure.ac +++ b/configure.ac @@ -354,6 +354,20 @@ AC_ARG_WITH(no-snooper-apps, AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS", [Does not enbale keyboard snooper in those applications]) +# option for always enable inputcontext sync. +AC_ARG_ENABLE(key-snooper, + AS_HELP_STRING([--enable-inputcontext-sync], + [Always enable inputcontext sync in gtk im module]), + [enable_inputcontext_sync=$enableval], + [enable_inputcontext_sync=yes] +) +if test x"$enable_inputcontext_sync" = x"yes"; then + AC_DEFINE(ENABLE_INPUTCONTEXT_SYNC, TRUE, [Enable inputcontext sync]) +else + AC_DEFINE(ENABLE_INPUTCONTEXT_SYNC, FALSE, [Enable inputcontext sync]) + enable_inputcontext_sync="no (disabled, use --enable-inputcontext-sync to enable)" +fi + # check iso-codes PKG_CHECK_MODULES(ISOCODES, [ iso-codes @@ -423,6 +437,7 @@ Build options: Build vala binding $enable_vala Build document $enable_gtk_doc Enable key snooper $enable_key_snooper + Enable inputcontext sync $enable_inputcontext_sync No snooper regexes "$NO_SNOOPER_APPS" ]) -- 1.7.3.2