Reform remote control event sequence 83/116783/2
authorSungmin Kwak <sungmin.kwak@samsung.com>
Tue, 28 Feb 2017 08:23:41 +0000 (17:23 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 2 Mar 2017 07:02:58 +0000 (23:02 -0800)
Try to call TEXT_UPDATED event callback at last when starting the remote input
Avoid calling TEXT_UPDATED event callback during the remote input

Change-Id: I6f107575d3820aaa717f87398234717cc31a831d

ism/modules/panelagent/wayland/isf_wsc_context.h
ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp

index f9779d0..de2d6af 100644 (file)
@@ -108,6 +108,7 @@ struct _WSCContextISF {
     uint32_t caps_mode;
 
     Eina_Bool return_key_disabled;
+    Eina_Bool input_panel_shown;
 
     WSCContextISFImpl *impl;
 
@@ -130,6 +131,7 @@ struct _WSCContextISF {
                        bidi_direction(0),
                        caps_mode(0),
                        return_key_disabled(EINA_FALSE),
+                       input_panel_shown(EINA_FALSE),
                        impl(NULL),
                        id(0),
                        next(NULL)
index 36a1d14..6744aa4 100644 (file)
@@ -776,6 +776,10 @@ _wsc_im_show_input_panel (void *data, struct wl_input_method *input_method, stru
     if (!wsc || !wsc->wsc_ctx) return;
 
     isf_wsc_context_input_panel_show (wsc->wsc_ctx);
+    wsc->wsc_ctx->input_panel_shown = true;
+#if ENABLE_REMOTE_INPUT
+    remote_surrounding_get (wsc->wsc_ctx);
+#endif
 }
 
 static void
@@ -785,6 +789,7 @@ _wsc_im_hide_input_panel (void *data, struct wl_input_method *input_method, stru
     if (!wsc || !wsc->wsc_ctx) return;
 
     isf_wsc_context_input_panel_hide (wsc->wsc_ctx);
+    wsc->wsc_ctx->input_panel_shown = false;
 }
 
 static const struct wl_input_method_listener wsc_im_listener = {
@@ -1446,17 +1451,20 @@ isf_wsc_context_send_surrounding_text (WSCContextISF* wsc_ctx, const char *text,
     if (!conv_text)
         return;
 
-    if ((!context_scim->impl->init_remote_surrounding_text || strcmp (conv_text, text) != 0 || context_scim->impl->cursor_pos != cursor)) {
+    if (!context_scim->impl->init_remote_surrounding_text || strcmp (conv_text, text) != 0 || context_scim->impl->cursor_pos != cursor) {
         SECURE_LOGD("remote surrounding text : \"%s\"\n", text);
         context_scim->impl->surrounding_text = utf8_mbstowcs (String (text));
         context_scim->impl->cursor_pos = cursor;
 
 #if ENABLE_REMOTE_INPUT
-        String _text(text);
-        g_info_manager->remoteinput_callback_surrounding_text (_text, context_scim->impl->cursor_pos);
-#endif
-
+        if (context_scim->input_panel_shown && context_scim->impl->input_resource != INPUT_RESOURCE_REMOTE) {
+            String _text(text);
+            g_info_manager->remoteinput_callback_surrounding_text (_text, context_scim->impl->cursor_pos);
+            context_scim->impl->init_remote_surrounding_text = true;
+        }
+#else
         context_scim->impl->init_remote_surrounding_text = true;
+#endif
     }
     free (conv_text);
 }
@@ -1474,6 +1482,11 @@ isf_wsc_context_send_entry_metadata (WSCContextISF* wsc_ctx, Ecore_IMF_Input_Hin
         if (!context_scim->impl->init_remote_entry_metadata || (context_scim->impl->input_hint != hint || context_scim->impl->panel_layout != layout ||
             context_scim->impl->variation != variation || context_scim->impl->autocapital_type != type ||
             context_scim->impl->return_key_disabled != return_key_disabled)) {
+            if (context_scim->impl->panel_layout != layout || context_scim->impl->variation != variation) {
+                if (context_scim->impl->input_resource == INPUT_RESOURCE_REMOTE)
+                    context_scim->impl->input_resource = INPUT_RESOURCE_NONE;
+            }
+
             context_scim->impl->input_hint = hint;
             context_scim->impl->panel_layout = layout;
             context_scim->impl->variation = variation;