Use inputmethod API 61/113261/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 7 Feb 2017 05:10:03 +0000 (14:10 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 7 Feb 2017 05:10:03 +0000 (14:10 +0900)
Change-Id: I98b9c2e1e48e9e208fa14b48afaf0165cffc750e
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
CMakeLists.txt
packaging/ise-default.spec
src/include/ise.h
src/ise-language-change.cpp
src/ise.cpp
src/option.cpp
src/sdk/sdk.cpp

index d93b47f..2a0e0d7 100644 (file)
@@ -53,14 +53,13 @@ SET(PKGS_CHECK_MODULES
         efl-extension
         dlog
         libscl-ui
-        libscl-core
         ecore-imf
-        isf
         vconf
         libxml-2.0
         stt
         capi-appfw-application
         capi-media-audio-io
+        capi-ui-inputmethod
         )
 
 IF (with_cbhm)
index a666167..4e91114 100644 (file)
@@ -15,11 +15,9 @@ BuildRequires:  gettext-tools
 BuildRequires:  edje-bin
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(elementary)
-BuildRequires:  pkgconfig(isf)
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(libscl-ui)
-BuildRequires:  pkgconfig(libscl-core)
 BuildRequires:  pkgconfig(ecore-imf)
 BuildRequires:  pkgconfig(libxml-2.0)
 BuildRequires:  pkgconfig(efl-extension)
@@ -27,6 +25,7 @@ BuildRequires:  pkgconfig(libtzplatform-config)
 BuildRequires:  pkgconfig(stt)
 BuildRequires:  pkgconfig(capi-appfw-application)
 BuildRequires:  pkgconfig(capi-media-audio-io)
+BuildRequires:  pkgconfig(capi-ui-inputmethod)
 %if "%{WITH_CBHM}" == "TRUE"
 BuildRequires:  pkgconfig(cbhm)
 %endif
index 519760c..2937db3 100644 (file)
@@ -167,7 +167,6 @@ const ISE_DEFAULT_VALUES g_ise_default_values[ISE_LAYOUT_STYLE_MAX] = {
 
 #define IMDATA_ACTION_DISABLE_EMOTICONS 0x0040
 
-
 typedef struct {
     int ic;
     int focused_ic;
@@ -185,8 +184,8 @@ using namespace scl;
 
 class CCoreEventCallback : public ISCLCoreEventCallback
 {
+public:
     void on_init();
-    void on_run(int argc, char **argv);
     void on_exit();
 
     void on_attach_input_context(sclint ic, const sclchar *ic_uuid);
index d2441f7..83bb3ea 100755 (executable)
@@ -18,6 +18,7 @@
 #include "ise-language-change.h"
 #include "ise.h"
 #include <dlog.h>
+#include <inputmethod.h>
 #undef LOG_TAG
 #define LOG_TAG "ISE_DEFAULT"
 
@@ -62,11 +63,6 @@ static Evas_Object *scroller = NULL;
 static Evas_Object *img_arrow_left = NULL;
 static Evas_Object *img_arrow_right = NULL;
 
-
-/* Extern Variables start here */
-extern CSCLCore g_core;
-/* Extern Variables end here */
-
 static ISELanguageManager _language_manager;
 
 static Eina_Bool __ise_space_flick_lang_popup_move_cb(void *data, int type, void *event_info);
@@ -107,7 +103,7 @@ void ise_show_space_flick_language_change_popup(short int space_button_x, short
     int xPos = lang_popup_x;
     int yPos = lang_popup_y;
 
-    win = elm_bg_add(NATIVE_WINDOW_CAST(g_core.get_main_window()));
+    win = elm_bg_add(NATIVE_WINDOW_CAST(ime_get_main_window()));
     Evas_Object *image_ob = evas_object_image_add(evas_object_evas_get(win));
     evas_object_image_file_set(image_ob, IMG_POPUP_FC_BG, NULL);
     evas_object_image_border_set(image_ob, 1, 1, 1, 1);
index 334252c..db9d11f 100644 (file)
@@ -15,8 +15,6 @@
  *
  */
 
-#define Uses_SCIM_ATTRIBUTE
-
 #include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <vconf.h>
 #include <Ecore_IMF.h>
 #include <Elementary.h>
-#include <scim.h>
+#include <sclui.h>
+#include <sclutils.h>
+#include <inputmethod.h>
+#include <inputmethod_internal.h>
 #ifdef HAVE_CBHM
 #include <cbhm.h>
 #endif
-#include <sclui.h>
-#include <sclcore.h>
-#include <sclutils.h>
 
 #include "ise.h"
 #include "utils.h"
@@ -44,6 +42,8 @@
 #include "ise-language-change.h"
 #include "modeindicator.h"
 
+#define EXPORTED __attribute__((visibility("default")))
+
 #define CANDIDATE_WINDOW_HEIGHT 84
 using namespace scl;
 #include <vector>
@@ -56,7 +56,6 @@ static cbhm_h cbhm_handle;
 #endif
 
 static CCoreEventCallback g_core_event_callback;
-CSCLCore g_core(&g_core_event_callback);
 int g_imdata_state = 0;
 
 extern emoticon_group_t current_emoticon_group;
@@ -83,6 +82,8 @@ static Ecore_Timer *g_softcandidate_hide_timer = NULL;
 
 extern sclboolean g_setting_window_open_status;
 
+static int g_ic = 0;
+
 KEYBOARD_STATE g_keyboard_state = {
     0,
     0,
@@ -120,7 +121,7 @@ class CandidateEventListener: public EventListener
             const MultiEventDesc &multidesc = dynamic_cast<const MultiEventDesc &>(desc);
             switch (multidesc.type) {
                 case MultiEventDesc::CANDIDATE_ITEM_MOUSE_DOWN:
-                    g_core.select_candidate(multidesc.index);
+                    ime_select_candidate(multidesc.index);
                     break;
                 case MultiEventDesc::CANDIDATE_MORE_VIEW_SHOW:
                     // when more parts shows, click on the candidate will
@@ -344,7 +345,7 @@ static void add_softcandidate_hide_timer(void)
 static void create_softcandidate(void)
 {
     if (!g_candidate) {
-        g_candidate = CandidateFactory::make_candidate(CANDIDATE_MULTILINE, g_core.get_main_window());
+        g_candidate = CandidateFactory::make_candidate(CANDIDATE_MULTILINE, ime_get_main_window());
         if (g_candidate) {
             g_candidate->add_event_listener(&g_candidate_event_listener);
         }
@@ -361,12 +362,6 @@ void CCoreEventCallback::on_init()
 #endif
 }
 
-void CCoreEventCallback::on_run(int argc, char **argv)
-{
-    LOGD("CCoreEventCallback::on_run()\n");
-    g_core.run();
-}
-
 void CCoreEventCallback::on_exit()
 {
     ::ise_hide();
@@ -479,14 +474,14 @@ void CCoreEventCallback::on_set_rotation_degree(sclint degree)
         ise_hide_stt_mode();
     }
     if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_EMOTICON) {
-        ise_show_emoticon_layout(current_emoticon_group, degree, false, g_core.get_main_window());
+        ise_show_emoticon_layout(current_emoticon_group, degree, false, ime_get_main_window());
     } else if (g_ui) {
         const sclchar *input_mode = g_ui->get_input_mode();
         if (input_mode) {
             if (!(strcmp(input_mode, "EMOTICON_LAYOUT")))
-                ise_show_emoticon_layout(current_emoticon_group, degree, false, g_core.get_main_window());
+                ise_show_emoticon_layout(current_emoticon_group, degree, false, ime_get_main_window());
             else if (!(strcmp(input_mode, "STT_3X4")))
-                ise_show_stt_mode(NATIVE_WINDOW_CAST(g_core.get_main_window()));
+                ise_show_stt_mode(NATIVE_WINDOW_CAST(ime_get_main_window()));
         }
     }
 }
@@ -520,7 +515,7 @@ void CCoreEventCallback::on_update_cursor_position(sclint ic, const sclchar *ic_
 void CCoreEventCallback::on_update_surrounding_text(sclint ic, const sclchar *text, sclint cursor)
 {
     LOGD("surrounding text:%s, cursor=%d\n", text, cursor);
-    g_core.delete_surrounding_text(-cursor, strlen(text));
+    ime_delete_surrounding_text(-cursor, strlen(text));
 }
 
 void CCoreEventCallback::on_set_return_key_type(sclu32 type)
@@ -604,7 +599,7 @@ void CCoreEventCallback::on_candidate_show(sclint ic, const sclchar *ic_uuid)
             SclSize size_landscape = g_ui->get_input_mode_size(g_ui->get_input_mode(), DISPLAYMODE_LANDSCAPE);
             size_portrait.height += g_candidate->get_height();
             size_landscape.height += g_candidate->get_height();
-            g_core.set_keyboard_size_hints(size_portrait, size_landscape);
+            ime_set_size(size_portrait.width, size_portrait.height, size_landscape.width, size_landscape.height);
 
             LOGD("Showing candidate , position [%d %d] size [%d %d] [%d %d]", 0, g_candidate->get_height(),
                 size_portrait.width, size_portrait.height, size_landscape.width, size_landscape.height);
@@ -626,7 +621,7 @@ void CCoreEventCallback::on_candidate_hide(sclint ic, const sclchar *ic_uuid)
         g_ui->set_custom_starting_coordinates(0, 0);
         SclSize size_portrait = g_ui->get_input_mode_size(g_ui->get_input_mode(), DISPLAYMODE_PORTRAIT);
         SclSize size_landscape = g_ui->get_input_mode_size(g_ui->get_input_mode(), DISPLAYMODE_LANDSCAPE);
-        g_core.set_keyboard_size_hints(size_portrait, size_landscape);
+        ime_set_size(size_portrait.width, size_portrait.height, size_landscape.width, size_landscape.height);
 
         LOGD("Hiding candidate , position [%d %d] size [%d %d] [%d %d]", 0, 0,
             size_portrait.width, size_portrait.height, size_landscape.width, size_landscape.height);
@@ -753,7 +748,7 @@ ise_send_string(const sclchar *key_value)
     if (!check_ic_temporary(g_keyboard_state.ic)) {
         ic = g_keyboard_state.ic;
     }
-    g_core.commit_string(ic, "", key_value);
+    ime_commit_string(key_value);
     LOGD("ic : %x, %s\n", ic, key_value);
 }
 
@@ -764,6 +759,9 @@ void
 ise_update_preedit_string(const sclchar *str, const sclboolean underline)
 {
     int ic = -1;
+    Eina_List *attr_list = NULL;
+    ime_preedit_attribute *preedit_attr;
+
     if (!check_ic_temporary(g_keyboard_state.ic)) {
         ic = g_keyboard_state.ic;
     }
@@ -772,16 +770,17 @@ ise_update_preedit_string(const sclchar *str, const sclboolean underline)
         int len = 0;
         const sclchar *s = str;
         while (*s) len += (*s++ & 0xc0) != 0x80;
-        scim::Attribute attr;
-        attr.set_start(0);
-        attr.set_length(len);
-        attr.set_type(scim::SCIM_ATTR_DECORATE);
-        attr.set_value(scim::SCIM_ATTR_DECORATE_UNDERLINE);
-        std::vector<scim::Attribute> underline_attribute;
-        underline_attribute.push_back(attr);
-        g_core.update_preedit_string(ic, "", str, underline_attribute);
+
+        preedit_attr = (ime_preedit_attribute *)calloc(1, sizeof(ime_preedit_attribute));
+        preedit_attr->start = 0;
+        preedit_attr->length = len;
+        preedit_attr->type = IME_ATTR_FONTSTYLE;
+        preedit_attr->value = IME_ATTR_FONTSTYLE_UNDERLINE;
+        attr_list = eina_list_append(attr_list, (void *)preedit_attr);
+
+        ime_update_preedit_string(str, attr_list);
     } else {
-        g_core.update_preedit_string(ic, "", str);
+        ime_update_preedit_string(str, NULL);
     }
     LOGD("ic : %x, %s\n", ic, str);
 }
@@ -796,8 +795,9 @@ ise_send_event(sclulong key_event, sclulong key_mask)
     if (!check_ic_temporary(g_keyboard_state.ic)) {
         ic = g_keyboard_state.ic;
     }
-    g_core.send_key_event(ic, "", key_event, KEY_MASK_NULL);
-    g_core.send_key_event(ic, "", key_event, KEY_MASK_RELEASE);
+    ime_send_key_event((ime_key_code_e)key_event, IME_KEY_MASK_PRESSED, false);
+    ime_send_key_event((ime_key_code_e)key_event, IME_KEY_MASK_RELEASED, false);
+
     LOGD("ic : %x, %x\n", ic, key_event);
 }
 
@@ -811,8 +811,9 @@ ise_forward_key_event(sclulong key_event)
     if (!check_ic_temporary(g_keyboard_state.ic)) {
         ic = g_keyboard_state.ic;
     }
-    g_core.forward_key_event(ic, "", key_event, KEY_MASK_NULL);
-    g_core.forward_key_event(ic, "", key_event, KEY_MASK_RELEASE);
+    ime_send_key_event((ime_key_code_e)key_event, IME_KEY_MASK_PRESSED, true);
+    ime_send_key_event((ime_key_code_e)key_event, IME_KEY_MASK_RELEASED, true);
+
     LOGD("ic : %x, %x\n", ic, key_event);
 }
 
@@ -839,7 +840,7 @@ static void delete_commit_timer(void)
 static Eina_Bool commit_timeout(void *data)
 {
     if (_commit_timer != NULL) {
-        g_core.hide_preedit_string(-1, "");
+        ime_hide_preedit_string();
         ise_forward_key_event(_sig_dec_event[(_click_count-1)%SIG_DEC_SIZE]);
         _click_count = 0;
     }
@@ -893,7 +894,7 @@ on_input_mode_changed(const sclchar *key_value, sclulong key_event, sclint key_t
                     current_emoticon_group = EMOTICON_GROUP_RECENTLY_USED;
 #endif
                 SCLRotation rotation = g_ui->get_rotation();
-                ise_show_emoticon_layout(current_emoticon_group, ROTATION_TO_DEGREE(rotation), false, g_core.get_main_window());
+                ise_show_emoticon_layout(current_emoticon_group, ROTATION_TO_DEGREE(rotation), false, ime_get_main_window());
             }
         }
     }
@@ -977,7 +978,7 @@ SCLEventReturnType CUIEventCallback::on_event_notification(SCLUINotiType noti_ty
                 size_portrait.height += g_candidate->get_height();
                 size_landscape.height += g_candidate->get_height();
             }
-            g_core.set_keyboard_size_hints(size_portrait, size_landscape);
+            ime_set_size(size_portrait.width, size_portrait.height, size_landscape.width, size_landscape.height);
 
             if (strcmp(g_ui->get_input_mode(), "STT_3X4") == 0 &&
                 strcmp(desc->input_mode, "STT_3X4") != 0) {
@@ -985,7 +986,7 @@ SCLEventReturnType CUIEventCallback::on_event_notification(SCLUINotiType noti_ty
             }
             if (strcmp(g_ui->get_input_mode(), "STT_3X4") != 0 &&
                 strcmp(desc->input_mode, "STT_3X4") == 0) {
-                ise_show_stt_mode(NATIVE_WINDOW_CAST(g_core.get_main_window()));
+                ise_show_stt_mode(NATIVE_WINDOW_CAST(ime_get_main_window()));
             }
         }
     }
@@ -1072,8 +1073,8 @@ SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_d
                 }
                 if (input_mode && strcmp (input_mode, "NUMONLY_3X4_SIGDEC") == 0 &&
                     strcmp(event_desc.key_value, ".") == 0) {
-                    g_core.update_preedit_string(-1, "", _sig_dec[_click_count%SIG_DEC_SIZE]);
-                    g_core.show_preedit_string(-1, "");
+                    ime_update_preedit_string(_sig_dec[_click_count%SIG_DEC_SIZE], NULL);
+                    ime_show_preedit_string();
                     delete_commit_timer();
                     _commit_timer = ecore_timer_add(1.0, commit_timeout, NULL);
                     _click_count++;
@@ -1132,10 +1133,10 @@ SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_d
                     }
                     //g_need_send_shift_event = TRUE;
                 } else if (strncmp(event_desc.key_value, delete_all, strlen(delete_all)) == 0) {
-                    g_core.delete_surrounding_text((INT_MAX / 2) * -1, INT_MAX);
+                    ime_delete_surrounding_text((INT_MAX / 2) * -1, INT_MAX);
                 } else if (strncmp(event_desc.key_value, hide_panel, strlen(hide_panel)) == 0) {
                     ::ise_hide();
-                    g_core.request_ise_hide();
+                    ime_request_hide();
                 } else if (event_desc.key_event) {
                     ise_send_event(event_desc.key_event, KEY_MASK_NULL);
                     if (event_desc.key_event == MVK_Shift_L) {
@@ -1151,7 +1152,7 @@ SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_d
                 }
             } else if (strcmp(event_desc.key_value, USER_KEYSTRING_OPTION) == 0) {
                 if (!option_window_is_available (OPTION_WINDOW_TYPE_NORMAL))
-                    g_core.create_option_window();
+                    ime_create_option_window();
                 ret = SCL_EVENT_DONE;
             } else if (strcmp(event_desc.key_value, USER_KEYSTRING_CLIPBOARD) == 0) {
                 show_cbhm();
@@ -1188,7 +1189,7 @@ SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_d
             if (strcmp(event_desc.key_value, USER_KEYSTRING_OPTION) == 0) {
                 //open_option_window(NULL, ROTATION_TO_DEGREE(g_ui->get_rotation()));
                 if (!option_window_is_available (OPTION_WINDOW_TYPE_NORMAL))
-                    g_core.create_option_window();
+                    ime_create_option_window();
                 ret = SCL_EVENT_DONE;
             } else if (strcmp(event_desc.key_value, USER_KEYSTRING_CLIPBOARD) == 0) {
                 show_cbhm();
@@ -1224,7 +1225,7 @@ SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_d
 #endif
                     if ((group_id >= 0) && (group_id < MAX_EMOTICON_GROUP)) {
                         SCLRotation rotation = g_ui->get_rotation();
-                        ise_show_emoticon_layout(group_id, ROTATION_TO_DEGREE(rotation), false, g_core.get_main_window());
+                        ise_show_emoticon_layout(group_id, ROTATION_TO_DEGREE(rotation), false, ime_get_main_window());
                     }
                 }
             }
