216 lines
8.6 KiB
Diff
216 lines
8.6 KiB
Diff
From 03c9e591430c62354bbf26ef7bd4a2e6acfb7c8f Mon Sep 17 00:00:00 2001
|
|
From: Yusuke Sato <yusukes@chromium.org>
|
|
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 <takao.fujiwara1@gmail.com>
|
|
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 a00ebefde44cf5daaa642fc880c51357cb83f15b Mon Sep 17 00:00:00 2001
|
|
From: fujiwarat <takao.fujiwara1@gmail.com>
|
|
Date: Tue, 8 Feb 2011 18:17:11 +0900
|
|
Subject: [PATCH] Fixed typo.
|
|
|
|
---
|
|
client/gtk2/ibusimcontext.c | 10 +++++-----
|
|
1 files changed, 5 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
|
|
index 608f294..bb5ae5c 100644
|
|
--- a/client/gtk2/ibusimcontext.c
|
|
+++ b/client/gtk2/ibusimcontext.c
|
|
@@ -401,11 +401,11 @@ _get_boolean_env(const gchar *name,
|
|
if (value == NULL)
|
|
return defval;
|
|
|
|
- if (g_strcmp0 (name, "") == 0 ||
|
|
- g_strcmp0 (name, "0") == 0 ||
|
|
- g_strcmp0 (name, "false") == 0 ||
|
|
- g_strcmp0 (name, "False") == 0 ||
|
|
- g_strcmp0 (name, "FALSE") == 0)
|
|
+ if (g_strcmp0 (value, "") == 0 ||
|
|
+ g_strcmp0 (value, "0") == 0 ||
|
|
+ g_strcmp0 (value, "false") == 0 ||
|
|
+ g_strcmp0 (value, "False") == 0 ||
|
|
+ g_strcmp0 (value, "FALSE") == 0)
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
--
|
|
1.7.3.2
|
|
|
|
From c6949a852235bedb44126c3c6f36e1fba4b71bce Mon Sep 17 00:00:00 2001
|
|
From: fujiwarat <takao.fujiwara1@gmail.com>
|
|
Date: Tue, 8 Feb 2011 18:21:50 +0900
|
|
Subject: [PATCH] Added the optional sync mode apps in IBusIMContext.
|
|
|
|
---
|
|
client/gtk2/ibusimcontext.c | 27 +++++++++++++++++++++++++++
|
|
configure.ac | 11 +++++++++++
|
|
2 files changed, 38 insertions(+), 0 deletions(-)
|
|
|
|
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
|
|
index bb5ae5c..a4e46cb 100644
|
|
--- a/client/gtk2/ibusimcontext.c
|
|
+++ b/client/gtk2/ibusimcontext.c
|
|
@@ -79,6 +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 const gchar *_sync_mode_apps = SYNC_MODE_APPS;
|
|
static gboolean _use_sync_mode = FALSE;
|
|
|
|
static GtkIMContext *_focus_im_context = NULL;
|
|
@@ -477,6 +478,32 @@ ibus_im_context_class_init (IBusIMContextClass *class)
|
|
g_strfreev (apps);
|
|
}
|
|
|
|
+ /* env IBUS_SYNC_MODE_APPS for sync mode apps */
|
|
+ /* It seems MetaDisplay does not take the events from gdk_event_put()
|
|
+ * in async mode. So if gnome-shell + mutter are used,
|
|
+ * the key events are lost in async mode.
|
|
+ * gnome-shell search box, actually st_im_text_key_press_event(),
|
|
+ * does not call the parent filter_keypress() when the IM client
|
|
+ * returns TRUE. The class inherits ClutterActor which is not
|
|
+ * GtkWidget so the clutter does not call GTK snoopers.
|
|
+ * So ibus_im_context_filter_keypress() needs to return FALSE. */
|
|
+ if (!_use_sync_mode) {
|
|
+ /* enable sync mode if app is in _sync_mode_apps */
|
|
+ const gchar * prgname = g_get_prgname ();
|
|
+ if (g_getenv ("IBUS_SYNC_MODE_APPS")) {
|
|
+ _sync_mode_apps = g_getenv ("IBUS_SYNC_MODE_APPS");
|
|
+ }
|
|
+ gchar **p;
|
|
+ gchar ** apps = g_strsplit (_sync_mode_apps, ",", 0);
|
|
+ for (p = apps; *p != NULL; p++) {
|
|
+ if (g_regex_match_simple (*p, prgname, 0, 0)) {
|
|
+ _use_sync_mode = TRUE;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ g_strfreev (apps);
|
|
+ }
|
|
+
|
|
/* init bus object */
|
|
if (_bus == NULL) {
|
|
ibus_set_display (gdk_display_get_name (gdk_display_get_default ()));
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 1a1e663..81efe81 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -354,6 +354,16 @@ 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 sync mode applications.
|
|
+AC_ARG_WITH(sync-mode-apps,
|
|
+ AS_HELP_STRING([--with-sync-mode-apps[=regex1,regex2]],
|
|
+ [Enable sync mode in those applications (like: .*chrome.*,firefox.*)]),
|
|
+ [SYNC_MODE_APPS=$with_sync_mode_apps],
|
|
+ [SYNC_MODE_APPS=[mutter]]
|
|
+)
|
|
+AC_DEFINE_UNQUOTED(SYNC_MODE_APPS, "$SYNC_MODE_APPS",
|
|
+ [Enbale sync mode in those applications])
|
|
+
|
|
# check iso-codes
|
|
PKG_CHECK_MODULES(ISOCODES, [
|
|
iso-codes
|
|
@@ -423,6 +433,7 @@ Build options:
|
|
Build vala binding $enable_vala
|
|
Build document $enable_gtk_doc
|
|
Enable key snooper $enable_key_snooper
|
|
+ Sync mode regexes "$SYNC_MODE_APPS"
|
|
No snooper regexes "$NO_SNOOPER_APPS"
|
|
])
|
|
|
|
--
|
|
1.7.3.2
|
|
|