Flush in case of S/W keyboard needed 65/92765/4
authorLi Zhang <li2012.zhang@samsung.com>
Tue, 18 Oct 2016 11:53:10 +0000 (19:53 +0800)
committerLi Zhang <li2012.zhang@samsung.com>
Tue, 18 Oct 2016 12:31:52 +0000 (20:31 +0800)
Change-Id: I46a307bb4991d074ad0be25f640c9e3759976f5c

wrapper/scim/src/sunpinyin_imengine.cpp
wrapper/scim/src/sunpinyin_imengine.h

index 5c3a129..6d4ca8c 100644 (file)
@@ -7,12 +7,12 @@
  * Distribution License ("CDDL")(collectively, the "License"). You may not use this
  * file except in compliance with the License. You can obtain a copy of the CDDL at
  * http://www.opensource.org/licenses/cddl1.php and a copy of the LGPLv2.1 at
- * http://www.opensource.org/licenses/lgpl-license.php. See the License for the 
+ * http://www.opensource.org/licenses/lgpl-license.php. See the License for the
  * specific language governing permissions and limitations under the License. When
  * distributing the software, include this License Header Notice in each file and
  * include the full text of the License in the License file as well as the
  * following notice:
- * 
+ *
  * NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
  * (CDDL)
  * For Covered Software in this distribution, this License shall be governed by the
@@ -20,9 +20,9 @@
  * Any litigation relating to this License shall be subject to the jurisdiction of
  * the Federal Courts of the Northern District of California and the state courts
  * of the State of California, with venue lying in Santa Clara County, California.
- * 
+ *
  * Contributor(s):
- * 
+ *
  * If you wish your version of this file to be governed by only the CDDL or only
  * the LGPL Version 2.1, indicate your decision by adding "[Contributor]" elects to
  * include this software in this distribution under the [CDDL or LGPL Version 2.1]
@@ -31,7 +31,7 @@
  * Version 2.1, or to extend the choice of license to its licensees as provided
  * above. However, if you add LGPL Version 2.1 code and therefore, elected the LGPL
  * Version 2 license, then the option applies only if the new code is made subject
- * to such option by the copyright holder. 
+ * to such option by the copyright holder.
  *
  * Modifications by Samsung Electronics Co., Ltd.
  *
 #define SCIM_FULL_PUNCT_ICON               (SCIM_ICONDIR "/full-punct.png")
 #define SCIM_HALF_PUNCT_ICON               (SCIM_ICONDIR "/half-punct.png")
 
+#define ISE_DEFAULT_FLUSH_EVENT_CMD 1001
+
 using namespace scim;
 
-static IMEngineFactoryPointer _scim_pinyin_factory (0); 
+static IMEngineFactoryPointer _scim_pinyin_factory (0);
 
 static ConfigPointer _scim_config (0);
 