@@ -1295,7 +1296,7 @@ ise_focus_in(int ic)
                 g_keyboard_state.layout == ISE_LAYOUT_STYLE_IP ||
                 g_keyboard_state.layout == ISE_LAYOUT_STYLE_MONTH ||
                 g_keyboard_state.layout == ISE_LAYOUT_STYLE_NUMBERONLY) {
-            g_core.set_keyboard_ise_by_uuid(DEFAULT_KEYBOARD_ISE_UUID);
+            ime_set_imengine(DEFAULT_KEYBOARD_ISE_UUID);
         }
     }
 }
@@ -1349,7 +1350,7 @@ ise_show(int ic)
                     g_keyboard_state.layout == ISE_LAYOUT_STYLE_IP ||
                     g_keyboard_state.layout == ISE_LAYOUT_STYLE_MONTH ||
                     g_keyboard_state.layout == ISE_LAYOUT_STYLE_NUMBERONLY) {
-                g_core.set_keyboard_ise_by_uuid(DEFAULT_KEYBOARD_ISE_UUID);
+                ime_set_imengine(DEFAULT_KEYBOARD_ISE_UUID);
             }
         }
 
@@ -1430,7 +1431,6 @@ ise_show(int ic)
                 g_ui->enable_button("quotation", !filename_layout);
 
                 LOGD("new layout index : %d\n", layout_index);
