[ibus] Fixed Bug 675503 - a regression in sync mode

Takao Fujiwara fujiwara at fedoraproject.org
Tue Feb 8 10:02:10 UTC 2011


commit ee2c8d7341a33e4e94b75fbdad7aa1b97c9b18cb
Author: Takao Fujiwara <tfujiwar at redhat.com>
Date:   Tue Feb 8 19:02:01 2011 +0900

    Fixed Bug 675503 - a regression in sync mode

 ibus-435880-surrounding-text.patch |   50 +++++++-------
 ibus-HEAD.patch                    |  125 +++++++++++++++++++++++++-----------
 ibus.spec                          |    6 ++-
 3 files changed, 117 insertions(+), 64 deletions(-)
---
diff --git a/ibus-435880-surrounding-text.patch b/ibus-435880-surrounding-text.patch
index f38dd56..acd40b2 100644
--- a/ibus-435880-surrounding-text.patch
+++ b/ibus-435880-surrounding-text.patch
@@ -1,6 +1,6 @@
-From 4b115935d47b1a849617aad5db44212856b48630 Mon Sep 17 00:00:00 2001
+From 27788fb3bf62411c2b13d24bac45eb060483162f Mon Sep 17 00:00:00 2001
 From: Daiki Ueno <ueno at unixuser.org>
-Date: Fri, 4 Feb 2011 19:48:05 +0900
+Date: Tue, 8 Feb 2011 18:27:00 +0900
 Subject: [PATCH] Support surrounding-text retrieval.
 
 This change adds a new API function ibus_engine_get_surrounding_text().
@@ -216,7 +216,7 @@ index 32d51e8..20f561c 100644
                     context_signals[ENGINE_CHANGED],
                     0);
 diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
-index ab9c520..e61dd86 100644
+index a4e46cb..d029b5c 100644
 --- a/client/gtk2/ibusimcontext.c
 +++ b/client/gtk2/ibusimcontext.c
 @@ -27,6 +27,7 @@