@@ -127,7 +129,7 @@ extern "C" {
         SCIM_DEBUG_IMENGINE (3) << "module_init\n";
         _status_property.set_tip (_("The status of the current input method. Click to change it."));
         _status_property.set_label ("英");
-        
+
         _letter_property.set_icon (SCIM_HALF_LETTER_ICON);
         _letter_property.set_tip (_("The input mode of the letters. Click to toggle between half and full."));
         _letter_property.set_label (_("Full/Half Letter"));
@@ -145,7 +147,7 @@ extern "C" {
         SCIM_DEBUG_IMENGINE (3) << "entering scim_imengine_module_create_factory()\n";
         if (engine != 0) return IMEngineFactoryPointer (0);
         if (_scim_pinyin_factory.null ()) {
-            SunPyFactory *factory = new SunPyFactory (_scim_config); 
+            SunPyFactory *factory = new SunPyFactory (_scim_config);
             if (factory->valid ())
                 _scim_pinyin_factory = factory;
             else
@@ -172,11 +174,11 @@ bool
 SunPyFactory::init ()
 {
     bool valid = true;
-    
+
     if (m_config) {
         valid = load_user_config();
     }
-    
+
     // postpone the load_user_data() to the ctor of SunPyInstance
     return valid;
 }
@@ -251,7 +253,7 @@ SunPyFactory::get_icon_file () const
 IMEngineInstancePointer
 SunPyFactory::create_instance (const String& encoding, int id)
 {
-    SCIM_DEBUG_IMENGINE (3) <<  "SunPyFactory::create_instance(" << id << ")\n";    
+    SCIM_DEBUG_IMENGINE (3) <<  "SunPyFactory::create_instance(" << id << ")\n";
     return new SunPyInstance (this, m_hotkey_profile, encoding, id);
 }
 
@@ -311,11 +313,11 @@ SunPyInstance::process_key_event (const KeyEvent& key)
         key.code << ", " <<
         key.mask << ", " <<
         key.layout << ")\n";
-        
+
     if (!m_focused) return false;
 
     CKeyEvent ev = translate_key(key);
-    
+
     if ( !m_pv->getStatusAttrValue(CScimWinHandler::STATUS_ID_CN) ) {
         // we are in English input mode
         if ( !m_hotkey_profile->isModeSwitchKey(ev) ) {
@@ -412,12 +414,12 @@ SunPyInstance::focus_in ()
     m_focused = true;
     //show_lookup_table ();
     initialize_all_properties ();
-    
+
     hide_preedit_string ();
     //hide_aux_string ();
-    
+
     init_lookup_table_labels ();
-    
+
     //hide_aux_string ();
 
     m_pv->updateWindows(CIMIView::PREEDIT_MASK | CIMIView::CANDIDATE_MASK);
@@ -441,7 +443,7 @@ void
 SunPyInstance::trigger_property (const String &property)
 {
     SCIM_DEBUG_IMENGINE (3) << get_id() << ": trigger_property(" << property << ")\n";
-    
+
     if (property == SCIM_PROP_STATUS) {
         const int is_CN = m_pv->getStatusAttrValue(CIMIWinHandler::STATUS_ID_CN);
         m_pv->setStatusAttrValue(CIMIWinHandler::STATUS_ID_CN, is_CN?0:1);
@@ -490,7 +492,7 @@ SunPyInstance::refresh_all_properties ()
                        m_pv->getStatusAttrValue(CIMIWinHandler::STATUS_ID_CN));
     m_wh->updateStatus(CIMIWinHandler::STATUS_ID_FULLPUNC,
                        m_pv->getStatusAttrValue(CIMIWinHandler::STATUS_ID_FULLPUNC));
-    m_wh->updateStatus(CIMIWinHandler::STATUS_ID_FULLSYMBOL, 
+    m_wh->updateStatus(CIMIWinHandler::STATUS_ID_FULLSYMBOL,
                        m_pv->getStatusAttrValue(CIMIWinHandler::STATUS_ID_FULLSYMBOL));
 }
 
@@ -536,7 +538,7 @@ SunPyInstance::create_session(CHotkeyProfile *hotkey_profile)
         SCIM_DEBUG_IMENGINE (3) << get_id() <<  " factory.createSession() failed\n";
         return;
     }
-    
+
     m_pv->setHotkeyProfile(hotkey_profile);
 
     m_lookup_table = new SunLookupTable();
@@ -553,14 +555,14 @@ void
 SunPyInstance::destroy_session()
 {
     SCIM_DEBUG_IMENGINE (3) << get_id() <<  ": destroy_session()\n";
-    
+
     // wh and ic are not pointers, I don't think it's necessary to delete them
     // either
     delete m_pv;
     delete m_wh;
     delete m_lookup_table;
     delete m_common_lookup_table;
-    
+
     m_pv = 0;
     m_wh = 0;
     m_lookup_table = 0;
@@ -640,3 +642,20 @@ SunPyInstance::reload_config(const ConfigPointer &config)
         m_factory->load_user_config();
     }
 }
+
+void
+SunPyInstance::process_helper_event (const String &helper_uuid,
+                                     const Transaction &recv)
+{
+    TransactionReader reader (recv);
+    int cmd;
+
+    if (!reader.get_command (cmd))
+        return;
+
+    switch (cmd) {
+    case ISE_DEFAULT_FLUSH_EVENT_CMD:
+        flush ();
+        break;
+    }
+}
index 299e425..47d6c8a 100755 (executable)
@@ -7,12 +7,12 @@
  * Distribution License ("CDDL")(collectively, the "License"). You may not use this
  * file except in compliance with the License. You can obtain a copy of the CDDL at
  * http://www.opensource.org/licenses/cddl1.php and a copy of the LGPLv2.1 at
- * http://www.opensource.org/licenses/lgpl-license.php. See the License for the 
+ * http://www.opensource.org/licenses/lgpl-license.php. See the License for the
  * specific language governing permissions and limitations under the License. When
  * distributing the software, include this License Header Notice in each file and
  * include the full text of the License in the License file as well as the
  * following notice:
- * 
+ *
  * NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
  * (CDDL)
  * For Covered Software in this distribution, this License shall be governed by the
@@ -20,9 +20,9 @@
  * Any litigation relating to this License shall be subject to the jurisdiction of
  * the Federal Courts of the Northern District of California and the state courts
  * of the State of California, with venue lying in Santa Clara County, California.
- * 
+ *
  * Contributor(s):
- * 
+ *
  * If you wish your version of this file to be governed by only the CDDL or only
  * the LGPL Version 2.1, indicate your decision by adding "[Contributor]" elects to
  * include this software in this distribution under the [CDDL or LGPL Version 2.1]
@@ -31,7 +31,7 @@
  * Version 2.1, or to extend the choice of license to its licensees as provided
  * above. However, if you add LGPL Version 2.1 code and therefore, elected the LGPL
  * Version 2 license, then the option applies only if the new code is made subject
- * to such option by the copyright holder. 
+ * to such option by the copyright holder.
  *
  * Modifications by Samsung Electronics Co., Ltd.
  *
@@ -55,7 +55,7 @@ class SunPyFactory : public IMEngineFactoryBase
     CHotkeyProfile     *m_hotkey_profile;
 
     friend class SunPyInstance;
-    
+
 public:
     SunPyFactory (const ConfigPointer &config);
 
@@ -69,11 +69,11 @@ public:
     virtual String      get_icon_file () const;
 
     virtual IMEngineInstancePointer create_instance (const String& encoding, int id = -1);
-    
+
 public:
     bool valid () const { return m_valid; }
     void reload_config(const ConfigPointer& config);
-    
+
 private:
     bool init ();
     bool load_user_config ();
@@ -90,7 +90,7 @@ class SunPyInstance : public IMEngineInstanceBase
     Connection           m_reload_signal_connection;
     bool                 m_focused;
     bool                 m_lookup_table_always_on;
-    
+
   public:
     SunPyInstance(SunPyFactory *factory,
                   CHotkeyProfile *hotkey_profile,
@@ -124,6 +124,7 @@ class SunPyInstance : public IMEngineInstanceBase
      * decide whether to display candidate window according to layout
      */
     virtual void set_layout (unsigned int layout);
+    virtual void process_helper_event (const String &helper_uuid, const Transaction &trans);
 
 public:
     /**
@@ -131,7 +132,7 @@ public:
      * so that CScimWinHandler can call it
      */
     using IMEngineInstanceBase::commit_string;
-    
+
     void refresh_status_property(bool cn);
     void refresh_fullsymbol_property(bool full);
     void refresh_fullpunc_property(bool full);
@@ -141,12 +142,12 @@ public:
 private:
     void create_session(CHotkeyProfile*);
     void destroy_session();
-    
+
     void init_lookup_table_labels ();
     void reload_config (const ConfigPointer &config);
     void refresh_all_properties ();
     void initialize_all_properties();
-    
+
     AttributeList build_preedit_attribs(const IPreeditString* ppd);
 
     void lookup_page_up();