-                const sclchar *old_input_mode = g_ui->get_input_mode();
                 /* If this layout requires specific input mode, set it */
                 if (strlen(g_ise_default_values[layout_index].input_mode) > 0) {
                     g_ui->set_input_mode(g_ise_default_values[layout_index].input_mode);
@@ -1441,7 +1441,7 @@ ise_show(int ic)
                         size_portrait.height += g_candidate->get_height();
                         size_landscape.height += g_candidate->get_height();
                     }
-                    g_core.set_keyboard_size_hints(size_portrait, size_landscape);
+                    ime_set_size(size_portrait.width, size_portrait.height, size_landscape.width, size_landscape.height);
                 } else {
                     if (force_primary_latin) {
                         _language_manager.select_language(PRIMARY_LATIN_LANGUAGE, TRUE);
@@ -1467,31 +1467,7 @@ ise_show(int ic)
                         current_emoticon_group = EMOTICON_GROUP_RECENTLY_USED;
 #endif
                     SCLRotation rotation = g_ui->get_rotation();
-                    ise_show_emoticon_layout(current_emoticon_group, ROTATION_TO_DEGREE(rotation), false, g_core.get_main_window());
-                }
-                // Check whether inout panel geometry is changed.
-                const sclchar *new_input_mode = g_ui->get_input_mode();
-                if (g_keyboard_state.visible_state && old_input_mode && new_input_mode && strcmp(old_input_mode, new_input_mode)) {
-                    SclSize new_portrait = g_ui->get_input_mode_size(new_input_mode, DISPLAYMODE_PORTRAIT);
-                    SclSize new_landscape = g_ui->get_input_mode_size(new_input_mode, DISPLAYMODE_LANDSCAPE);
-                    LOGD("old input mode:%s, new input mode:%s, portrait(%d, %d), landscape(%d, %d)\n",
-                        old_input_mode, new_input_mode, new_portrait.width, new_portrait.height, new_landscape.width, new_landscape.height);
-
-                    sclint width = 0;
-                    sclint height = 0;
-                    g_ui->get_screen_resolution(&width, &height);
-
-                    SclSize old_size = {0, 0};
-                    SCLRotation rotation = g_ui->get_rotation();
-                    if (rotation == ROTATION_90_CW || rotation == ROTATION_90_CCW) {
-                        old_size = g_ui->get_input_mode_size(old_input_mode, DISPLAYMODE_LANDSCAPE);
-                        if (old_size.width != new_landscape.width || old_size.height != new_landscape.height)
-                            g_core.update_geometry(0, 0, new_landscape.width, new_landscape.height);
-                    } else {
-                        old_size = g_ui->get_input_mode_size(old_input_mode, DISPLAYMODE_PORTRAIT);
-                        if (old_size.width != new_portrait.width || old_size.height != new_portrait.height)
-                            g_core.update_geometry(0, height - new_portrait.height, new_portrait.width, new_portrait.height);
-                    }
+                    ise_show_emoticon_layout(current_emoticon_group, ROTATION_TO_DEGREE(rotation), false, ime_get_main_window());
                 }
             }
         }
