Do not restore states when focus_in, if the enable is disabled.
authorPeng Huang <shawn.p.huang@gmail.com>
Fri, 12 Jun 2009 22:10:44 +0000 (06:10 +0800)
committerPeng Huang <shawn.p.huang@gmail.com>
Fri, 12 Jun 2009 22:10:44 +0000 (06:10 +0800)
bus/inputcontext.c

index 0881581979b22b493ac7c8536fc4e729a0c7d873..bec08c3509c6e895cfe838f8b8c6a74f36f75753 100644 (file)
@@ -1151,28 +1151,29 @@ bus_input_context_focus_in (BusInputContext *context)
 
     if (priv->capabilities & IBUS_CAP_FOCUS) {
         g_signal_emit (context, context_signals[FOCUS_IN], 0);
-
-        if (priv->preedit_visible && (priv->capabilities & IBUS_CAP_PREEDIT_TEXT) == 0) {
-            g_signal_emit (context,
-                           context_signals[UPDATE_PREEDIT_TEXT],
-                           0,
-                           priv->preedit_text,
-                           priv->preedit_cursor_pos,
-                           priv->preedit_visible);
-        }
-        if (priv->auxiliary_visible && (priv->capabilities & IBUS_CAP_AUXILIARY_TEXT) == 0) {
-            g_signal_emit (context,
-                           context_signals[UPDATE_AUXILIARY_TEXT],
-                           0,
-                           priv->auxiliary_text,
-                           priv->auxiliary_visible);
-        }
-        if (priv->auxiliary_visible && (priv->capabilities & IBUS_CAP_LOOKUP_TABLE) == 0) {
-            g_signal_emit (context,
-                           context_signals[UPDATE_LOOKUP_TABLE],
-                           0,
-                           priv->lookup_table,
-                           priv->lookup_table_visible);
+        if (priv->engine && priv->enabled) {
+            if (priv->preedit_visible && (priv->capabilities & IBUS_CAP_PREEDIT_TEXT) == 0) {
+                g_signal_emit (context,
+                               context_signals[UPDATE_PREEDIT_TEXT],
+                               0,
+                               priv->preedit_text,
+                               priv->preedit_cursor_pos,
+                               priv->preedit_visible);
+            }
+            if (priv->auxiliary_visible && (priv->capabilities & IBUS_CAP_AUXILIARY_TEXT) == 0) {
+                g_signal_emit (context,
+                               context_signals[UPDATE_AUXILIARY_TEXT],
+                               0,
+                               priv->auxiliary_text,
+                               priv->auxiliary_visible);
+            }
+            if (priv->lookup_table_visible && (priv->capabilities & IBUS_CAP_LOOKUP_TABLE) == 0) {
+                g_signal_emit (context,
+                               context_signals[UPDATE_LOOKUP_TABLE],
+                               0,
+                               priv->lookup_table,
+                               priv->lookup_table_visible);
+            }
         }
     }
 }