Merge from opensource
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 4 Feb 2013 07:48:57 +0000 (16:48 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 28 Jun 2013 07:54:32 +0000 (16:54 +0900)
Change-Id: If5133140e44fa5a7b3895afdb94b3abb595c6975

packaging/ise-engine-hangul.spec
src/scim_hangul_imengine.cpp
src/scim_hangul_imengine.h
src/scim_hangul_imengine_setup.cpp

index 031ae1b..bb6a53a 100644 (file)
@@ -1,7 +1,7 @@
 Name:       ise-engine-hangul
 Summary:    Hangul Input Method Engine for ISF
 Version:    0.4.0
-Release:    1
+Release:    2
 Group:      System Environment/Libraries
 License:    GPL
 Source0:    %{name}-%{version}.tar.gz
index 14ee3d2..800bc5d 100644 (file)
@@ -87,8 +87,6 @@ static ConfigPointer _scim_config (0);
 static Property hangul_mode(SCIM_PROP_HANGUL_MODE, "");
 static Property hanja_mode(SCIM_PROP_HANJA_MODE, "");
 
-static bool auto_reorder = true;
-
 extern "C" {
     void scim_module_init (void)
     {
@@ -134,6 +132,7 @@ HangulFactory::HangulFactory (const ConfigPointer &config)
     m_show_candidate_comment = true;
     m_use_ascii_mode = false;
     m_commit_by_word = false;
+    m_auto_reorder = true;
 
     m_hanja_table = hanja_table_load(NULL);
     m_symbol_table = NULL;
@@ -239,8 +238,8 @@ HangulFactory::reload_config(const ConfigPointer &config)
                                    false);
     m_hanja_mode = config->read(String(SCIM_CONFIG_HANJA_MODE),
                                    false);
-    auto_reorder = config->read(String(SCIM_CONFIG_AUTO_REORDER),
-                                   auto_reorder);
+    m_auto_reorder = config->read(String(SCIM_CONFIG_AUTO_REORDER),
+                                    true);
 
     String str;
     str = config->read(String(SCIM_CONFIG_HANGUL_KEY),
@@ -266,27 +265,6 @@ HangulFactory::create_instance (const String &encoding, int id)
     return new HangulInstance (this, encoding, id);
 }
 
-static bool
-hangul_engine_on_transition (HangulInputContext     *hic,
-                             ucschar                 c,
-                             const ucschar          *preedit,
-                             void                   *data)
-{
-    if (!auto_reorder) {
-        if (hangul_is_choseong (c)) {
-            if (hangul_ic_has_jungseong (hic) || hangul_ic_has_jongseong (hic))
-                return false;
-        }
-
-        if (hangul_is_jungseong (c)) {
-            if (hangul_ic_has_jongseong (hic))
-                return false;
-        }
-    }
-
-    return true;
-}
-
 HangulInstance::HangulInstance (HangulFactory *factory,
                                 const String  &encoding,
                                 int            id)
@@ -296,7 +274,7 @@ HangulInstance::HangulInstance (HangulFactory *factory,
       m_output_mode (OUTPUT_MODE_SYLLABLE)
 {
     m_hic = hangul_ic_new(factory->m_keyboard_layout.c_str());
-    hangul_ic_connect_callback (m_hic, "transition", (void *)hangul_engine_on_transition, NULL);
+    hangul_ic_connect_callback (m_hic, "transition", (void *)on_transition, this);
 
     char label[16];
     std::vector <WideString> labels;
@@ -917,4 +895,27 @@ HangulInstance::register_all_properties()
     register_properties(proplist);
 }
 
-//vim: ts=4:nowrap:ai:expandtab:
+bool
+HangulInstance::on_transition (HangulInputContext     *hic,
+                               ucschar                 c,
+                               const ucschar          *preedit,
+                               void                   *data)
+{
+    HangulInstance *self = reinterpret_cast<HangulInstance*>(data);
+
+    if (!self->m_factory->m_auto_reorder) {
+        if (hangul_is_choseong (c)) {
+            if (hangul_ic_has_jungseong (hic) || hangul_ic_has_jongseong (hic))
+                return false;
+        }
+
+        if (hangul_is_jungseong (c)) {
+            if (hangul_ic_has_jongseong (hic))
+                return false;
+        }
+    }
+
+    return true;
+}
+
+// vim: sts=4 sw=4 nowrap ai expandtab
index ed55be3..7bacea3 100644 (file)
@@ -61,6 +61,7 @@ class HangulFactory : public IMEngineFactoryBase
     bool                     m_use_ascii_mode;
     bool                     m_commit_by_word;
     bool                     m_hanja_mode;
+    bool                     m_auto_reorder;
 
     KeyEventList             m_hangul_keys;
     KeyEventList             m_hanja_keys;
@@ -193,6 +194,12 @@ private:
 
     /* match key event */
     bool   match_key_event (const KeyEventList &keys, const KeyEvent &key) const;
+
+    /* callback from libhangul */
+    static bool on_transition (HangulInputContext *hic,
+                               ucschar c,
+                               const ucschar *preedit,
+                               void *data);
 };
 #endif
 
index b929b48..94b33a7 100644 (file)
@@ -309,10 +309,10 @@ create_options_page(GtkTooltips *tooltips)
     gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
 #if GTK_CHECK_VERSION(2, 12, 0)
     gtk_widget_set_tooltip_text(button,
-            _("Whether to allow auto reorder between jungseong and choseong."));
+            _("Whether to reorder jamo automatically, if they are in wrong order."));
 #else
     gtk_tooltips_set_tip(tooltips, button,
-                          _("Whether to allow auto reorder between jungseong and choseong."), NULL);
+            _("Whether to reorder jamo automatically, if they are in wrong order."));
 #endif
     g_signal_connect(G_OBJECT(button), "toggled",
                      G_CALLBACK(on_default_toggle_button_toggled), NULL);