@@ -1603,12 +1579,12 @@ ise_show(int ic)
 #endif
 
     if (g_setting_window_open_status) {
-        ise_show_stt_mode(NATIVE_WINDOW_CAST(g_core.get_main_window()));
+        ise_show_stt_mode(NATIVE_WINDOW_CAST(ime_get_main_window()));
     }
     g_setting_window_open_status = FALSE;
 
     if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_VOICE) {
-        ise_show_stt_mode(NATIVE_WINDOW_CAST(g_core.get_main_window()));
+        ise_show_stt_mode(NATIVE_WINDOW_CAST(ime_get_main_window()));
     }
 }
 
@@ -1695,7 +1671,7 @@ ise_create()
     }
 
     if (g_ui) {
-        if (g_core.get_main_window()) {
+        if (ime_get_main_window()) {
             sclboolean succeeded = FALSE;
 
             const sclchar *entry_path = MAIN_ENTRY_XML_PATH;
@@ -1710,15 +1686,13 @@ ise_create()
 
             if (resource_file_path) {
                 if (strlen(resource_file_path) > 0) {
-                    succeeded = g_ui->init(g_core.get_main_window(), scl_parser_type, resource_file_path);
+                    succeeded = g_ui->init(ime_get_main_window(), scl_parser_type, resource_file_path);
                 }
             }
             if (!succeeded) {
-                g_ui->init(g_core.get_main_window(), scl_parser_type, MAIN_ENTRY_XML_PATH);
+                g_ui->init(ime_get_main_window(), scl_parser_type, MAIN_ENTRY_XML_PATH);
             }
 
-            g_core.enable_soft_candidate(true);
-
             g_ui->set_longkey_duration(elm_config_longpress_timeout_get() * 1000);
 
             /* Default ISE callback */
@@ -1755,7 +1729,7 @@ ise_create()
             size_portrait.height += g_candidate->get_height();
             size_landscape.height += g_candidate->get_height();
         }
-        g_core.set_keyboard_size_hints(size_portrait, size_landscape);
+        ime_set_size(size_portrait.width, size_portrait.height, size_landscape.width, size_landscape.height);
     }
     init_recent_used_punctuation();
 }
