Reduce the number of slot_*** signal calls in IME 63/118663/3
authorSungmin Kwak <sungmin.kwak@samsung.com>
Mon, 13 Mar 2017 12:31:52 +0000 (21:31 +0900)
committerInHong Han <inhong1.han@samsung.com>
Wed, 22 Mar 2017 07:08:49 +0000 (16:08 +0900)
Change-Id: I1fe19d2c5a5d95fec219247513d3c833a2cdd545

ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp

index bf56c86..de16f2e 100644 (file)
@@ -259,8 +259,9 @@ _wsc_im_ctx_content_type (void *data, struct wl_input_method_context *im_ctx, ui
     WSCContextISF *wsc_ctx = (WSCContextISF*)data;
     if (!wsc_ctx) return;
 
-    LOGD ("im_context = %p hint = %d purpose = %d\n", im_ctx, hint, purpose);
+    LOGD ("im_context = %p hint = %04x purpose = %d\n", im_ctx, hint, purpose);
 
+#if 0
     wsc_ctx->content_hint = hint;
     wsc_ctx->content_purpose = purpose;
 
@@ -272,6 +273,41 @@ _wsc_im_ctx_content_type (void *data, struct wl_input_method_context *im_ctx, ui
     isf_wsc_context_autocapital_type_set (wsc_ctx, wsc_context_autocapital_type_get (wsc_ctx));
 
     isf_wsc_context_input_panel_language_set (wsc_ctx, wsc_context_input_panel_language_get (wsc_ctx));
+#else
+    if (wsc_ctx->content_purpose != purpose) {
+        wsc_ctx->content_purpose = purpose;
+        isf_wsc_context_input_panel_layout_set (wsc_ctx,
+                                                wsc_context_input_panel_layout_get (wsc_ctx));
+    }
+
+    if (wsc_ctx->content_hint != hint) {
+        uint32_t old_hintbit, new_hintbit;
+
+        old_hintbit = wsc_ctx->content_hint & WL_TEXT_INPUT_CONTENT_HINT_AUTO_COMPLETION;
+        new_hintbit = hint & WL_TEXT_INPUT_CONTENT_HINT_AUTO_COMPLETION;
+        if (old_hintbit != new_hintbit) {
+            wsc_ctx->content_hint ^= new_hintbit;
+            g_info_manager->set_prediction_allow (WAYLAND_MODULE_CLIENT_ID, wsc_context_prediction_allow_get (wsc_ctx));
+        }
+
+        old_hintbit = wsc_ctx->content_hint & (WL_TEXT_INPUT_CONTENT_HINT_AUTO_CAPITALIZATION | WL_TEXT_INPUT_CONTENT_HINT_UPPERCASE | WL_TEXT_INPUT_CONTENT_HINT_WORD_CAPITALIZATION);
+        new_hintbit = hint & (WL_TEXT_INPUT_CONTENT_HINT_AUTO_CAPITALIZATION | WL_TEXT_INPUT_CONTENT_HINT_UPPERCASE | WL_TEXT_INPUT_CONTENT_HINT_WORD_CAPITALIZATION);
+        if (old_hintbit != new_hintbit) {
+            wsc_ctx->content_hint ^= new_hintbit;
+            isf_wsc_context_autocapital_type_set (wsc_ctx, wsc_context_autocapital_type_get (wsc_ctx));
+        }
+
+        old_hintbit = wsc_ctx->content_hint & WL_TEXT_INPUT_CONTENT_HINT_LATIN;
+        new_hintbit = hint & WL_TEXT_INPUT_CONTENT_HINT_LATIN;
+        if (old_hintbit != new_hintbit) {
+            wsc_ctx->content_hint ^= new_hintbit;
+            isf_wsc_context_input_panel_language_set (wsc_ctx, wsc_context_input_panel_language_get (wsc_ctx));
+        }
+
+        wsc_ctx->content_hint = hint;
+    }
+#endif
+
 #if ENABLE_REMOTE_INPUT
     isf_wsc_context_send_entry_metadata (wsc_ctx, wsc_context_input_hint_get (wsc_ctx), wsc_context_input_panel_layout_get (wsc_ctx),
         wsc_context_input_panel_layout_variation_get (wsc_ctx), wsc_context_autocapital_type_get (wsc_ctx), wsc_ctx->return_key_disabled);