@@ -237,7 +237,7 @@ index ab9c520..e61dd86 100644
  };
  
  struct _IBusIMContextClass {
-@@ -110,11 +112,18 @@ static void     ibus_im_context_set_cursor_location
+@@ -111,11 +113,18 @@ static void     ibus_im_context_set_cursor_location
  static void     ibus_im_context_set_use_preedit
                                              (GtkIMContext           *context,
                                               gboolean               use_preedit);
@@ -256,7 +256,7 @@ index ab9c520..e61dd86 100644
  
  static void     _bus_connected_cb           (IBusBus            *bus,
                                               IBusIMContext      *context);
-@@ -128,14 +137,15 @@ static void     _slave_preedit_start_cb     (GtkIMContext       *slave,
+@@ -129,14 +138,15 @@ static void     _slave_preedit_start_cb     (GtkIMContext       *slave,
                                               IBusIMContext       *context);
  static void     _slave_preedit_end_cb       (GtkIMContext       *slave,
                                               IBusIMContext       *context);
@@ -278,7 +278,7 @@ index ab9c520..e61dd86 100644
  static void     _create_fake_input_context  (void);
  
  
-@@ -247,6 +257,17 @@ _process_key_event_done (GObject      *object,
+@@ -248,6 +258,17 @@ _process_key_event_done (GObject      *object,
  }
  
  
@@ -296,7 +296,7 @@ index ab9c520..e61dd86 100644
  static gint
  _key_snooper_cb (GtkWidget   *widget,
                   GdkEventKey *event,
-@@ -333,6 +354,8 @@ _key_snooper_cb (GtkWidget   *widget,
+@@ -334,6 +355,8 @@ _key_snooper_cb (GtkWidget   *widget,
  
      } while (0);
  
@@ -305,7 +305,7 @@ index ab9c520..e61dd86 100644
      if (ibusimcontext != NULL) {
          ibusimcontext->time = event->time;
      }
-@@ -429,6 +452,7 @@ ibus_im_context_class_init (IBusIMContextClass *class)
+@@ -430,6 +453,7 @@ ibus_im_context_class_init (IBusIMContextClass *class)
      im_context_class->set_client_window = ibus_im_context_set_client_window;
      im_context_class->set_cursor_location = ibus_im_context_set_cursor_location;
      im_context_class->set_use_preedit = ibus_im_context_set_use_preedit;
@@ -313,7 +313,7 @@ index ab9c520..e61dd86 100644
      gobject_class->finalize = ibus_im_context_finalize;
  
      _signal_commit_id =
-@@ -542,7 +566,12 @@ ibus_im_context_init (GObject *obj)
+@@ -577,7 +601,12 @@ ibus_im_context_init (GObject *obj)
      ibusimcontext->ibuscontext = NULL;
      ibusimcontext->has_focus = FALSE;
      ibusimcontext->time = GDK_CURRENT_TIME;
@@ -327,7 +327,7 @@ index ab9c520..e61dd86 100644
  
  
      // Create slave im context
-@@ -639,6 +668,8 @@ ibus_im_context_filter_keypress (GtkIMContext *context,
+@@ -674,6 +703,8 @@ ibus_im_context_filter_keypress (GtkIMContext *context,
          if (ibusimcontext->client_window == NULL && event->window != NULL)
              gtk_im_context_set_client_window ((GtkIMContext *)ibusimcontext, event->window);
  
@@ -336,7 +336,7 @@ index ab9c520..e61dd86 100644
          if (ibusimcontext != NULL) {
              ibusimcontext->time = event->time;
          }
-@@ -733,6 +764,8 @@ ibus_im_context_focus_in (GtkIMContext *context)
+@@ -768,6 +799,8 @@ ibus_im_context_focus_in (GtkIMContext *context)
                                     (gpointer *) &_focus_im_context);
          _focus_im_context = context;
      }
@@ -345,7 +345,7 @@ index ab9c520..e61dd86 100644
  }
  
  static void
-@@ -890,6 +923,25 @@ ibus_im_context_set_cursor_location (GtkIMContext *context, GdkRectangle *area)
+@@ -925,6 +958,25 @@ ibus_im_context_set_cursor_location (GtkIMContext *context, GdkRectangle *area)
  }
  
  static void
@@ -371,7 +371,7 @@ index ab9c520..e61dd86 100644
  ibus_im_context_set_use_preedit (GtkIMContext *context, gboolean use_preedit)
  {
      IDEBUG ("%s", __FUNCTION__);
-@@ -898,17 +950,50 @@ ibus_im_context_set_use_preedit (GtkIMContext *context, gboolean use_preedit)
+@@ -933,17 +985,50 @@ ibus_im_context_set_use_preedit (GtkIMContext *context, gboolean use_preedit)
  
      if(ibusimcontext->ibuscontext) {
          if (use_preedit) {
@@ -425,7 +425,7 @@ index ab9c520..e61dd86 100644
  _bus_connected_cb (IBusBus          *bus,
                     IBusIMContext    *ibusimcontext)
  {
-@@ -927,6 +1012,8 @@ _ibus_context_commit_text_cb (IBusInputContext *ibuscontext,
+@@ -962,6 +1047,8 @@ _ibus_context_commit_text_cb (IBusInputContext *ibuscontext,
      IDEBUG ("%s", __FUNCTION__);
  
      g_signal_emit (ibusimcontext, _signal_commit_id, 0, text->text);
@@ -434,7 +434,7 @@ index ab9c520..e61dd86 100644
  }
  
  static gboolean
-@@ -1221,6 +1308,8 @@ _ibus_context_show_preedit_text_cb (IBusInputContext   *ibuscontext,
+@@ -1256,6 +1343,8 @@ _ibus_context_show_preedit_text_cb (IBusInputContext   *ibuscontext,
      ibusimcontext->preedit_visible = TRUE;
      g_signal_emit (ibusimcontext, _signal_preedit_start_id, 0);
      g_signal_emit (ibusimcontext, _signal_preedit_changed_id, 0);
@@ -443,7 +443,7 @@ index ab9c520..e61dd86 100644
  }
  
  static void
-@@ -1286,6 +1375,14 @@ _ibus_context_destroy_cb (IBusInputContext *ibuscontext,
+@@ -1321,6 +1410,14 @@ _ibus_context_destroy_cb (IBusInputContext *ibuscontext,
  }
  
  static void
@@ -458,7 +458,7 @@ index ab9c520..e61dd86 100644
  _create_input_context (IBusIMContext *ibusimcontext)
  {
      IDEBUG ("%s", __FUNCTION__);
-@@ -1328,6 +1425,10 @@ _create_input_context (IBusIMContext *ibusimcontext)
+@@ -1363,6 +1460,10 @@ _create_input_context (IBusIMContext *ibusimcontext)
                        "disabled",
                        G_CALLBACK (_ibus_context_disabled_cb),
                        ibusimcontext);
@@ -469,7 +469,7 @@ index ab9c520..e61dd86 100644
      g_signal_connect (ibusimcontext->ibuscontext, "destroy",
                        G_CALLBACK (_ibus_context_destroy_cb),
                        ibusimcontext);
-@@ -1384,17 +1485,21 @@ _slave_preedit_end_cb (GtkIMContext  *slave,
+@@ -1419,17 +1520,21 @@ _slave_preedit_end_cb (GtkIMContext  *slave,
      g_signal_emit (ibusimcontext, _signal_preedit_end_id, 0);
  }
  
@@ -495,7 +495,7 @@ index ab9c520..e61dd86 100644
  _slave_delete_surrounding_cb (GtkIMContext  *slave,
                                gint           offset_from_cursor,
                                guint          nchars,
-@@ -1403,9 +1508,10 @@ _slave_delete_surrounding_cb (GtkIMContext  *slave,
+@@ -1438,9 +1543,10 @@ _slave_delete_surrounding_cb (GtkIMContext  *slave,
      gboolean return_value;
  
      if (ibusimcontext->enable && ibusimcontext->ibuscontext) {
@@ -508,12 +508,12 @@ index ab9c520..e61dd86 100644
  
  #ifdef OS_CHROMEOS
 diff --git a/configure.ac b/configure.ac
-index 05ceb18..0c06fbc 100644
+index 81efe81..e5fe925 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -368,6 +368,19 @@ else
-     enable_inputcontext_sync="no (disabled, use --enable-inputcontext-sync to enable)"
- fi
+@@ -364,6 +364,19 @@ AC_ARG_WITH(sync-mode-apps,
+ AC_DEFINE_UNQUOTED(SYNC_MODE_APPS, "$SYNC_MODE_APPS",
+     [Enbale sync mode in those applications])
  
 +# option for enable surrounding-text
 +AC_ARG_ENABLE(surrounding-text,
@@ -531,9 +531,9 @@ index 05ceb18..0c06fbc 100644
  # check iso-codes
  PKG_CHECK_MODULES(ISOCODES, [
      iso-codes
-@@ -439,5 +452,6 @@ Build options:
+@@ -435,5 +448,6 @@ Build options:
    Enable key snooper        $enable_key_snooper
-   Enable inputcontext sync  $enable_inputcontext_sync
+   Sync mode regexes         "$SYNC_MODE_APPS"
    No snooper regexes        "$NO_SNOOPER_APPS"
 +  Enable surrounding-text   $enable_surrounding_text
  ])
diff --git a/ibus-HEAD.patch b/ibus-HEAD.patch
index 6302468..1a77808 100644
--- a/ibus-HEAD.patch
+++ b/ibus-HEAD.patch
@@ -93,71 +93,120 @@ index 745722f..608f294 100644
 -- 
 1.7.3.2
 
-From 275087240dfa197177d5c31326d14d943e84bb29 Mon Sep 17 00:00:00 2001
+From a00ebefde44cf5daaa642fc880c51357cb83f15b Mon Sep 17 00:00:00 2001
 From: fujiwarat <takao.fujiwara1 at gmail.com>
-Date: Fri, 4 Feb 2011 19:40:16 +0900
-Subject: [PATCH] Added the optional sync mode in IBusIMContext.
+Date: Tue, 8 Feb 2011 18:17:11 +0900
+Subject: [PATCH] Fixed typo.
 
-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(-)
+ 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 745722f..ab9c520 100644
+index 608f294..bb5ae5c 100644
 --- a/client/gtk2/ibusimcontext.c
 +++ b/client/gtk2/ibusimcontext.c
-@@ -79,7 +79,7 @@ static const gchar *_no_snooper_apps = NO_SNOOPER_APPS;
+@@ -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 at 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 gboolean _use_sync_mode = FALSE;
-+static gboolean _use_sync_mode = ENABLE_INPUTCONTEXT_SYNC;
++static const gchar *_sync_mode_apps = SYNC_MODE_APPS;
+ static gboolean _use_sync_mode = FALSE;
  
  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);
+@@ -477,6 +478,32 @@ ibus_im_context_class_init (IBusIMContextClass *class)
+         g_strfreev (apps);
+     }
  
-     /* env IBUS_DISABLE_SNOOPER does not exist */
-     if (_use_key_snooper) {
++    /* 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..05ceb18 100644
+index 1a1e663..81efe81 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -354,6 +354,20 @@ AC_ARG_WITH(no-snooper-apps,
+@@ -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 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]
++# 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]]
 +)
-+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
++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 +437,7 @@ Build options:
+@@ -423,6 +433,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
++  Sync mode regexes         "$SYNC_MODE_APPS"
    No snooper regexes        "$NO_SNOOPER_APPS"
  ])
  
diff --git a/ibus.spec b/ibus.spec
index 5281e77..1ad0677 100644
--- a/ibus.spec
+++ b/ibus.spec
@@ -12,7 +12,7 @@
 
 Name:       ibus
 Version:    1.3.99.20110127
-Release:    1%{?dist}
+Release:    2%{?dist}
 Summary:    Intelligent Input Bus for Linux OS
 License:    LGPLv2+
 Group:      System Environment/Libraries
@@ -298,6 +298,10 @@ fi
 %{_datadir}/gtk-doc/html/*
 
 %changelog
+* Tue Feb 08 2011 Takao Fujiwara <tfujiwar at redhat.com> - 1.3.99.20110127-2
+- Fixed Bug 675503 - a regression in sync mode
+  Updated ibus-HEAD.patch from upstream.
+
 * Fri Feb 04 2011 Takao Fujiwara <tfujiwar at redhat.com> - 1.3.99.20110127-1
 - Updated to 1.3.99.20110127
 - Updated ibus-HEAD.patch from upstream.


More information about the scm-commits mailing list