@@ -2013,13 +1987,195 @@ static void update_recent_used_punctuation(const char * key_value)
     }
 }
 
-int main(int argc, char *argv[])
+static void ime_app_create_cb(void *user_data)
+{
+    g_core_event_callback.on_init();
+}
+
+static void ime_app_exit_cb(void *user_data)
+{
+    g_core_event_callback.on_exit();
+}
+
+static void ime_app_show_cb(int ic, ime_context_h ime_ctx, void *user_data)
+{
+    Ise_Context iseContext;
+    bool return_key_state, prediction_allow, password_mode;
+    ime_layout_variation_e layout_variation;
+
+    ime_context_get_layout(ime_ctx, &iseContext.layout);
+
+    ime_context_get_layout_variation(ime_ctx, &layout_variation);
+    iseContext.layout_variation =  (int)layout_variation;
+
+    ime_context_get_cursor_position(ime_ctx, &iseContext.cursor_pos);
+    ime_context_get_autocapital_type(ime_ctx, &iseContext.autocapital_type);
+    ime_context_get_return_key_type(ime_ctx, &iseContext.return_key_type);
+    ime_context_get_return_key_state(ime_ctx, &return_key_state);
+
+    ime_context_get_prediction_mode(ime_ctx, &prediction_allow);
+    iseContext.prediction_allow = prediction_allow;
+
+    ime_context_get_password_mode(ime_ctx, &password_mode);
+    iseContext.password_mode = password_mode;
+
+    ime_context_get_input_hint(ime_ctx, &iseContext.input_hint);
+    ime_context_get_bidi_direction(ime_ctx, &iseContext.bidi_direction);
+    ime_context_get_language(ime_ctx, &iseContext.language);
+    iseContext.return_key_disabled = return_key_state;
+
+    g_ic = ic;
+
+    g_core_event_callback.on_ise_show(ic, 0, iseContext);
+}
+
+static void ime_app_hide_cb(int ic, void *user_data)
+{
+    g_core_event_callback.on_ise_hide(ic, NULL);
+}
+
+static void ime_app_return_key_type_set_cb(Ecore_IMF_Input_Panel_Return_Key_Type type, void *user_data)
+{
+    LOGD("return key type : %d\n", type);
+    g_core_event_callback.on_set_return_key_type(type);
+}
+
+static void ime_app_return_key_state_set_cb(bool disabled, void *user_data)
+{
+    LOGD("return key disabled : %d\n", disabled);
+    g_core_event_callback.on_set_return_key_disable(disabled);
+}
+
+static void ime_app_cursor_position_updated_cb(int cursor_pos, void *user_data)
+{
+    LOGD("cursor position : %d\n", cursor_pos);
+    g_core_event_callback.on_update_cursor_position(g_ic, "", cursor_pos);
+}
+
+static void ime_app_surrounding_text_updated_cb(int context_id, const char *text, int cursor_pos, void *user_data)
 {
-    try {
-        g_core.run();
-    } catch (...) {
-        LOGW("Exception is thrown from g_core.run()!!!\n");
+    LOGD("cursor position : %d\n", cursor_pos);
+    g_core_event_callback.on_update_surrounding_text(context_id, text, cursor_pos);
+}
+
+static void ime_app_focus_in_cb(int context_id, void *user_data)
+{
+    g_core_event_callback.on_focus_in(context_id, NULL);
+}
+
+static void ime_app_focus_out_cb(int context_id, void *user_data)
+{
+    g_core_event_callback.on_focus_out(context_id, NULL);
+}
+
+static void ime_app_layout_set_cb(Ecore_IMF_Input_Panel_Layout layout, void *user_data)
+{
+    g_core_event_callback.on_set_layout(layout);
+}
+
+static void ime_app_option_window_created_cb(Evas_Object *window, ime_option_window_type_e type, void *user_data)
+{
+    g_core_event_callback.on_create_option_window(SCL_WINDOW_CAST(window), (SCLOptionWindowType)type);
+}
+
+static void ime_app_option_window_destroyed_cb(Evas_Object *window, void *user_data)
+{
+    g_core_event_callback.on_destroy_option_window(SCL_WINDOW_CAST(window));
+}
+
+static void ime_app_rotation_degree_changed_cb(int degree, void *user_data)
+{
+    g_core_event_callback.on_set_rotation_degree(degree);
+}
+
+static void ime_app_imdata_set_cb(void *data, unsigned int data_length, void *user_data)
+{
+    g_core_event_callback.on_set_imdata((sclchar *)data, data_length);
+}
+
+static bool ime_app_process_key_event_cb(ime_key_code_e keycode, ime_key_mask_e keymask, ime_device_info_h dev_info, void *user_data)
+{
+    scim::KeyEvent key(keycode, keymask);
+    unsigned int ret;
+    g_core_event_callback.on_process_key_event(key, &ret);
+
+    return ret;
+}
+
+static void ime_app_caps_mode_changed_cb(int mode, void *user_data)
+{
+    g_core_event_callback.on_set_caps_mode(mode);
+}
+
+static void ime_app_candidate_show_cb(int context_id, void *user_data)
+{
+    g_core_event_callback.on_candidate_show(context_id, "");
+}
+
+static void ime_app_candidate_hide_cb(int context_id, void *user_data)
+{
+    g_core_event_callback.on_candidate_hide(context_id, "");
+}
+
+static void ime_app_lookup_table_changed_cb(Eina_List *list, void *user_data)
+{
+    vector<string> candidate_strings;
+    char *candidate;
+    void *data;
+
+    if (list) {
+        EINA_LIST_FREE(list, data) {
+            candidate = (char *)data;
+            if (candidate) {
+                candidate_strings.push_back(string(candidate));
+                free(candidate);
+            }
+        }
     }
 
+    ise_update_table(candidate_strings);
+}
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+EXPORTED void ime_app_main(int argc, char **argv)
+{
+    ime_callback_s basic_callback = {
+        ime_app_create_cb,
+        ime_app_exit_cb,
+        ime_app_show_cb,
+        ime_app_hide_cb
+    };
+
+    ime_event_set_focus_in_cb(ime_app_focus_in_cb, NULL);
+    ime_event_set_focus_out_cb(ime_app_focus_out_cb, NULL);
+    ime_event_set_rotation_degree_changed_cb(ime_app_rotation_degree_changed_cb, NULL);
+    ime_event_set_layout_set_cb(ime_app_layout_set_cb, NULL);
+    ime_event_set_caps_mode_changed_cb(ime_app_caps_mode_changed_cb, NULL);
+
+    ime_event_set_cursor_position_updated_cb(ime_app_cursor_position_updated_cb, NULL);
+    ime_event_set_surrounding_text_updated_cb(ime_app_surrounding_text_updated_cb, NULL);
+    ime_event_set_return_key_type_set_cb(ime_app_return_key_type_set_cb, NULL);
+    ime_event_set_return_key_state_set_cb(ime_app_return_key_state_set_cb, NULL);
+    ime_event_set_imdata_set_cb(ime_app_imdata_set_cb, NULL);
+    ime_event_set_option_window_created_cb(ime_app_option_window_created_cb, NULL);
+    ime_event_set_option_window_destroyed_cb(ime_app_option_window_destroyed_cb, NULL);
+    ime_event_set_process_key_event_cb(ime_app_process_key_event_cb, NULL);
+
+    ime_event_set_candidate_show_cb(ime_app_candidate_show_cb, NULL);
+    ime_event_set_candidate_hide_cb(ime_app_candidate_hide_cb, NULL);
+    ime_event_set_lookup_table_changed_cb(ime_app_lookup_table_changed_cb, NULL);
+
+    ime_run(&basic_callback, NULL);
+}
+#ifdef __cplusplus
+}
+#endif
+
+int main(int argc, char *argv[])
+{
+    ime_app_main(argc, argv);
+
     return 0;
 }
