Reset some variables related to Remote Input on focus-out event
authorSungmin Kwak <sungmin.kwak@samsung.com>
Mon, 27 Feb 2017 07:36:30 +0000 (16:36 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 27 Feb 2017 23:50:27 +0000 (08:50 +0900)
Some interfaces might be called before focus-in event, so need to reset the variables on focus-out event.

Change-Id: I56c6023c83141d209c63bfd3b0a06cacbc640f40

ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp

index 580ccb3be1e697ba2956885dcbae1f2260c8a641..96672e13130929078d2b8d6fed66fc0dfbc13af6 100644 (file)
@@ -1319,9 +1319,18 @@ isf_wsc_context_focus_out (WSCContextISF *wsc_ctx)
         g_info_manager->remoteinput_callback_focus_out ();
 #endif
 
+        context_scim->impl->surrounding_text.clear ();
+        context_scim->impl->preedit_string.clear ();
+        context_scim->impl->preedit_attrlist.clear ();
+        context_scim->impl->commit_string.clear ();
+        context_scim->impl->preedit_caret = 0;
+        context_scim->impl->preedit_started = false;
+        context_scim->impl->need_commit_preedit = false;
+
         context_scim->impl->init_remote_entry_metadata = true;
         context_scim->impl->init_remote_surrounding_text = true;
         context_scim->impl->block_input_resource = true;
+        context_scim->impl->input_resource = INPUT_RESOURCE_NONE;
     }
     _x_key_event_is_valid = false;
 }
@@ -2374,10 +2383,14 @@ panel_slot_commit_string (int context, const WideString &wstr, bool remote_mode)
 
             if (ic->impl->panel_layout == ECORE_IMF_INPUT_PANEL_LAYOUT_URL)
                 wsc_context_delete_surrounding (ic, -ic->impl->cursor_pos, ic->impl->surrounding_text.length ());
+
+            wsc_context_commit_string (ic, utf8_wcstombs (wstr).c_str ());
+            ic->impl->need_commit_preedit = false;
+            ic->impl->preedit_string.clear ();
         } else {
             check_input_resource (ic, INPUT_RESOURCE_LOCAL);
+            wsc_context_commit_string (ic, utf8_wcstombs (wstr).c_str ());
         }
-        wsc_context_commit_string (ic, utf8_wcstombs (wstr).c_str ());
     }
 }