Fix unexpected client capabilities in ibus-daemon.
authorYusuke Sato <yusukes@chromium.org>
Thu, 25 Nov 2010 08:54:19 +0000 (17:54 +0900)
committerYusuke Sato <yusukes@chromium.org>
Thu, 25 Nov 2010 08:54:19 +0000 (17:54 +0900)
BUG=none
TEST=manually

Review URL: http://codereview.appspot.com/3323041

bus/inputcontext.c
src/ibusinputcontext.h

index 8f36b4c..40e13b6 100644 (file)
@@ -292,7 +292,8 @@ static const gchar introspection_xml[] =
 
 G_DEFINE_TYPE (BusInputContext, bus_input_context, IBUS_TYPE_SERVICE)
 
-/* TRUE if we can send preedit text to client. FALSE if the panel has to handle it. */
+/* TRUE if we can send preedit text to client. FALSE if the panel has to handle it. Note that we check IBUS_CAP_FOCUS here since
+ * when the capability is not set, the client has to handle a preedit text regardless of the embed_preedit_text config. */
 #define PREEDIT_CONDITION  \
     ((context->capabilities & IBUS_CAP_PREEDIT_TEXT) && \
      (bus_ibus_impl_is_embed_preedit_text (BUS_DEFAULT_IBUS) || (context->capabilities & IBUS_CAP_FOCUS) == 0))
@@ -2290,6 +2291,12 @@ bus_input_context_set_capabilities (BusInputContext    *context,
 {
     g_assert (BUS_IS_INPUT_CONTEXT (context));
 
+    /* If the context does not support IBUS_CAP_FOCUS, then the client application have to handle all information such as
+     * preedit and auxiliary text. */
+    if ((capabilities & IBUS_CAP_FOCUS) == 0) {
+        capabilities |= (IBUS_CAP_PREEDIT_TEXT | IBUS_CAP_AUXILIARY_TEXT | IBUS_CAP_LOOKUP_TABLE | IBUS_CAP_PROPERTY);
+    }
+
     if (context->capabilities != capabilities) {
         context->capabilities = capabilities;
 
index 671b7ce..8b1f16c 100644 (file)
@@ -174,6 +174,8 @@ void         ibus_input_context_set_cursor_location
  * @capabilities: Capabilities flags of IBusEngine, see #IBusCapabilite
  *
  * Set the capabilities flags of client application.
+ * When IBUS_CAP_FOCUS is not set, IBUS_CAP_PREEDIT_TEXT, IBUS_CAP_AUXILIARY_TEXT, IBUS_CAP_LOOKUP_TABLE, and IBUS_CAP_PROPERTY have to be all set.
+ * The panel component does nothing for an application that doesn't support focus.
  *
  * @see_also: #IBusEngine::set-capabilities
  */