index fce5639..b65a7cb 100644 (file)
@@ -22,6 +22,7 @@
 #include <glib.h>
 #include <Elementary.h>
 #include <efl_extension.h>
+#include <inputmethod.h>
 
 #include "utils.h"
 #include "option.h"
@@ -131,7 +132,6 @@ struct OPTION_ELEMENTS
 
 static OPTION_ELEMENTS option_elements[OPTION_WINDOW_TYPE_MAX];
 extern CONFIG_VALUES g_config_values;
-extern CSCLCore g_core;
 extern CSCLUI *g_ui;
 
 static Evas_Object* create_option_language_view(Evas_Object *naviframe);
@@ -782,7 +782,7 @@ static void close_option_window(SCLOptionWindowType type)
     destroy_genlist_item_classes(type);
     if (CHECK_ARRAY_INDEX(type, OPTION_WINDOW_TYPE_MAX)) {
         if (option_elements[type].option_window)
-            g_core.destroy_option_window(option_elements[type].option_window);
+            ime_destroy_option_window(option_elements[type].option_window);
 
         option_elements[type].option_window = NULL;
     }
index 0f12421..f798fec 100644 (file)
@@ -18,6 +18,7 @@
 #include <sclui.h>
 #include <sclcore.h>
 #include <iconv.h>
+#include <inputmethod_internal.h>
 
 #include "ise.h"
 #include "sdk.h"
@@ -102,7 +103,6 @@ public :
 static CSDKISE ise_instance;
 
 extern CSCLUI *g_ui;
-extern CSCLCore g_core;
 
 extern CONFIG_VALUES g_config_values;
 extern KEYBOARD_STATE g_keyboard_state;
@@ -262,14 +262,14 @@ SCLEventReturnType CSDKISE::on_event_key_clicked(SclUIEventDesc event_desc)
     SCLEventReturnType ret = SCL_EVENT_PASS_ON;
     const sclchar * cur_lang = _language_manager.get_current_language();
     if (event_desc.key_modifier == KEY_MODIFIER_LONGKEY)
-        g_core.flush_keyboard_ise();
+        ime_flush_imengine();
 
     switch (event_desc.key_type) {
         case KEY_TYPE_CHAR:
             ret = process_key_type_char(event_desc);
             break;
         case KEY_TYPE_STRING:
-            g_core.flush_keyboard_ise();
+            ime_flush_imengine();
             if (strcmp(_language_manager.get_current_language(), "Korean") == 0) {
                 process_korean_automata(false, SIPKEY_ERROR);
             }
@@ -280,7 +280,7 @@ SCLEventReturnType CSDKISE::on_event_key_clicked(SclUIEventDesc event_desc)
             break;
         case KEY_TYPE_MODECHANGE:
             {
-                g_core.flush_keyboard_ise();
+                ime_flush_imengine();
                 if (strcmp(_language_manager.get_current_language(), "Korean") == 0) {
                     process_korean_automata(false, SIPKEY_ERROR);
                 }
@@ -300,13 +300,15 @@ SCLEventReturnType CSDKISE::on_event_key_clicked(SclUIEventDesc event_desc)
                 } else if (event_desc.key_event == MVK_space) {
                     if (_language_manager.get_enabled_languages_num() > 1) {
                         if (event_desc.key_modifier == KEY_MODIFIER_DIRECTION_LEFT) {
-                            g_core.flush_keyboard_ise();
+                            ime_flush_imengine();
+
                             /* If flick event upon space key was detected, perform a language change and don't proceed anymore */
                             _language_manager.select_previous_language();
                             g_keyboard_state.disable_force_latin = TRUE;
                             ret = SCL_EVENT_DONE;
                         } else if (event_desc.key_modifier == KEY_MODIFIER_DIRECTION_RIGHT) {
-                            g_core.flush_keyboard_ise();
+                            ime_flush_imengine();
+
                             /* If flick event upon space key was detected, perform a language change and don't proceed anymore */
                             _language_manager.select_next_language();
                             g_keyboard_state.disable_force_latin = TRUE;
@@ -386,9 +388,11 @@ sclboolean CSDKISE::on_language_selected(const sclchar *language, const sclchar
             if (strcmp(language, table[loop].language) == 0) {
                 if (g_ui) {
                     if (table[loop].keyboard_ise_uuid) {
-                        g_core.set_keyboard_ise_by_uuid(table[loop].keyboard_ise_uuid);
+                        ime_set_imengine(table[loop].keyboard_ise_uuid);
+                        /*
                         g_core.send_imengine_event(-1, table[loop].keyboard_ise_uuid,
                             table[loop].language_command, table[loop].language_code);
+                        */
                         flush_imengine(language);
                     }
 
@@ -454,7 +458,7 @@ sclboolean CSDKISE::on_language_selected(const sclchar *language, const sclchar
     }
 
     if (ret) {
-        g_core.update_input_context(ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, 0);
+        ime_update_input_context(ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, 0);
     }
 
     return ret;
@@ -541,11 +545,13 @@ sclboolean CSDKISE::flush_imengine(const sclchar *language)
         int lang_id = get_lang_id(language);
         if (lang_id != -1) {
             if (table[lang_id].flush_code != 0) {
+                /*
                 g_core.send_imengine_event(-1, table[lang_id].keyboard_ise_uuid,
                         table[lang_id].flush_command, table[lang_id].flush_code);
+                */
                 bRet = true;
             } else {
-                g_core.reset_keyboard_ise();
+                ime_reset_imengine();
                 bRet = true;
             }
         }