PROJECT(ise-default)
SET(BASIC_ISE_SRCS
- src/main.cpp
- src/common.cpp
src/ise.cpp
src/languages.cpp
src/config.cpp
efl-extension
dlog
libscl-ui
+ libscl-core
ecore-imf
isf
vconf
)
IF (with_wayland)
+ ADD_DEFINITIONS("-DWAYLAND")
pkg_check_modules(ISE_PKGS REQUIRED ${PKGS_CHECK_MODULES} ecore-wayland wayland-client)
ELSE (with_wayland)
pkg_check_modules(ISE_PKGS REQUIRED ${PKGS_CHECK_MODULES})
${ISE_RESDIR}/sdk FILES_MATCHING PATTERN "*.xml")
ADD_SUBDIRECTORY(po)
-
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(ise-default-setup CXX)
-
-IF (with_wayland)
- ADD_DEFINITIONS("-DWAYLAND")
-ENDIF(with_wayland)
-
-SET(SETUP_SRCS
- src/setup_module.cpp
- src/option.cpp
- src/languages.cpp
- src/config.cpp
- src/sdk/ise_lang_table.cpp
- src/sdk/sdk_option.cpp
-)
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(SETUP_LIBDIR "${LIBDIR}/scim-1.0/1.4.0/SetupUI")
-
-IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
- SET(CMAKE_BUILD_TYPE "Release")
-ENDIF()
-MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(SETUP_PKGS REQUIRED
- elementary
- efl-extension
- dlog
- libscl-ui
- ecore-imf
- libxml-2.0
- isf
- )
-
-FOREACH(flag ${SETUP_PKGS_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -DSETUP_MODULE")
-#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -finstrument-functions")
-SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
-SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -g")
-
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${SETUP_SRCS})
-
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SETUP_PKGS_LDFLAGS})
-
-set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${SETUP_LIBDIR})
Name: ise-default
Summary: Tizen keyboard
-Version: 1.0.8
+Version: 1.1.0
Release: 1
Group: Graphics & UI Framework/Input
License: Apache-2.0
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(libscl-ui)
+BuildRequires: pkgconfig(libscl-core)
BuildRequires: pkgconfig(ecore-imf)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(efl-extension)
%files
%defattr(-,root,root,-)
%{_libdir}/scim-1.0/1.4.0/Helper/ise-default.so
-%{_libdir}/scim-1.0/1.4.0/SetupUI/ise-default-setup.so
%{_datadir}/isf/ise/ise-default/*
%{_datadir}/packages/*
%{_datadir}/locale/*
+++ /dev/null
-/*
- * Copyright (c) 2012 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <glib.h>
-
-#ifdef WAYLAND
-#include <Ecore.h>
-#include <Ecore_Wayland.h>
-#include "input-method-client-protocol.h"
-#include <malloc.h>
-#else
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <Ecore_X.h>
-#endif
-#include <Ecore_Evas.h>
-#include <Elementary.h>
-
-#include <dlog.h>
-
-#include <vconf.h>
-#include <vconf-keys.h>
-
-#include "common.h"
-#include "ise.h"
-#include "candidate-factory.h"
-#define IMDATA_STRING_MAX_LEN 256
-#define CANDIDATE_WINDOW_HEIGHT 84
-
-#ifdef WAYLAND
-struct WeescimKeyboard
-{
- Ecore_Evas *ee;
- Ecore_Wl_Window *wl_win;
- const char *ee_engine;
-
- struct wl_surface *surface;
- struct wl_input_panel *ip;
- struct wl_output *output;
-};
-
-struct WeescimKeyboard wskb = {0};
-#endif
-
-using namespace scl;
-
-CISECommon* CISECommon::m_instance = NULL; /* For singleton */
-
-extern KEYBOARD_STATE g_keyboard_state;
-
-/* A temporary function for setting imdata for supporting legacy language setting API */
-extern void set_ise_imdata(const char * buf, size_t &len);
-
-/* Internal signal handler function */
-void signal_handler(int sig);
-
-/* Internal input handler function */
-Eina_Bool input_handler (void *data, Ecore_Fd_Handler *fd_handler);
-
-static int get_app_window_degree(Evas_Object *keypad_win)
-{
-#ifdef WAYLAND
- return 0;
-#else
- int ret = 0;
- Atom type_return;
- int format_return;
- unsigned long nitems_return;
- unsigned long bytes_after_return;
- unsigned char *data_window = NULL;
- unsigned char *data_angle = NULL;
-
- int retVal = 0;
- Ecore_X_Window app_window = 0;
-
- LOGD("Trying to get app window degree for %p\n", keypad_win);
- Ecore_X_Window win = elm_win_xwindow_get(static_cast<Evas_Object*>(keypad_win));
- ret = XGetWindowProperty((Display *)ecore_x_display_get (),
- ecore_x_window_root_get(win),
- ecore_x_atom_get("_ISF_ACTIVE_WINDOW"),
- 0, G_MAXLONG, False, XA_WINDOW, &type_return,
- &format_return, &nitems_return, &bytes_after_return,
- &data_window);
-
- if (ret == Success) {
- if ((type_return == XA_WINDOW) && (format_return == 32) && (data_window)) {
- app_window = *(Window *)data_window;
-
- ret = XGetWindowProperty((Display *)ecore_x_display_get(), app_window,
- ecore_x_atom_get("_E_ILLUME_ROTATE_WINDOW_ANGLE"),
- 0, G_MAXLONG, False, XA_CARDINAL, &type_return,
- &format_return, &nitems_return, &bytes_after_return,
- &data_angle);
-
- LOGD("app_window : %p, ret %d, %d, %p\n", app_window, ret, type_return, data_angle);
- if (ret == Success) {
- if (data_angle) {
- if (type_return == XA_CARDINAL) {
- retVal = *(unsigned int*)data_angle;
- LOGD("current rotation angle is %p %d\n", app_window, retVal);
- }
- XFree(data_angle);
- }
- }
- }
- if (data_window)
- XFree(data_window);
- }
-
- return retVal;
-#endif
-}
-
-const char * extract_themename_from_theme_file_path(const char *filepath) {
- static char themename[_POSIX_PATH_MAX] = {0};
- memset(themename, 0x00, sizeof(themename));
-
- if (filepath) {
- /* There could be more than 1 theme filepath, separated by : */
- char pathstr[_POSIX_PATH_MAX] = {0};
- strncpy(pathstr, filepath, _POSIX_PATH_MAX - 1);
- for(int loop = 0;loop < _POSIX_PATH_MAX;loop++) {
- if (pathstr[loop] == ':') {
- /* FIXME : Let's consider the 1st theme filepath only for now */
- pathstr[loop] = '\0';
- }
- }
-
- if (pathstr[0]) {
- const char *filename = ecore_file_file_get(pathstr);
- if (filename) {
- char *stripname = ecore_file_strip_ext(filename);
- if (stripname) {
- strncpy(themename, stripname, _POSIX_PATH_MAX - 1);
- free(stripname);
- }
- }
- }
- }
-
- return themename;
-}
-
-void language_changed_cb(keynode_t *key, void* data)
-{
- char clang[_POSIX_PATH_MAX] = {0};
- char *vconf_str = vconf_get_str(VCONFKEY_LANGSET);
- if (vconf_str) {
- snprintf(clang, sizeof(clang), "%s",vconf_str);
- free(vconf_str);
- }
- LOGD("current language is %s\n",clang);
-
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->set_display_language(clang);
- }
- }
-}
-
-void theme_changed_cb(keynode_t *key, void* data)
-{
- char clang[256] = {0};
- char *vconf_str = vconf_get_str(VCONFKEY_SETAPPL_WIDGET_THEME_STR);
- if (vconf_str) {
- snprintf(clang, sizeof(clang), "%s",extract_themename_from_theme_file_path(vconf_str));
- free(vconf_str);
- }
- LOGD("current theme is %s\n",clang);
-
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->set_theme_name(clang);
- }
- }
-}
-
-void accessibility_changed_cb(keynode_t *key, void* data)
-{
- int vconf_value = 0;
- if (vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &vconf_value) == 0) {
- LOGD("accessibility state : %d\n", vconf_value);
-
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->set_accessibility_state(vconf_value);
- }
- }
- }
-}
-
-#ifndef WAYLAND
-static Eina_Bool _client_message_cb (void *data, int type, void *event)
-{
- Ecore_X_Event_Client_Message *ev = (Ecore_X_Event_Client_Message *)event;
-
- IISECommonEventCallback *callback = NULL;
- CISECommon *common = CISECommon::get_instance();
- Evas_Object *main_window = NULL;
- if (common) {
- callback = common->get_core_event_callback();
- main_window = common->get_main_window();
- }
-
-#ifndef APPLY_WINDOW_MANAGER_CHANGE
-#else
- if (ev->message_type == ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE) {
- LOGD("ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE , %d %d\n", ev->data.l[0], gFHiddenState);
- angle = ev->data.l[0];
- ise_set_screen_direction(angle);
- if (!gFHiddenState) {
- ise_show(gLastIC);
- }
- } else if (ev->message_type == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE) {
- LOGD("ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE , %d\n", ev->data.l[0]);
- elm_win_keyboard_mode_set(main_window, (Elm_Win_Keyboard_Mode)(ev->data.l[0]));
- gFHiddenState = !(ev->data.l[0]);
- }
-#endif
-
- if (ev->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST) {
- if (ev->win == elm_win_xwindow_get(main_window)) {
- int angle = ev->data.l[1];
- LOGD("_ECORE_X_ATOM_E_WINDOW_ROTATION_REQUEST, %d\n", angle);
- if (callback) {
- callback->set_rotation_degree(angle);
- }
- Ecore_X_Window control_window = 0;
- Ecore_X_Atom atom = ecore_x_atom_get ("_ISF_CONTROL_WINDOW");
- Ecore_X_Window root = ecore_x_window_root_first_get ();
- if (ecore_x_window_prop_xid_get(root, atom, ECORE_X_ATOM_WINDOW, &control_window, 1) == 1) {
- ecore_x_client_message32_send(control_window, ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST,
- ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
- ev->data.l[0], ev->data.l[1], ev->data.l[2], ev->data.l[3], ev->data.l[4]);
- }
- }
- }
-
- return ECORE_CALLBACK_RENEW;
-}
-#endif
-
-CISECommon::CISECommon()
-{
- m_main_window = NULL;
- m_event_callback = NULL;
-}
-
-CISECommon::~CISECommon()
-{
-}
-
-#ifdef WAYLAND
-static bool
-_wskb_setup(struct WeescimKeyboard *wskb)
-{
- Eina_Inlist *globals;
- struct wl_registry *registry;
- Ecore_Wl_Global *global;
- struct wl_input_panel_surface *ips;
-
- if (!(registry = ecore_wl_registry_get()))
- return false;
-
- if (!(globals = ecore_wl_globals_get()))
- return false;
-
- EINA_INLIST_FOREACH(globals, global)
- {
- if (strcmp(global->interface, "wl_input_panel") == 0)
- wskb->ip = (wl_input_panel *)wl_registry_bind(registry, global->id, &wl_input_panel_interface, 1);
- else if (strcmp(global->interface, "wl_output") == 0)
- wskb->output = (wl_output *)wl_registry_bind(registry, global->id, &wl_output_interface, 1);
- }
-
- if (!wskb->ip) {
- LOGW ("Can't get wayland input panel interface\n");
- return false;
- }
-
- if (!wskb->output) {
- LOGW ("Can't get wayland output interface\n");
- return false;
- }
-
- /* Set input panel surface */
- LOGD ("Setting up input panel\n");
- wskb->wl_win = ecore_evas_wayland_window_get(wskb->ee);
- if (!wskb->wl_win) {
- LOGW ("Couldn't get wayland window\n");
- return false;
- }
-
- ecore_wl_window_type_set(wskb->wl_win, ECORE_WL_WINDOW_TYPE_NONE);
- wskb->surface = ecore_wl_window_surface_create(wskb->wl_win);
- if (!wskb->surface) {
- LOGW ("Couldn't create surface\n");
- return false;
- }
-
- ips = wl_input_panel_get_input_panel_surface(wskb->ip, wskb->surface);
- if (!ips) {
- LOGW ("Couldn't get input panel surface\n");
- return false;
- }
-
- wl_input_panel_surface_set_toplevel(ips, wskb->output, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
-
- return true;
-}
-
-static Eina_Bool
-_wskb_check_evas_engine(struct WeescimKeyboard *wskb)
-{
- Eina_Bool ret = EINA_FALSE;
- char *env = getenv("ECORE_EVAS_ENGINE");
-
- if (!env) {
- if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_WAYLAND_SHM))
- env = "wayland_shm";
- else if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_WAYLAND_EGL))
- env = "wayland_egl";
- else {
- LOGW ("ERROR: Ecore_Evas does must be compiled with support for Wayland engines\n");
- goto err;
- }
- }
- else if (strcmp(env, "wayland_shm") != 0 && strcmp(env, "wayland_egl") != 0) {
- LOGW ("ERROR: ECORE_EVAS_ENGINE must be set to either 'wayland_shm' or 'wayland_egl'\n");
- goto err;
- }
-
- wskb->ee_engine = env;
- ret = EINA_TRUE;
-
-err:
- return ret;
-}
-#endif
-
-CISECommon*
-CISECommon::get_instance()
-{
- if (!m_instance) {
- m_instance = new CISECommon();
- }
- return (CISECommon*)m_instance;
-}
-
-void CISECommon::init(const sclchar *name, const sclchar *uuid, const sclchar *language)
-{
- m_helper_info.uuid = scim::String(uuid);
- m_helper_info.name = scim::String(name);
-#ifdef _TV
- m_helper_info.option = scim::SCIM_HELPER_STAND_ALONE | scim::SCIM_HELPER_NEED_SCREEN_INFO |
- scim::SCIM_HELPER_NEED_SPOT_LOCATION_INFO | scim::SCIM_HELPER_AUTO_RESTART | scim::ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT;
-#else
- m_helper_info.option = scim::SCIM_HELPER_STAND_ALONE | scim::SCIM_HELPER_NEED_SCREEN_INFO |
- scim::SCIM_HELPER_NEED_SPOT_LOCATION_INFO | scim::SCIM_HELPER_AUTO_RESTART;
-#endif
-
- m_supported_language = scim::String(language);
-}
-
-void CISECommon::exit()
-{
-}
-
-void CISECommon::run(const sclchar *uuid, const scim::ConfigPointer &config, const sclchar *display)
-{
- char *argv[4];
- int argc = 3;
- int fd;
- Ecore_Fd_Handler *fd_handler = NULL;
-
- argv [0] = const_cast<char *> (m_helper_info.name.c_str());
- argv [1] = const_cast<char *> ("--display");
- argv [2] = const_cast<char *> (display);
- argv [3] = 0;
-
- m_config = config;
-
- elm_init(argc, argv);
-
-#ifdef WAYLAND
- if (!_wskb_check_evas_engine(&wskb)) {
- LOGW ("_wskb_check_evas_engine error!\n");
- goto end;
- }
- LOGD ("Selected engine: '%s'\n", wskb.ee_engine);
-#endif
-
- m_main_window = elm_win_add(NULL, "Tizen Keyboard", ELM_WIN_UTILITY);
- if (!m_main_window) {
- LOGE("Failed to create main window\n");
- return;
- }
-
-#ifdef WAYLAND
- wskb.ee = ecore_evas_ecore_evas_get (evas_object_evas_get (m_main_window));
-
- if (!wskb.ee) {
- LOGW ("ERROR: Unable to create Ecore_Evas object");
- goto end;
- }
-
- if (!_wskb_setup(&wskb)) {
- LOGW ("ERROR: Unable to setup input panel.\n");
- goto end;
- }
-#endif
-
- elm_policy_set (ELM_POLICY_THROTTLE, ELM_POLICY_THROTTLE_NEVER);
-
- elm_win_borderless_set(m_main_window, EINA_TRUE);
- elm_win_keyboard_win_set(m_main_window, EINA_TRUE);
- elm_win_autodel_set(m_main_window, EINA_TRUE);
- elm_win_title_set(m_main_window, "Tizen Keyboard");
-
-#ifndef WAYLAND
- unsigned int set = 1;
- ecore_x_window_prop_card32_set(elm_win_xwindow_get(m_main_window),
- ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED,
- &set, 1);
-#endif
-
-#ifdef FULL_SCREEN_TEST
- elm_win_fullscreen_set(m_main_window, EINA_TRUE);
-#endif
-
- if (m_event_callback) {
- m_event_callback->init();
- }
-
- vconf_notify_key_changed(VCONFKEY_LANGSET, language_changed_cb, NULL);
- vconf_notify_key_changed(VCONFKEY_SETAPPL_WIDGET_THEME_STR, theme_changed_cb, NULL);
- vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, accessibility_changed_cb, NULL);
-
- /* Should we call these callback functions here? */
- language_changed_cb(NULL, NULL);
- theme_changed_cb(NULL, NULL);
- accessibility_changed_cb(NULL, NULL);
-
- register_slot_functions();
-
- m_helper_agent.open_connection(m_helper_info, display);
- fd = m_helper_agent.get_connection_number();
-
- if (!m_uuid_keyboard_ise.empty()) {
- m_helper_agent.set_keyboard_ise_by_uuid(m_uuid_keyboard_ise);
- }
-
- if (fd >= 0) {
-#ifndef WAYLAND
- Ecore_X_Window xwindow = elm_win_xwindow_get(m_main_window);
- char xid[255];
- snprintf(xid, 255, "%d", xwindow);
- scim::Property prop(xid, "XID", "", "");
- scim::PropertyList props;
- props.push_back(prop);
- m_helper_agent.register_properties(props);
-#endif
-
- fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, input_handler, NULL, NULL, NULL);
- }
-
-#ifndef WAYLAND
- Ecore_Event_Handler *XClientMsgHandler = ecore_event_handler_add (ECORE_X_EVENT_CLIENT_MESSAGE, _client_message_cb, m_main_window);
-#endif
-
- signal(SIGQUIT, signal_handler);
- signal(SIGTERM, signal_handler);
- signal(SIGINT, signal_handler);
- signal(SIGHUP, signal_handler);
-
- evas_object_show (m_main_window);
-
- elm_run();
-
- vconf_ignore_key_changed(VCONFKEY_LANGSET, language_changed_cb);
- vconf_ignore_key_changed(VCONFKEY_SETAPPL_WIDGET_THEME_STR, theme_changed_cb);
- vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, accessibility_changed_cb);
-
-#ifndef WAYLAND
- if (XClientMsgHandler) {
- ecore_event_handler_del(XClientMsgHandler);
- XClientMsgHandler = NULL;
- }
-#endif
-
- if (fd_handler) {
- ecore_main_fd_handler_del(fd_handler);
- fd_handler = NULL;
- }
-
-#ifdef WAYLAND
-end:
-#endif
- elm_shutdown();
-}
-
-scim::HelperAgent* CISECommon::get_helper_agent()
-{
- return &m_helper_agent;
-}
-
-scluint CISECommon::get_number_of_helpers(void)
-{
- return 1;
-}
-
-sclboolean CISECommon::get_helper_info(scluint idx, scim::HelperInfo &info)
-{
- info = m_helper_info;
- return TRUE;
-}
-
-scim::String CISECommon::get_helper_language(scluint idx)
-{
- /* FIXME : We should return appropriate language locale string */
- std::vector<scim::String> langlist;
- langlist.push_back(m_supported_language);
- return scim::scim_combine_string_list(langlist);
-}
-
-void CISECommon::set_core_event_callback(IISECommonEventCallback *callback)
-{
- m_event_callback = callback;
-}
-
-Evas_Object* CISECommon::get_main_window()
-{
- return m_main_window;
-}
-
-void CISECommon::set_keyboard_size_hints(SclSize portrait, SclSize landscape)
-{
- LOGD ("portrait w : %d, h : %d, landscape w : %d, h : %d\n", portrait.width, portrait.height, landscape.width, landscape.height);
-
-#ifdef WAYLAND
- // FIXME : rotation doesn't be supported yet
- evas_object_resize(m_main_window, portrait.width, portrait.height);
-#else
- /* Temporary code, this should be automatically calculated when changing input mode */
- ecore_x_e_window_rotation_geometry_set(elm_win_xwindow_get(m_main_window), 0, 0, 0, portrait.width, portrait.height);
- ecore_x_e_window_rotation_geometry_set(elm_win_xwindow_get(m_main_window), 90, 0, 0, landscape.height, landscape.width);
- ecore_x_e_window_rotation_geometry_set(elm_win_xwindow_get(m_main_window), 180, 0, 0, portrait.width, portrait.height);
- ecore_x_e_window_rotation_geometry_set(elm_win_xwindow_get(m_main_window), 270, 0, 0, landscape.height, landscape.width);
-#endif
-}
-
-scim::String CISECommon::get_keyboard_ise_uuid()
-{
- return m_uuid_keyboard_ise;
-}
-
-IISECommonEventCallback* CISECommon::get_core_event_callback()
-{
- return m_event_callback;
-}
-
-void CISECommon::reload_config()
-{
- m_helper_agent.reload_config();
-}
-
-void CISECommon::send_imengine_event(sclint ic, const sclchar *ic_uuid, const sclint command, const sclu32 value)
-{
- scim::String uuid;
- if (ic_uuid) {
- uuid = scim::String(ic_uuid);
- }
- scim::Transaction trans;
- trans.put_command(command);
- trans.put_data (value);
- m_helper_agent.send_imengine_event(ic, uuid, trans);
-}
-
-void CISECommon::reset_keyboard_ise() {
- m_helper_agent.reset_keyboard_ise();
-}
-
-void CISECommon::send_key_event(sclint ic, const sclchar *ic_uuid, sclu32 keycode, sclu16 keymask)
-{
- scim::String uuid;
- if (ic_uuid) {
- uuid = scim::String(ic_uuid);
- }
- scim::KeyEvent event;
- event.code = keycode;
- event.mask = keymask;
- m_helper_agent.send_key_event(ic, uuid, event);
-}
-
-void CISECommon::forward_key_event(sclint ic, const sclchar *ic_uuid, sclu32 keycode, sclu16 keymask)
-{
- scim::String uuid;
- if (ic_uuid) {
- uuid = scim::String(ic_uuid);
- }
- scim::KeyEvent event;
- event.code = keycode;
- event.mask = keymask;
- m_helper_agent.forward_key_event(ic, uuid, event);
-}
-
-void CISECommon::select_candidate(int index)
-{
- m_helper_agent.select_candidate(index);
-}
-
-void CISECommon::commit_string(sclint ic, const sclchar *ic_uuid, const sclchar *str)
-{
- scim::String uuid;
- if (ic_uuid) {
- uuid = scim::String(ic_uuid);
- }
- m_helper_agent.commit_string(ic, uuid, scim::utf8_mbstowcs(str));
-}
-
-void CISECommon::show_preedit_string(sclint ic, const sclchar *ic_uuid)
-{
- scim::String uuid;
- if (ic_uuid) {
- uuid = scim::String(ic_uuid);
- }
- m_helper_agent.show_preedit_string(ic, uuid);
-}
-
-void CISECommon::show_aux_string(void)
-{
- m_helper_agent.show_aux_string();
-}
-
-void CISECommon::show_candidate_string(void)
-{
- m_helper_agent.show_candidate_string();
-}
-
-void CISECommon::show_associate_string(void)
-{
- m_helper_agent.show_associate_string();
-}
-
-void CISECommon::hide_preedit_string(sclint ic, const sclchar *ic_uuid)
-{
- scim::String uuid;
- if (ic_uuid) {
- uuid = scim::String(ic_uuid);
- }
- m_helper_agent.hide_preedit_string(ic, uuid);
-}
-
-void CISECommon::hide_aux_string(void)
-{
- m_helper_agent.hide_aux_string();
-}
-
-void CISECommon::hide_candidate_string(void)
-{
- m_helper_agent.hide_candidate_string();
-}
-
-void CISECommon::hide_associate_string(void)
-{
- m_helper_agent.hide_associate_string();
-}
-
-void CISECommon::update_preedit_string(sclint ic, const sclchar *ic_uuid, const sclchar *str)
-{
- scim::AttributeList list;
- scim::String uuid;
- if (ic_uuid) {
- uuid = scim::String(ic_uuid);
- }
- m_helper_agent.update_preedit_string(ic, uuid, scim::utf8_mbstowcs(str), list);
-
- if (str && strlen(str) > 0) {
- show_preedit_string(ic, ic_uuid);
- } else {
- hide_preedit_string(ic, ic_uuid);
- }
-}
-
-void CISECommon::update_aux_string(const sclchar *str)
-{
- scim::AttributeList list;
- m_helper_agent.update_aux_string(scim::String(str), list);
-}
-
-void CISECommon::update_input_context(sclu32 type, sclu32 value)
-{
- m_helper_agent.update_input_context(type, value);
-}
-
-void CISECommon::set_candidate_position(sclint left, sclint top)
-{
- m_helper_agent.set_candidate_position(left, top);
-}
-
-void CISECommon::candidate_hide(void)
-{
- m_helper_agent.candidate_hide();
-}
-
-void CISECommon::set_keyboard_ise_by_uuid(const sclchar *uuid)
-{
- if (uuid) {
- m_uuid_keyboard_ise = scim::String(uuid);
- if (g_keyboard_state.ic == g_keyboard_state.focused_ic) {
- LOGD("Calling helper_agent.set_keyboard_ise_by_uuid() : %s", uuid);
- m_helper_agent.set_keyboard_ise_by_uuid(m_uuid_keyboard_ise);
- }
- }
-}
-
-void CISECommon::get_keyboard_ise(const sclchar *uuid)
-{
- m_helper_agent.get_keyboard_ise(scim::String(uuid));
-}
-
-/* Slot functions for calling appropriate callback functions */
-void slot_exit (const scim::HelperAgent *agent, int ic, const scim::String &ic_uuid) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->ise_hide(ic, ic_uuid.c_str());
- callback->exit(ic, ic_uuid.c_str());
- }
- scim::HelperAgent *helper_agent = impl->get_helper_agent();
- if (helper_agent) {
- helper_agent->update_ise_exit();
- helper_agent->close_connection();
- }
- }
- elm_exit ();
-}
-
-void slot_attach_input_context (const scim::HelperAgent *agent, int ic, const scim::String &ic_uuid) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->attach_input_context(ic, ic_uuid.c_str());
- }
- }
-}
-
-void slot_detach_input_context (const scim::HelperAgent *agent, int ic, const scim::String &ic_uuid) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->detach_input_context(ic, ic_uuid.c_str());
- }
- }
-}
-
-void slot_reload_config (const scim::HelperAgent *agent, int ic, const scim::String &ic_uuid) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->reload_config(ic, ic_uuid.c_str());
- }
- }
-}
-
-void slot_update_screen (const scim::HelperAgent *agent, int ic, const scim::String &ic_uuid, int screen_number) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- //callback->update_screen(ic, ic_uuid.c_str(), screen_number);
- }
- }
-}
-
-void slot_update_spot_location (const scim::HelperAgent *agent, int ic, const scim::String &ic_uuid, int x, int y) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->update_spot_location(ic, ic_uuid.c_str(), x, y);
- }
- }
-}
-
-void slot_update_cursor_position (const scim::HelperAgent *agent, int ic, const scim::String &ic_uuid, int cursor_pos) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->update_cursor_position(ic, ic_uuid.c_str(), cursor_pos);
- }
- }
-}
-
-void slot_update_surrounding_text (const scim::HelperAgent *agent, int ic, const scim::String &text, int cursor) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->update_surrounding_text(ic, text.c_str(), cursor);
- }
- }
-}
-
-void slot_trigger_property (const scim::HelperAgent *agent, int ic, const scim::String &ic_uuid, const scim::String &property) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- //callback->trigger_property(ic, ic_uuid.c_str(), property.c_str());
- }
- }
-}
-
-//void slot_process_imengine_event (const HelperAgent *agent, int ic,
-// const String &ic_uuid, const Transaction transaction) {
-// CISECommon *impl = CISECommon::get_instance();
-// if (impl) {
-// IISECommonEventCallback *callback = impl->get_core_event_callback();
-// if (callback) {
-// callback->
-// }
-// }
-//}
-
-void slot_focus_out (const scim::HelperAgent *agent, int ic, const scim::String &ic_uuid) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->focus_out(ic, ic_uuid.c_str());
- }
- }
-}
-
-void slot_focus_in (const scim::HelperAgent *agent, int ic, const scim::String &ic_uuid) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->focus_in(ic, ic_uuid.c_str());
- }
- }
-}
-
-void slot_ise_show (const scim::HelperAgent *agent, int ic, char *buf, size_t &len) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- /* Make sure the appropriate keyboard ise was selected -> is this really necessary? */
- //impl->set_keyboard_ise_by_uuid(impl->get_keyboard_ise_uuid().c_str());
-
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- /* Check if effect is enabled */
- Ise_Context ise_context;
- memset(&ise_context, 0x00, sizeof(ise_context));
-
- if (len >= sizeof(Ise_Context)) {
- memcpy(&ise_context, buf, sizeof(ise_context));
-
- char imdata[IMDATA_STRING_MAX_LEN] = {0,};
- if (ise_context.imdata_size > 0 && ise_context.imdata_size < IMDATA_STRING_MAX_LEN) {
- memcpy((void *)imdata, buf+sizeof(ise_context), ise_context.imdata_size);
- set_ise_imdata(imdata, (size_t&)ise_context.imdata_size);
- }
- } else {
- LOGD("\n-=-= WARNING - buf %p len %d size %d \n", buf, len, sizeof(ise_context));
- }
- callback->ise_show(ic, get_app_window_degree(impl->get_main_window()), ise_context);
- }
- }
-}
-
-void slot_ise_hide (const scim::HelperAgent *agent, int ic, const scim::String &ic_uuid) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->ise_hide(ic, ic_uuid.c_str());
- }
- }
-}
-
-void slot_get_geometry (const scim::HelperAgent *agent, struct scim::rectinfo &info) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->get_geometry(&(info.pos_x), &(info.pos_y), &(info.width), &(info.height));
- }
- }
-}
-
-void slot_set_mode (const scim::HelperAgent *agent, scim::uint32 &mode) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->set_mode(mode);
- }
- }
-}
-
-void slot_set_language (const scim::HelperAgent *agent, scim::uint32 &language) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->set_language(language);
- }
- }
-}
-
-void slot_set_imdata (const scim::HelperAgent *agent, char *buf, size_t &len) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->set_imdata(buf, len);
- }
- }
-}
-
-void slot_get_imdata (const scim::HelperAgent *, char **buf, size_t &len) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- sclu32 _len = 0;
- callback->get_imdata(buf, &_len);
- len = _len;
- }
- }
-}
-
-void slot_get_language_locale (const scim::HelperAgent *, int ic, char **locale) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->get_language_locale(ic, locale);
- }
- }
-}
-
-void slot_set_return_key_type (const scim::HelperAgent *agent, scim::uint32 &type) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->set_return_key_type(type);
- }
- }
-}
-
-void slot_get_return_key_type (const scim::HelperAgent *agent, scim::uint32 &type) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->get_return_key_type(&type);
- }
- }
-}
-
-void slot_set_return_key_disable (const scim::HelperAgent *agent, scim::uint32 &disabled) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->set_return_key_disable(disabled);
- }
- }
-}
-
-void slot_get_return_key_disable (const scim::HelperAgent *agent, scim::uint32 &disabled) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->get_return_key_disable(&disabled);
- }
- }
-}
-
-void slot_set_layout (const scim::HelperAgent *agent, scim::uint32 &layout) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->set_layout(layout);
- }
- }
-}
-
-void slot_get_layout (const scim::HelperAgent *agent, scim::uint32 &layout) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->get_layout(&layout);
- }
- }
-}
-
-void slot_set_caps_mode (const scim::HelperAgent *agent, scim::uint32 &mode) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->set_caps_mode(mode);
- }
- }
-}
-
-void slot_reset_input_context (const scim::HelperAgent *agent, int ic, const scim::String &uuid) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->reset_input_context(ic, uuid.c_str());
- }
- }
-}
-
-void slot_update_candidate_geometry (const scim::HelperAgent *agent, int ic, const scim::String &uuid, const scim::rectinfo &info) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->update_candidate_geometry(ic, uuid.c_str(), info.pos_x, info.pos_y, info.width, info.height);
- }
- }
-}
-void slot_update_keyboard_ise (const scim::HelperAgent *agent, int ic, const scim::String &uuid,
- const scim::String &ise_name, const scim::String &ise_uuid) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->update_keyboard_ise(ic, uuid.c_str(), ise_name.c_str(), ise_uuid.c_str());
- }
- }
-}
-
-//void slot_update_keyboard_ise_list (const HelperAgent *agent, int ic, const String &uuid,
-// const std::vector<String> &ise_list) {
-// CISECommon *impl = CISECommon::get_instance();
-// if (impl) {
-// IISECommonEventCallback *callback = impl->get_core_event_callback();
-// if (callback) {
-// callback->get_layout(&layout);
-// }
-// }
-//}
-
-void slot_candidate_more_window_show (const scim::HelperAgent *agent, int ic, const scim::String &uuid) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->candidate_more_window_show(ic, uuid.c_str());
- }
- }
-}
-
-void slot_candidate_more_window_hide (const scim::HelperAgent *agent, int ic, const scim::String &uuid) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->candidate_more_window_hide(ic, uuid.c_str());
- }
- }
-}
-
-void slot_select_aux (const scim::HelperAgent *agent, int ic, const scim::String &uuid, int index) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->select_aux(ic, uuid.c_str(), index);
- }
- }
-}
-
-void slot_select_candidate (const scim::HelperAgent *agent, int ic, const scim::String &uuid, int index) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->select_candidate(ic, uuid.c_str(), index);
- }
- }
-}
-
-void slot_candidate_table_page_up (const scim::HelperAgent *agent, int ic, const scim::String &uuid) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->candidate_table_page_up(ic, uuid.c_str());
- }
- }
-}
-
-void slot_candidate_table_page_down (const scim::HelperAgent *agent, int ic, const scim::String &uuid) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->candidate_table_page_down(ic, uuid.c_str());
- }
- }
-}
-
-void slot_update_candidate_table_page_size (const scim::HelperAgent *, int ic, const scim::String &uuid, int page_size) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->update_candidate_table_page_size(ic, uuid.c_str(), page_size);
- }
- }
-}
-
-void slot_update_lookup_table (const scim::HelperAgent *, scim::LookupTable &table) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->update_lookup_table(table);
- }
- }
-}
-
-void slot_select_associate (const scim::HelperAgent *agent, int ic, const scim::String &uuid, int index) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->select_associate(ic, uuid.c_str(), index);
- }
- }
-}
-
-void slot_associate_table_page_up (const scim::HelperAgent *agent, int ic, const scim::String &uuid) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->associate_table_page_up(ic, uuid.c_str());
- }
- }
-}
-
-void slot_associate_table_page_down (const scim::HelperAgent *agent, int ic, const scim::String &uuid) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->associate_table_page_down(ic, uuid.c_str());
- }
- }
-}
-
-void slot_update_associate_table_page_size (const scim::HelperAgent *, int ic, const scim::String &uuid, int page_size) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->update_associate_table_page_size(ic, uuid.c_str(), page_size);
- }
- }
-}
-
-void slot_turn_on_log (const scim::HelperAgent *agent, scim::uint32 &on) {
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- callback->turn_on_log(on);
- }
- }
-}
-
-void slot_process_key_event (const scim::HelperAgent *agent, scim::KeyEvent& key, scim::uint32 &ret) {
-
- ret = false;
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- IISECommonEventCallback *callback = impl->get_core_event_callback();
- if (callback) {
- if (callback->process_key_event(key.get_key_string().c_str())) {
- ret = true;
- }
- }
- }
-}
-
-/* Internal signal handler function */
-void signal_handler(int sig) {
- elm_exit();
-}
-
-/* Internal input handler function */
-Eina_Bool input_handler (void *data, Ecore_Fd_Handler *fd_handler)
-{
- CISECommon *impl = CISECommon::get_instance();
- if (impl) {
- scim::HelperAgent *agent = impl->get_helper_agent();
- if (agent) {
- if (agent->has_pending_event()) {
- if (!(agent->filter_event())) {
- LOGD("helper_agent.filter_event() failed!!!\n");
- impl->exit();
- elm_exit();
- }
- } else {
- LOGD("helper_agent.has_pending_event() failed!!!\n");
- impl->exit();
- elm_exit();
- }
- }
- }
-
- return ECORE_CALLBACK_RENEW;
-}
-
-void CISECommon::register_slot_functions()
-{
- m_helper_agent.signal_connect_exit (scim::slot (slot_exit));
- m_helper_agent.signal_connect_attach_input_context (scim::slot (slot_attach_input_context));
- m_helper_agent.signal_connect_detach_input_context (scim::slot (slot_detach_input_context));
- m_helper_agent.signal_connect_reload_config (scim::slot (slot_reload_config));
- m_helper_agent.signal_connect_update_screen (scim::slot (slot_update_screen));
- m_helper_agent.signal_connect_update_spot_location (scim::slot (slot_update_spot_location));
- m_helper_agent.signal_connect_update_cursor_position (scim::slot (slot_update_cursor_position));
- m_helper_agent.signal_connect_update_surrounding_text (scim::slot (slot_update_surrounding_text));
- m_helper_agent.signal_connect_trigger_property (scim::slot (slot_trigger_property));
- //m_helper_agent.signal_connect_process_imengine_event (slot (slot_process_imengine_event));
- m_helper_agent.signal_connect_focus_out (scim::slot (slot_focus_out));
- m_helper_agent.signal_connect_focus_in (scim::slot (slot_focus_in));
- m_helper_agent.signal_connect_ise_show (scim::slot (slot_ise_show));
- m_helper_agent.signal_connect_ise_hide (scim::slot (slot_ise_hide));
- m_helper_agent.signal_connect_get_geometry (scim::slot (slot_get_geometry));
- m_helper_agent.signal_connect_set_mode (scim::slot (slot_set_mode));
- m_helper_agent.signal_connect_set_language (scim::slot (slot_set_language));
- m_helper_agent.signal_connect_set_imdata (scim::slot (slot_set_imdata));
- m_helper_agent.signal_connect_get_imdata (scim::slot (slot_get_imdata));
- m_helper_agent.signal_connect_get_language_locale (scim::slot (slot_get_language_locale));
- m_helper_agent.signal_connect_set_return_key_type (scim::slot (slot_set_return_key_type));
- m_helper_agent.signal_connect_get_return_key_type (scim::slot (slot_get_return_key_type));
- m_helper_agent.signal_connect_set_return_key_disable (scim::slot (slot_set_return_key_disable));
- m_helper_agent.signal_connect_get_return_key_disable (scim::slot (slot_get_return_key_disable));
- m_helper_agent.signal_connect_get_layout (scim::slot (slot_get_layout));
- m_helper_agent.signal_connect_set_layout (scim::slot (slot_set_layout));
- m_helper_agent.signal_connect_set_caps_mode (scim::slot (slot_set_caps_mode));
- m_helper_agent.signal_connect_reset_input_context (scim::slot (slot_reset_input_context));
- m_helper_agent.signal_connect_update_candidate_geometry (scim::slot (slot_update_candidate_geometry));
- m_helper_agent.signal_connect_update_keyboard_ise (scim::slot (slot_update_keyboard_ise));
- //m_helper_agent.signal_connect_update_keyboard_ise_list (slot (slot_update_keyboard_ise_list));
- m_helper_agent.signal_connect_candidate_more_window_show (scim::slot (slot_candidate_more_window_show));
- m_helper_agent.signal_connect_candidate_more_window_hide (scim::slot (slot_candidate_more_window_hide));
- m_helper_agent.signal_connect_select_aux (scim::slot (slot_select_aux));
- m_helper_agent.signal_connect_select_candidate (scim::slot (slot_select_candidate));
- m_helper_agent.signal_connect_candidate_table_page_up (scim::slot (slot_candidate_table_page_up));
- m_helper_agent.signal_connect_candidate_table_page_down (scim::slot (slot_candidate_table_page_down));
- m_helper_agent.signal_connect_update_candidate_table_page_size (scim::slot (slot_update_candidate_table_page_size));
- m_helper_agent.signal_connect_update_lookup_table (scim::slot (slot_update_lookup_table));
- m_helper_agent.signal_connect_select_associate (scim::slot (slot_select_associate));
- m_helper_agent.signal_connect_associate_table_page_up (scim::slot (slot_associate_table_page_up));
- m_helper_agent.signal_connect_associate_table_page_down (scim::slot (slot_associate_table_page_down));
- m_helper_agent.signal_connect_update_associate_table_page_size (scim::slot (slot_update_associate_table_page_size));
- m_helper_agent.signal_connect_turn_on_log (scim::slot (slot_turn_on_log));
- m_helper_agent.signal_connect_process_key_event (scim::slot (slot_process_key_event));
-}
*
*/
-#define Uses_SCIM_CONFIG_BASE
+#include <string>
+#include <vector>
+#include <sstream>
+#include <iterator>
-#include <scim.h>
-#include <scl.h>
+#include <sclcore.h>
#include "config.h"
#include "languages.h"
-using namespace scim;
using namespace scl;
-extern ConfigPointer _scim_config;
+extern CSCLCore g_core;
CONFIG_VALUES::CONFIG_VALUES() {
keypad_mode = KEYPAD_MODE_QTY; // keypad_mode
CONFIG_VALUES g_config_values;
void read_ise_config_values() {
- if (_scim_config) {
- _scim_config->reload();
- g_config_values.keypad_mode =
- (KEYPAD_MODE)(_scim_config->read(String(ISE_CONFIG_KEYPAD_MODE), g_config_values.keypad_mode));
- g_config_values.prediction_on =
- _scim_config->read (String (ISE_CONFIG_PREDICTION_ON), g_config_values.prediction_on);
- g_config_values.enabled_languages =
- _scim_config->read(String(ISE_CONFIG_ENABLED_LANGUAGES), g_config_values.enabled_languages);
- g_config_values.selected_language =
- _scim_config->read(String(ISE_CONFIG_SELECTED_LANGUAGE), g_config_values.selected_language);
+ g_core.config_reload();
+ sclint integer_value;
+ std::string string_value;
+
+ if (g_core.config_read_int(ISE_CONFIG_KEYPAD_MODE, integer_value)) {
+ g_config_values.keypad_mode = static_cast<KEYPAD_MODE>(integer_value);
+ }
+ if (g_core.config_read_int(ISE_CONFIG_PREDICTION_ON, integer_value)) {
+ g_config_values.prediction_on = integer_value;
+ }
+ if (g_core.config_read_string(ISE_CONFIG_ENABLED_LANGUAGES, string_value)) {
+ std::stringstream ss(string_value);
+ std::istream_iterator<std::string> begin(ss);
+ std::istream_iterator<std::string> end;
+ std::vector<std::string> vstrings(begin, end);
+ g_config_values.enabled_languages = vstrings;
+ }
+ if (g_core.config_read_string(ISE_CONFIG_SELECTED_LANGUAGE, string_value)) {
+ g_config_values.selected_language = string_value;
}
}
void write_ise_config_values() {
- if (_scim_config) {
- _scim_config->write(String(ISE_CONFIG_KEYPAD_MODE), g_config_values.keypad_mode);
- _scim_config->write(String(ISE_CONFIG_PREDICTION_ON), g_config_values.prediction_on);
- _scim_config->write(String(ISE_CONFIG_ENABLED_LANGUAGES), g_config_values.enabled_languages);
- _scim_config->write(String(ISE_CONFIG_SELECTED_LANGUAGE), g_config_values.selected_language);
-
- _scim_config->flush ();
+ std::string string_value;
+ g_core.config_write_int(ISE_CONFIG_KEYPAD_MODE, g_config_values.keypad_mode);
+ g_core.config_write_int(ISE_CONFIG_PREDICTION_ON, g_config_values.prediction_on);
+ for(std::vector<std::string>::iterator it = g_config_values.enabled_languages.begin();
+ it != g_config_values.enabled_languages.end();std::advance(it, 1)) {
+ string_value += *it;
+ string_value += " ";
}
+ g_core.config_write_string(ISE_CONFIG_ENABLED_LANGUAGES, string_value);
+ g_core.config_write_string(ISE_CONFIG_SELECTED_LANGUAGE, g_config_values.selected_language);
+ g_core.config_reload();
}
void erase_ise_config_values() {
- if (_scim_config) {
- _scim_config->erase(String(ISE_CONFIG_KEYPAD_MODE));
- _scim_config->erase(String(ISE_CONFIG_PREDICTION_ON));
- _scim_config->erase(String(ISE_CONFIG_ENABLED_LANGUAGES));
- _scim_config->erase(String(ISE_CONFIG_SELECTED_LANGUAGE));
-
- _scim_config->flush ();
- }
-}
+ g_core.config_erase(ISE_CONFIG_KEYPAD_MODE);
+ g_core.config_erase(ISE_CONFIG_PREDICTION_ON);
+ g_core.config_erase(ISE_CONFIG_ENABLED_LANGUAGES);
+ g_core.config_erase(ISE_CONFIG_SELECTED_LANGUAGE);
+ g_core.config_reload();
+}
\ No newline at end of file
#include <string>
#include <vector>
-#include <scl.h>
+#include <sclcommon.h>
#ifndef __CONFIG_H__
#define __CONFIG_H__
#define ISE_CONFIG_ENABLED_LANGUAGES "/ise-default/enabled_languages"
#define ISE_CONFIG_SELECTED_LANGUAGE "/ise-default/selected_language"
+using namespace scl;
+
enum KEYPAD_MODE {
KEYPAD_MODE_3X4,
KEYPAD_MODE_QTY,
#ifndef _ISE_H_
#define _ISE_H_
-#include <scl.h>
-#include <Ecore.h>
-#include <Evas.h>
-#include <Ecore_Evas.h>
-#include <Ecore_IMF.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* */
-#include <vector>
+#include <sclcore.h>
#include <string>
+
+#include <Elementary.h>
+
#include "languages.h"
-#define ISE_VERSION "1.0.8-1"
+#define ISEUUID "12aa3425-f88d-45f4-a509-cee8dfe904e3"
+#define ISENAME "Tizen keyboard"
+
+#define ISE_VERSION "1.1.0-1"
#define LOCALEDIR "/usr/share/locale"
#define PRIMARY_LATIN_LANGUAGE "English"
sclboolean visible_state;
} KEYBOARD_STATE;
+using namespace scl;
+
+class CCoreEventCallback : public ISCLCoreEventCallback
+{
+ void on_get_app_info(SclCoreAppInfo *info);
+
+ void on_init();
+ void on_exit();
+
+ void on_attach_input_context(sclint ic, const sclchar *ic_uuid);
+ void on_detach_input_context(sclint ic, const sclchar *ic_uuid);
+
+ void on_focus_out(sclint ic, const sclchar *ic_uuid);
+ void on_focus_in(sclint ic, const sclchar *ic_uuid);
+
+ void on_ise_show(sclint ic, const sclint degree, Ise_Context context);
+ void on_ise_hide(sclint ic, const sclchar *ic_uuid);
+
+ void on_reset_input_context(sclint ic, const sclchar *uuid);
+
+ void on_set_display_language(const sclchar *language);
+ void on_set_accessibility_state(const sclboolean state);
+ void on_set_rotation_degree(sclint degree);
+
+ void on_set_caps_mode(sclu32 mode);
+ void on_update_cursor_position(sclint ic, const sclchar *ic_uuid, sclint cursor_pos);
+
+ void on_set_return_key_type(sclu32 type);
+ void on_set_return_key_disable(sclu32 disabled);
+
+ void on_set_imdata(sclchar *buf, sclu32 len);
+ void on_get_language_locale(sclint ic, sclchar **locale);
+ void on_update_lookup_table(SclCandidateTable &table);
+
+ void on_create_option_window(sclwindow window, SCLOptionWindowType type);
+ void on_destroy_option_window(sclwindow window);
+};
+
void ise_send_string(const sclchar *key_value);
void ise_update_preedit_string(const sclchar *str);
void ise_send_event(sclulong key_event, sclulong key_mask);
#include <string>
#include <vector>
-#include <scl.h>
+#include <sclui.h>
+
+using namespace scl;
enum LANGUAGE_PRIORITY {
LANGAUGE_PRIORITY_NONE,
LANGUAGE_PRIORITY_SPECIALIZED,
};
-struct ILanguageCallback : public scl::ISCLUIEventCallback {
+struct ILanguageCallback : public ISCLUIEventCallback {
/* Default callback functions inherited from scl::ISCLUIEventCallback */
/* FIXME scl::SCLEventReturnType */
- virtual SCLEventReturnType on_event_key_clicked(scl::SclUIEventDesc ui_event_desc) { return SCL_EVENT_PASS_ON; }
- virtual SCLEventReturnType on_event_drag_state_changed(scl::SclUIEventDesc ui_event_desc) { return SCL_EVENT_PASS_ON; }
+ virtual SCLEventReturnType on_event_key_clicked(SclUIEventDesc ui_event_desc) { return SCL_EVENT_PASS_ON; }
+ virtual SCLEventReturnType on_event_drag_state_changed(SclUIEventDesc ui_event_desc) { return SCL_EVENT_PASS_ON; }
virtual SCLEventReturnType on_event_notification(SCLUINotiType noti_type, sclint etc_info) { return SCL_EVENT_PASS_ON; }
/* Additional callback function, which is called when this language is selected */
*
*/
-#include <scl.h>
-
#include "ise.h"
#include "config.h"
#define ITEM_DATA_STRING_LEN 64
struct ITEMDATA
{
- sclchar main_text[ITEM_DATA_STRING_LEN];
- sclchar sub_text[ITEM_DATA_STRING_LEN];
- sclint mode;
+ char main_text[ITEM_DATA_STRING_LEN];
+ char sub_text[ITEM_DATA_STRING_LEN];
+ int mode;
ITEMDATA()
{
- memset(main_text, 0, sizeof(sclchar)*ITEM_DATA_STRING_LEN);
- memset(sub_text, 0, sizeof(sclchar)*ITEM_DATA_STRING_LEN);
+ memset(main_text, 0, sizeof(char)*ITEM_DATA_STRING_LEN);
+ memset(sub_text, 0, sizeof(char)*ITEM_DATA_STRING_LEN);
mode = 0;
}
};
public:
static void add_language_option(ILanguageOption *language_option);
static scluint get_language_options_num();
- static ILanguageOption* get_language_option_info(scluint index);
+ static ILanguageOption* get_language_option_info(unsigned int index);
private:
static std::vector<ILanguageOption*> language_option_vector;
};
*
**/
void
-open_option_window(Evas_Object *parent, sclint degree);
+option_window_created(Evas_Object *window, SCLOptionWindowType type);
/**
* Closes option window
*
**/
void
-close_option_window();
+option_window_destroyed(Evas_Object *window);
void
read_options();
#include <X11/XF86keysym.h>
#endif
-#include <vconf.h>
-#include <vconf-keys.h>
-
-#include "scl.h"
+#include "sclui.h"
+#include "sclcore.h"
#include "ise.h"
#include "utils.h"
#include "option.h"
-#include "common.h"
#include "languages.h"
#include "candidate-factory.h"
#define CANDIDATE_WINDOW_HEIGHT 84
#include <vector>
using namespace std;
-CSCLUI *gSCLUI = NULL;
-extern CISECommon *g_ise_common;
+CSCLUI *g_ui = NULL;
+
+#include <sclcore.h>
+
+#include "ise.h"
+
+static CCoreEventCallback g_core_event_callback;
+CSCLCore g_core(&g_core_event_callback);
+
extern CONFIG_VALUES g_config_values;
static sclboolean g_need_send_shift_event = FALSE;
#ifdef WAYLAND
int gLastIC = 0;
#endif
+extern void set_ise_imdata(const char * buf, size_t &len);
+
KEYBOARD_STATE g_keyboard_state = {
0,
0,
const MultiEventDesc &multidesc = dynamic_cast<const MultiEventDesc &>(desc);
switch (multidesc.type) {
case MultiEventDesc::CANDIDATE_ITEM_MOUSE_DOWN:
- g_ise_common->select_candidate(multidesc.index);
+ g_core.select_candidate(multidesc.index);
break;
case MultiEventDesc::CANDIDATE_MORE_VIEW_SHOW:
// when more parts shows, click on the candidate will
// not affect the key click event
- gSCLUI->disable_input_events(TRUE);
+ g_ui->disable_input_events(TRUE);
break;
case MultiEventDesc::CANDIDATE_MORE_VIEW_HIDE:
- gSCLUI->disable_input_events(FALSE);
+ g_ui->disable_input_events(FALSE);
break;
default: break;
}
return FALSE;
}
+void CCoreEventCallback::on_get_app_info(SclCoreAppInfo *info)
+{
+ LOGD("CCoreEventCallback::on_get_app_info()\n");
+ if (info) {
+ info->name = ISENAME;
+ info->uuid = ISEUUID;
+ info->language = "en_US";
+ }
+}
+
+void CCoreEventCallback::on_init()
+{
+ LOGD("CCoreEventCallback::init()\n");
+ ise_create();
+}
+
+void CCoreEventCallback::on_exit()
+{
+ ::ise_hide();
+ ise_destroy();
+}
+
+void CCoreEventCallback::on_attach_input_context(sclint ic, const sclchar *ic_uuid)
+{
+ ise_attach_input_context(ic);
+}
+
+void CCoreEventCallback::on_detach_input_context(sclint ic, const sclchar *ic_uuid)
+{
+ ise_detach_input_context(ic);
+}
+
+void CCoreEventCallback::on_focus_in(sclint ic, const sclchar *ic_uuid)
+{
+ ise_focus_in(ic);
+}
+
+void CCoreEventCallback::on_focus_out(sclint ic, const sclchar *ic_uuid)
+{
+ ise_focus_out(ic);
+}
+
+void CCoreEventCallback::on_ise_show(sclint ic, const sclint degree, Ise_Context context)
+{
+ //g_ise_common->set_keyboard_ise_by_uuid(KEYBD_ISE_UUID);
+
+ ise_reset_context(); // reset ISE
+
+ /*if (context.language == ECORE_IMF_INPUT_PANEL_LANG_ALPHABET) {
+ ise_explictly_set_language(PRIMARY_LATIN_LANGUAGE_INDEX);
+ }*/
+
+ ise_set_layout(context.layout);
+
+ ise_set_return_key_type(context.return_key_type);
+ ise_set_return_key_disable(context.return_key_disabled);
+
+ ise_set_caps_mode(context.caps_mode);
+ ise_update_cursor_position(context.cursor_pos);
+
+ /* Do not follow the application's rotation angle if we are already in visible state,
+ since in that case we will receive the angle through ROTATION_CHANGE_REQUEST message */
+ if (!(g_keyboard_state.visible_state)) {
+ ise_set_screen_rotation(degree);
+ } else {
+ LOGD("Skipping rotation angle , %d", degree);
+ }
+
+ ::ise_show(ic);
+}
+
+void CCoreEventCallback::on_ise_hide(sclint ic, const sclchar *ic_uuid)
+{
+ ::ise_hide();
+}
+
+void CCoreEventCallback::on_reset_input_context(sclint ic, const sclchar *uuid)
+{
+ ise_reset_input_context();
+}
+
+void CCoreEventCallback::on_set_display_language(const sclchar *language)
+{
+ setlocale(LC_ALL, language);
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
+ LOGD("Language : %s\n", (language ? language : "NULL"));
+}
+
+void CCoreEventCallback::on_set_accessibility_state(const sclboolean state)
+{
+ ise_set_accessibility_state(state);
+}
+
+void CCoreEventCallback::on_set_rotation_degree(sclint degree)
+{
+ ise_set_screen_rotation(degree);
+}
+
+void CCoreEventCallback::on_set_caps_mode(sclu32 mode)
+{
+ ise_set_caps_mode(mode);
+}
+
+void CCoreEventCallback::on_update_cursor_position(sclint ic, const sclchar *ic_uuid, sclint cursor_pos)
+{
+ ise_update_cursor_position(cursor_pos);
+}
+
+void CCoreEventCallback::on_set_return_key_type (sclu32 type)
+{
+ ise_set_return_key_type(type);
+}
+
+void CCoreEventCallback::on_set_return_key_disable (sclu32 disabled)
+{
+ ise_set_return_key_disable(disabled);
+}
+
+void CCoreEventCallback::on_set_imdata(sclchar *buf, sclu32 len)
+{
+ set_ise_imdata(buf, len);
+}
+
+void CCoreEventCallback::on_get_language_locale(sclint ic, sclchar **locale)
+{
+ ise_get_language_locale(locale);
+}
+
+void CCoreEventCallback::on_update_lookup_table(SclCandidateTable &table)
+{
+ vector<string> vec_str;
+ //printf("candidate num: %d, current_page_size: %d\n",
+ // table.number_of_candidates(), table.get_current_page_size());
+ for (int i = table.current_page_start; i < table.current_page_start + table.page_size; ++i)
+ {
+ if (i < table.candidate_labels.size()) {
+ vec_str.push_back(table.candidate_labels[i]);
+ }
+ }
+ ise_update_table(vec_str);
+}
+
+void CCoreEventCallback::on_create_option_window(sclwindow window, SCLOptionWindowType type)
+{
+ if (window) {
+ option_window_created(NATIVE_WINDOW_CAST(window), type);
+ }
+}
+
+void CCoreEventCallback::on_destroy_option_window(sclwindow window)
+{
+ option_window_destroyed(NATIVE_WINDOW_CAST(window));
+}
+
/**
* Send the given string to input framework
*/
if (!check_ic_temporary(g_keyboard_state.ic)) {
ic = g_keyboard_state.ic;
}
- g_ise_common->hide_preedit_string(ic, "");
- g_ise_common->commit_string(ic, "", key_value);
+ g_core.hide_preedit_string(ic, "");
+ g_core.commit_string(ic, "", key_value);
LOGD("ic : %x, %s", ic, key_value);
}
if (!check_ic_temporary(g_keyboard_state.ic)) {
ic = g_keyboard_state.ic;
}
- g_ise_common->update_preedit_string(ic, "", str);
+ g_core.update_preedit_string(ic, "", str);
LOGD("ic : %x, %s", ic, str);
}
if (!check_ic_temporary(g_keyboard_state.ic)) {
ic = g_keyboard_state.ic;
}
- g_ise_common->send_key_event(ic, "", key_event, scim::SCIM_KEY_NullMask);
- g_ise_common->send_key_event(ic, "", key_event, scim::SCIM_KEY_ReleaseMask);
+ g_core.send_key_event(ic, "", key_event, KEY_MASK_NULL);
+ g_core.send_key_event(ic, "", key_event, KEY_MASK_RELEASE);
LOGD("ic : %x, %x", ic, key_event);
}
if (!check_ic_temporary(g_keyboard_state.ic)) {
ic = g_keyboard_state.ic;
}
- g_ise_common->forward_key_event(ic, "", key_event, scim::SCIM_KEY_NullMask);
- g_ise_common->forward_key_event(ic, "", key_event, scim::SCIM_KEY_ReleaseMask);
+ g_core.forward_key_event(ic, "", key_event, KEY_MASK_NULL);
+ g_core.forward_key_event(ic, "", key_event, KEY_MASK_RELEASE);
LOGD("ic : %x, %x", ic, key_event);
}
static void set_caps_mode(sclint mode) {
- if (gSCLUI->get_shift_state() != SCL_SHIFT_STATE_LOCK) {
- gSCLUI->set_shift_state(mode ? SCL_SHIFT_STATE_ON : SCL_SHIFT_STATE_OFF);
+ if (g_ui) {
+ if (g_ui->get_shift_state() != SCL_SHIFT_STATE_LOCK) {
+ g_ui->set_shift_state(mode ? SCL_SHIFT_STATE_ON : SCL_SHIFT_STATE_OFF);
+ }
}
}
static sclboolean
{
sclboolean ret = FALSE;
- if (gSCLUI) {
+ if (g_ui) {
if (key_value) {
if (strcmp(key_value, "CUR_LANG") == 0) {
ret = _language_manager.select_current_language();
LANGUAGE_INFO *info = _language_manager.get_language_info(_language_manager.get_current_language());
if (info) {
if (info->accepts_caps_mode) {
- ise_send_event(MVK_Shift_Enable, scim::SCIM_KEY_NullMask);
+ ise_send_event(MVK_Shift_Enable, KEY_MASK_NULL);
set_caps_mode(g_keyboard_state.caps_mode);
} else {
- ise_send_event(MVK_Shift_Disable, scim::SCIM_KEY_NullMask);
- gSCLUI->set_shift_state(SCL_SHIFT_STATE_OFF);
+ ise_send_event(MVK_Shift_Disable, KEY_MASK_NULL);
+ g_ui->set_shift_state(SCL_SHIFT_STATE_OFF);
}
}
}
if (info && desc) {
if (info->accepts_caps_mode) {
if (desc->shift_state == SCL_SHIFT_STATE_OFF) {
- ise_send_event(MVK_Shift_Off, scim::SCIM_KEY_NullMask);
+ ise_send_event(MVK_Shift_Off, KEY_MASK_NULL);
}
else if (desc->shift_state == SCL_SHIFT_STATE_ON) {
- ise_send_event(MVK_Shift_On, scim::SCIM_KEY_NullMask);
+ ise_send_event(MVK_Shift_On, KEY_MASK_NULL);
}
else if (desc->shift_state == SCL_SHIFT_STATE_LOCK) {
- ise_send_event(MVK_Shift_Lock, scim::SCIM_KEY_NullMask);
+ ise_send_event(MVK_Shift_Lock, KEY_MASK_NULL);
}
ret = SCL_EVENT_PASS_ON;
}
{
SCLEventReturnType ret = SCL_EVENT_PASS_ON;
- if (gSCLUI) {
+ if (g_ui) {
switch (event_desc.key_type) {
case KEY_TYPE_STRING:
if (event_desc.key_modifier != KEY_MODIFIER_MULTITAP_START &&
case KEY_TYPE_CHAR: {
sclboolean need_forward = FALSE;
// FIXME : Should decide when to forward key events
- const sclchar *input_mode = gSCLUI->get_input_mode();
+ const sclchar *input_mode = g_ui->get_input_mode();
if (input_mode) {
if (strcmp(input_mode, "SYM_QTY_1") == 0 ||
strcmp(input_mode, "SYM_QTY_2") == 0 ||
if (need_forward) {
ise_forward_key_event(event_desc.key_event);
} else {
- ise_send_event(event_desc.key_event, scim::SCIM_KEY_NullMask);
+ ise_send_event(event_desc.key_event, KEY_MASK_NULL);
}
}
break;
}
case KEY_TYPE_CONTROL: {
if (event_desc.key_event) {
- ise_send_event(event_desc.key_event, scim::SCIM_KEY_NullMask);
+ ise_send_event(event_desc.key_event, KEY_MASK_NULL);
if (event_desc.key_event == MVK_Shift_L) {
g_need_send_shift_event = TRUE;
}
break;
case KEY_TYPE_USER:
if (strcmp(event_desc.key_value, USER_KEYSTRING_OPTION) == 0) {
- open_option_window(NULL, ROTATION_TO_DEGREE(gSCLUI->get_rotation()));
+ //open_option_window(NULL, ROTATION_TO_DEGREE(g_ui->get_rotation()));
+ g_core.create_option_window();
ret = SCL_EVENT_DONE;
}
break;
}
g_keyboard_state.focused_ic = ic;
if (ic == g_keyboard_state.ic) {
- if (g_ise_common) {
- if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_PHONENUMBER ||
- 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_ise_common->set_keyboard_ise_by_uuid(DEFAULT_KEYBOARD_ISE_UUID);
- } else {
- g_ise_common->set_keyboard_ise_by_uuid(g_ise_common->get_keyboard_ise_uuid().c_str());
- }
+ if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_PHONENUMBER ||
+ 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);
}
}
}
ise_show(int ic)
{
sclboolean reset_inputmode = FALSE;
- if (gSCLUI && g_ise_common) {
+ if (g_ui) {
read_ise_config_values();
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_ise_common->set_keyboard_ise_by_uuid(DEFAULT_KEYBOARD_ISE_UUID);
+ g_core.set_keyboard_ise_by_uuid(DEFAULT_KEYBOARD_ISE_UUID);
}
}
}
g_keyboard_state.ic = ic;
/* Reset input mode if the current language is not the selected language */
- if (g_config_values.selected_language.compare(
- _language_manager.get_current_language()) != 0) {
+ if (g_config_values.selected_language.compare(_language_manager.get_current_language()) != 0) {
reset_inputmode = TRUE;
}
/* No matter what, just reset the inputmode if it needs to */
/* Turn the shift state off if we need to reset our input mode, only when auto-capitalization is not set */
if (!(g_keyboard_state.caps_mode)) {
- gSCLUI->set_shift_state(SCL_SHIFT_STATE_OFF);
+ g_ui->set_shift_state(SCL_SHIFT_STATE_OFF);
}
if (g_keyboard_state.layout < ISE_LAYOUT_STYLE_MAX) {
/* If this layout requires specific input mode, set it */
if (strlen(g_ise_default_values[g_keyboard_state.layout].input_mode) > 0) {
- gSCLUI->set_input_mode(g_ise_default_values[g_keyboard_state.layout].input_mode);
+ g_ui->set_input_mode(g_ise_default_values[g_keyboard_state.layout].input_mode);
- SclSize size_portrait = gSCLUI->get_input_mode_size(gSCLUI->get_input_mode(), DISPLAYMODE_PORTRAIT);
- SclSize size_landscape = gSCLUI->get_input_mode_size(gSCLUI->get_input_mode(), DISPLAYMODE_LANDSCAPE);
- g_ise_common->set_keyboard_size_hints(size_portrait, size_landscape);
+ 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);
} else {
if (force_primary_latin) {
_language_manager.select_language(PRIMARY_LATIN_LANGUAGE, TRUE);
}
}
}
- gSCLUI->set_cur_sublayout(g_ise_default_values[g_keyboard_state.layout].sublayout_name);
+ g_ui->set_cur_sublayout(g_ise_default_values[g_keyboard_state.layout].sublayout_name);
}
}
if (info->accepts_caps_mode) {
// FIXME this if condition means the AC is off
if (g_keyboard_state.layout != ISE_LAYOUT_STYLE_NORMAL) {
- gSCLUI->set_autocapital_shift_state(TRUE);
- gSCLUI->set_shift_state(SCL_SHIFT_STATE_OFF);
+ g_ui->set_autocapital_shift_state(TRUE);
+ g_ui->set_shift_state(SCL_SHIFT_STATE_OFF);
}
// normal layout means the AC is on
else {
- ise_send_event(MVK_Shift_Enable, scim::SCIM_KEY_NullMask);
- gSCLUI->set_autocapital_shift_state(FALSE);
+ ise_send_event(MVK_Shift_Enable, KEY_MASK_NULL);
+ g_ui->set_autocapital_shift_state(FALSE);
}
} else {
- gSCLUI->set_autocapital_shift_state(TRUE);
- ise_send_event(MVK_Shift_Disable, scim::SCIM_KEY_NullMask);
- gSCLUI->set_shift_state(SCL_SHIFT_STATE_OFF);
+ g_ui->set_autocapital_shift_state(TRUE);
+ ise_send_event(MVK_Shift_Disable, KEY_MASK_NULL);
+ g_ui->set_shift_state(SCL_SHIFT_STATE_OFF);
}
} else {
- gSCLUI->set_autocapital_shift_state(TRUE);
+ g_ui->set_autocapital_shift_state(TRUE);
}
- gSCLUI->show();
- gSCLUI->disable_input_events(FALSE);
+ g_ui->show();
+ g_ui->disable_input_events(FALSE);
}
g_candidate->show();
void
ise_set_screen_rotation(int degree)
{
- if (gSCLUI) {
- gSCLUI->set_rotation(DEGREE_TO_SCLROTATION(degree));
+ if (g_ui) {
+ g_ui->set_rotation(DEGREE_TO_SCLROTATION(degree));
}
if (g_candidate) {
g_candidate->rotate(degree);
void
ise_set_accessibility_state(bool state)
{
- if (gSCLUI) {
- gSCLUI->enable_tts(state);
+ if (g_ui) {
+ g_ui->enable_tts(state);
}
}
void
ise_hide()
{
- if (gSCLUI && g_ise_common) {
- gSCLUI->disable_input_events(TRUE);
- gSCLUI->hide();
+ if (g_ui) {
+ g_ui->disable_input_events(TRUE);
+ g_ui->hide();
}
g_keyboard_state.visible_state = FALSE;
if (g_candidate) {
void
ise_create()
{
- if (!gSCLUI) {
- gSCLUI = new CSCLUI;
+ if (!g_ui) {
+ g_ui = new CSCLUI;
}
/* Set scl_parser_type
}
- if (gSCLUI && g_ise_common) {
- if (g_ise_common->get_main_window()) {
+ if (g_ui) {
+ if (g_core.get_main_window()) {
sclboolean succeeded = FALSE;
const sclchar *resource_file_path = _language_manager.get_resource_file_path();
if (resource_file_path) {
if (strlen(resource_file_path) > 0) {
- succeeded = gSCLUI->init((sclwindow)g_ise_common->get_main_window(), scl_parser_type, resource_file_path);
+ succeeded = g_ui->init(g_core.get_main_window(), scl_parser_type, resource_file_path);
}
}
if (!succeeded) {
- gSCLUI->init((sclwindow)g_ise_common->get_main_window(), scl_parser_type, MAIN_ENTRY_XML_PATH);
+ g_ui->init(g_core.get_main_window(), scl_parser_type, MAIN_ENTRY_XML_PATH);
}
// FIXME whether to use global var, need to check
if (g_candidate == NULL) {
- g_candidate = CandidateFactory::make_candidate(CANDIDATE_MULTILINE, g_ise_common->get_main_window());
+ g_candidate = CandidateFactory::make_candidate(CANDIDATE_MULTILINE, g_core.get_main_window());
}
g_candidate->add_event_listener(&g_candidate_event_listener);
#ifndef WAYLAND
- gSCLUI->set_longkey_duration(elm_config_longpress_timeout_get() * 1000);
+ g_ui->set_longkey_duration(elm_config_longpress_timeout_get() * 1000);
#endif
/* Default ISE callback */
- gSCLUI->set_ui_event_callback(&callback);
+ g_ui->set_ui_event_callback(&callback);
/* Accumulated customized ISE callbacks, depending on the input modes */
for (scluint loop = 0;loop < _language_manager.get_languages_num();loop++) {
for (scluint inner_loop = 0;inner_loop < language->input_modes.size();inner_loop++) {
INPUT_MODE_INFO &info = language->input_modes.at(inner_loop);
LOGD("Registering callback for input mode %s : %p\n", info.name.c_str(), language->callback);
- gSCLUI->set_ui_event_callback(language->callback, info.name.c_str());
+ g_ui->set_ui_event_callback(language->callback, info.name.c_str());
}
}
}
_language_manager.select_language(g_config_values.selected_language.c_str());
}
- SclSize size_portrait = gSCLUI->get_input_mode_size(gSCLUI->get_input_mode(), DISPLAYMODE_PORTRAIT);
- SclSize size_landscape = gSCLUI->get_input_mode_size(gSCLUI->get_input_mode(), DISPLAYMODE_LANDSCAPE);
- g_ise_common->set_keyboard_size_hints(size_portrait, size_landscape);
+ 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);
}
}
void
ise_destroy()
{
- if (gSCLUI) {
- LOGD("calling gSCLUI->fini()");
- gSCLUI->fini();
- LOGD("deleting gSCLUI");
- delete gSCLUI;
- gSCLUI = NULL;
+ if (g_ui) {
+ LOGD("calling g_ui->fini()");
+ g_ui->fini();
+ LOGD("deleting g_ui");
+ delete g_ui;
+ g_ui = NULL;
}
if (g_candidate) {
delete g_candidate;
// if we want to input [How Are you.]
// Note the "Are" is not use auto-capital rule.
// we should use:
-// ise_send_event(MVK_Shift_On, scim::SCIM_KEY_NullMask);
+// ise_send_event(MVK_Shift_On, SclCoreKeyMask_Null);
// when we are want to input "A"
// following input still has the auto_cap rule.
void
if (info->accepts_caps_mode) {
set_caps_mode(g_keyboard_state.caps_mode);
} else {
- gSCLUI->set_shift_state(SCL_SHIFT_STATE_OFF);
+ g_ui->set_shift_state(SCL_SHIFT_STATE_OFF);
}
}
}
void
ise_update_cursor_position(int position)
{
- if (gSCLUI) {
+ if (g_ui) {
if (position > 0) {
- gSCLUI->set_string_substitution("www.", ".com");
+ g_ui->set_string_substitution("www.", ".com");
} else {
- gSCLUI->unset_string_substitution("www.");
+ g_ui->unset_string_substitution("www.");
}
}
}
}
if (type == ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT) {
- gSCLUI->unset_private_key("Enter");
+ g_ui->unset_private_key("Enter");
} else {
static sclchar *imagelabel[SCL_BUTTON_STATE_MAX] = {
const_cast<sclchar*>(" "), const_cast<sclchar*>(" "), const_cast<sclchar*>(" ")
};
- gSCLUI->set_private_key("Enter", buf, imagelabel, NULL, 0, const_cast<sclchar*>("Enter"), TRUE);
+ g_ui->set_private_key("Enter", buf, imagelabel, NULL, 0, const_cast<sclchar*>("Enter"), TRUE);
}
}
void ise_set_return_key_disable(unsigned int disabled)
{
- gSCLUI->enable_button("Enter", !disabled);
+ g_ui->enable_button("Enter", !disabled);
}
void ise_get_language_locale(char **locale)
sclboolean ise_process_key_event(const char *key)
{
- if (gSCLUI && g_ise_common) {
- return gSCLUI->process_key_event(key);
+ if (g_ui) {
+ return g_ui->process_key_event(key);
}
return FALSE;
}
*
*/
-#include <scl.h>
+#include <sclcommon.h>
#include <stdio.h>
#include <algorithm>
#include <assert.h>
+++ /dev/null
-/*
- * Copyright (c) 2012 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <Elementary.h>
-#include <scl.h>
-#include "common.h"
-#include "ise.h"
-#include <vector>
-using namespace std;
-
-using namespace scim;
-using namespace scl;
-
-#include <Elementary.h>
-
-#define ISEUUID "12aa3425-f88d-45f4-a509-cee8dfe904e3"
-#define ISENAME "Tizen keyboard"
-
-CISECommon *g_ise_common = NULL;
-ConfigPointer _scim_config (0);
-
-extern KEYBOARD_STATE g_keyboard_state;
-
-/* A temporary function for setting imdata for supporting legacy language setting API */
-extern void set_ise_imdata(const char * buf, size_t &len);
-
-class CCoreEventCallback : public IISECommonEventCallback
-{
- void init();
- void exit(sclint ic, const sclchar *ic_uuid);
-
- void attach_input_context(sclint ic, const sclchar *ic_uuid);
- void detach_input_context(sclint ic, const sclchar *ic_uuid);
-
- void focus_out (sclint ic, const sclchar *ic_uuid);
- void focus_in (sclint ic, const sclchar *ic_uuid);
-
- void ise_show(sclint ic, const sclint degree, Ise_Context context);
- void ise_hide(sclint ic, const sclchar *ic_uuid);
-
- void reset_input_context(sclint ic, const sclchar *uuid);
-
- void set_display_language(const sclchar *language);
- void set_accessibility_state(const sclboolean state);
- void set_rotation_degree(sclint degree);
-
- void set_caps_mode(sclu32 mode);
- void update_cursor_position(sclint ic, const sclchar *ic_uuid, sclint cursor_pos);
-
- void set_return_key_type (sclu32 type);
- void set_return_key_disable (sclu32 disabled);
-
- void set_imdata (sclchar *buf, sclu32 len);
- void get_language_locale (sclint ic, sclchar **locale);
- void update_lookup_table(LookupTable& table);
-
- sclboolean process_key_event(const char *key);
-};
-
-void CCoreEventCallback::init()
-{
- LOGD("CCoreEventCallback::init()\n");
- ise_create();
-}
-
-void CCoreEventCallback::exit(sclint ic, const sclchar *ic_uuid)
-{
- ::ise_hide();
- ise_destroy();
-}
-
-void CCoreEventCallback::attach_input_context(sclint ic, const sclchar *ic_uuid)
-{
- ise_attach_input_context(ic);
-}
-
-void CCoreEventCallback::detach_input_context(sclint ic, const sclchar *ic_uuid)
-{
- ise_detach_input_context(ic);
-}
-
-void CCoreEventCallback::focus_in(sclint ic, const sclchar *ic_uuid)
-{
- ise_focus_in(ic);
-}
-
-void CCoreEventCallback::focus_out(sclint ic, const sclchar *ic_uuid)
-{
- ise_focus_out(ic);
-}
-
-void CCoreEventCallback::ise_show(sclint ic, const sclint degree, Ise_Context context)
-{
- //g_ise_common->set_keyboard_ise_by_uuid(KEYBD_ISE_UUID);
-
- ise_reset_context(); // reset ISE
-
- /*if (context.language == ECORE_IMF_INPUT_PANEL_LANG_ALPHABET) {
- ise_explictly_set_language(PRIMARY_LATIN_LANGUAGE_INDEX);
- }*/
-
- ise_set_layout(context.layout);
-
- ise_set_return_key_type(context.return_key_type);
- ise_set_return_key_disable(context.return_key_disabled);
-
- ise_set_caps_mode(context.caps_mode);
- ise_update_cursor_position(context.cursor_pos);
-
- /* Do not follow the application's rotation angle if we are already in visible state,
- since in that case we will receive the angle through ROTATION_CHANGE_REQUEST message */
- if (!(g_keyboard_state.visible_state)) {
- ise_set_screen_rotation(degree);
- } else {
- LOGD("Skipping rotation angle , %d", degree);
- }
-
- ::ise_show(ic);
-}
-
-void CCoreEventCallback::ise_hide(sclint ic, const sclchar *ic_uuid)
-{
- ::ise_hide();
-}
-
-void CCoreEventCallback::reset_input_context(sclint ic, const sclchar *uuid)
-{
- ise_reset_input_context();
-}
-
-void CCoreEventCallback::set_display_language(const sclchar *language)
-{
- setlocale(LC_ALL, language);
- bindtextdomain(PACKAGE, LOCALEDIR);
- textdomain(PACKAGE);
-
- LOGD("Language : %s\n", (language ? language : "NULL"));
-}
-
-void CCoreEventCallback::set_accessibility_state(const sclboolean state)
-{
- ise_set_accessibility_state(state);
-}
-
-void CCoreEventCallback::set_rotation_degree(sclint degree)
-{
- ise_set_screen_rotation(degree);
-}
-
-void CCoreEventCallback::set_caps_mode(sclu32 mode)
-{
- ise_set_caps_mode(mode);
-}
-
-void CCoreEventCallback::update_cursor_position(sclint ic, const sclchar *ic_uuid, sclint cursor_pos)
-{
- ise_update_cursor_position(cursor_pos);
-}
-
-void CCoreEventCallback::set_return_key_type (sclu32 type)
-{
- ise_set_return_key_type(type);
-}
-
-void CCoreEventCallback::set_return_key_disable (sclu32 disabled)
-{
- ise_set_return_key_disable(disabled);
-}
-
-void CCoreEventCallback::set_imdata(sclchar *buf, sclu32 len)
-{
- size_t _len = len;
- set_ise_imdata(buf, _len);
-}
-
-void CCoreEventCallback::get_language_locale(sclint ic, sclchar **locale)
-{
- ise_get_language_locale(locale);
-}
-
-void CCoreEventCallback::update_lookup_table(LookupTable &table)
-{
- vector<string> vec_str;
- //printf("candidate num: %d, current_page_size: %d\n",
- // table.number_of_candidates(), table.get_current_page_size());
- for (int i = 0; i < table.get_current_page_size(); ++i)
- {
- WideString wcs = table.get_candidate_in_current_page(i);
- String str = utf8_wcstombs(wcs);
- vec_str.push_back(str);
- }
- ise_update_table(vec_str);
-}
-
-sclboolean
-CCoreEventCallback::process_key_event(const char *key)
-{
- return ise_process_key_event(key);
-}
-
-static CCoreEventCallback g_core_event_callback;
-
-extern "C"
-{
- void scim_module_init (void) {
- if (g_ise_common == NULL) {
- g_ise_common = CISECommon::get_instance();
- }
- if (g_ise_common) {
- g_ise_common->init(ISENAME, ISEUUID, "en_US");
- g_ise_common->set_core_event_callback(&g_core_event_callback);
- }
- }
-
- void scim_module_exit (void) {
- if (g_ise_common) {
- g_ise_common->exit();
-
- delete g_ise_common;
- g_ise_common = NULL;
- }
- }
-
- unsigned int scim_helper_module_number_of_helpers (void) {
- if (g_ise_common) {
- return g_ise_common->get_number_of_helpers();
- }
- return 0;
- }
-
- bool scim_helper_module_get_helper_info (unsigned int idx, HelperInfo &info) {
- if (g_ise_common) {
- return g_ise_common->get_helper_info(idx, info);
- }
- return false;
- }
-
- String scim_helper_module_get_helper_language (unsigned int idx) {
- if (g_ise_common) {
- return g_ise_common->get_helper_language(idx);
- }
- return String("");
- }
-
- void scim_helper_module_run_helper (const String &uuid, const ConfigPointer &config, const String &display) {
- _scim_config = config;
- if (g_ise_common) {
- g_ise_common->run(uuid.c_str(), config, display.c_str());
- }
- }
-}
*/
#include <string.h>
-#include <scl.h>
+#include <sclcommon.h>
#include <Ecore.h>
#ifdef WAYLAND
naviframe = NULL;
lang_popup = NULL;
- event_handler = NULL;
-
itc_main_text_only = NULL;
itc_language_subitems = NULL;
Evas_Object *naviframe;
Evas_Object *lang_popup;
- Ecore_Event_Handler *event_handler;
-
Elm_Genlist_Item_Class *itc_main_text_only;
Elm_Genlist_Item_Class *itc_language_subitems;
static OPTION_ELEMENTS ad;
extern CONFIG_VALUES g_config_values;
+extern CSCLCore g_core;
//static Evas_Object* create_main_window();
static Evas_Object* create_option_language_view(Evas_Object *naviframe);
return ((index < language_option_vector.size()) ? language_option_vector.at(index) : NULL);
}
-static Evas_Object*
-create_main_window(int degree)
-{
- Evas_Object *window = elm_win_util_standard_add("Option window", "Option window");
- if (!window)
- return NULL;
-
- int w, h;
-
- elm_win_screen_size_get (window, NULL, NULL, &w, &h);
- evas_object_resize (window, w, h);
-
- elm_win_borderless_set(window, EINA_TRUE);
-
- int rots[] = { 0, 90, 180, 270 };
- elm_win_wm_rotation_available_rotations_set(window, rots, (sizeof(rots) / sizeof(int)));
-
- evas_object_show(window);
-
- return window;
-}
-
static char *_main_gl_text_get(void *data, Evas_Object *obj, const char *part)
{
ITEMDATA *item_data = (ITEMDATA*)data;
return EINA_TRUE;
}
+void
+close_option_window()
+{
+ destroy_genlist_item_classes();
+ g_core.destroy_option_window(ad.option_window);
+ ad.option_window = NULL;
+}
+
static void
_naviframe_back_cb (void *data, Evas_Object *obj, void *event_info)
{
return genlist;
}
-void
-close_option_window()
-{
- destroy_genlist_item_classes();
-
- if (ad.option_window) {
- evas_object_del(ad.option_window);
- ad.option_window = NULL;
- }
-
- if (ad.event_handler) {
- ecore_event_handler_del(ad.event_handler);
- ad.event_handler = NULL;
- }
-}
-
void read_options()
{
std::string languages = compose_selected_languages_string();
}
}
-static Eina_Bool focus_out_cb(void *data, int type, void *event)
-{
- language_selection_finished_cb(NULL, NULL, NULL);
- close_option_window();
- return ECORE_CALLBACK_CANCEL;
-}
-
static void
navi_back_cb(void *data, Evas_Object *obj, void *event_info)
{
close_option_window();
}
-#ifndef APPLY_WINDOW_MANAGER_CHANGE
-static void
-set_transient_for_app_window(Evas_Object *window)
-{
-#ifndef WAYLAND
- /* Set a transient window for window stack */
- /* Gets the current XID of the active window into the root window property */
- Atom type_return;
- unsigned long nitems_return;
- unsigned long bytes_after_return;
- int format_return;
- unsigned char *data = NULL;
- Ecore_X_Window xAppWindow;
- Ecore_X_Window xWindow = elm_win_xwindow_get(window);
- gint ret = 0;
-
- ret = XGetWindowProperty ((Display *)ecore_x_display_get(), ecore_x_window_root_get(xWindow),
- ecore_x_atom_get("_ISF_ACTIVE_WINDOW"),
- 0, G_MAXLONG, False, XA_WINDOW, &type_return,
- &format_return, &nitems_return, &bytes_after_return,
- &data);
-
- if (ret == Success) {
- if (data) {
- if (type_return == XA_WINDOW) {
- xAppWindow = *(Window *)data;
- LOGD("TRANSIENT_FOR SET : %x , %x", xAppWindow, xWindow);
- ecore_x_icccm_transient_for_set(xWindow, xAppWindow);
- }
- XFree(data);
- }
- }
-#endif
-}
-#endif
-
void
-open_option_window(Evas_Object *parent, sclint degree)
+option_window_created(Evas_Object *window, SCLOptionWindowType type)
{
+ if (window == NULL) return;
+
read_ise_config_values();
/* To make sure there is no temporary language in the enabled language list */
set_option_values();
- if (ad.option_window)
- {
+ if (ad.option_window) {
elm_win_raise(ad.option_window);
- }
- else
- {
+ } else {
memset(&ad, 0x0, sizeof(OPTION_ELEMENTS));
- /* create option window */
- Evas_Object *window = create_main_window(degree);
- if (!window) {
- LOGE("Failed to create option window\n");
- return;
- }
-
elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_SHOW);
elm_win_indicator_opacity_set(window, ELM_WIN_INDICATOR_OPAQUE);
elm_object_content_set(conformant, naviframe);
evas_object_show(naviframe);
- set_transient_for_app_window(window);
-
if (window) elm_win_raise (window);
ad.option_window = window;
-#ifdef WAYLAND
- ad.event_handler = ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, focus_out_cb, NULL);
-#else
- ad.event_handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, focus_out_cb, NULL);
-#endif
+ evas_object_show(window);
+ }
+}
+
+void
+option_window_destroyed(Evas_Object *window)
+{
+ if (ad.option_window == window) {
+ ad.option_window = NULL;
}
}
#include <dlog.h>
#undef LOG_TAG
#define LOG_TAG "ISE_DEFAULT"
-#include <scl.h> // scl structures need
+#include <sclcommon.h> // scl structures need
#include <libxml/parser.h>
#include <vector>
+#include <string>
#include <assert.h>
#include <memory.h>
#include <string.h>
#include "ise_lang_table.h"
-using namespace std;
+
using namespace scl;
#define LANG_TABLE_XML_PATH "/usr/share/isf/ise/ise-default/720x1280/default/sdk/ise_lang_table.xml"
return val;
}
-static string
+static std::string
get_prop_str(
const xmlNodePtr cur_node,
const char* prop) {
- string str;
+ std::string str;
if (cur_node && prop) {
xmlChar* key = xmlGetProp(
cur_node,
(const xmlChar*)prop);
if (key) {
- str = string((const char*)key);
+ str = std::string((const char*)key);
xmlFree(key);
}
}
cur_node = cur_node->next;
}
}
-static inline string
-find_uuid(const vector<Keyboard_UUID>& vec_rec, const string& name) {
- vector<Keyboard_UUID>::const_iterator it;
+static inline std::string
+find_uuid(const std::vector<Keyboard_UUID>& vec_rec, const std::string& name) {
+ std::vector<Keyboard_UUID>::const_iterator it;
for (it = vec_rec.begin(); it != vec_rec.end(); ++it) {
if (it->name == name) {
return it->uuid;
}
}
- return string();
+ return std::string();
}
static inline char*
-get_str(string str) {
+get_str(std::string str) {
int len = str.length();
if (len == 0) return NULL;
m_table[m_size].main_keyboard_name = (sclchar *)strdup("abc");
}
- string uuid = find_uuid(vec_keyboard_uuid, get_prop_str(cur_node, "keyboard_ise_uuid"));
+ std::string uuid = find_uuid(vec_keyboard_uuid, get_prop_str(cur_node, "keyboard_ise_uuid"));
m_table[m_size].keyboard_ise_uuid = get_str(uuid);
xmlChar* country_code_URL = xmlGetProp(cur_node, (const xmlChar*)"country_code_URL");
m_table[m_size].country_code_URL = (sclchar*)country_code_URL;
#ifndef __ISE_LANG_TABLE_H
#define __ISE_LANG_TABLE_H
#define MAX_LANG_TABLE_SIZE 128
-#include <string>
typedef struct SDK_ISE_LANG_TABLE {
SDK_ISE_LANG_TABLE() {
accepts_caps_mode = false;
}
/* This is the string ID of this language, used in ISE side. For example, ISE developer can use this string to select this language, by passing "Korean" to ISELanguageManager::select_language() function */
- sclchar *language;
+ char *language;
/* The translated UTF8 string of this language in its own language. */
- sclchar *language_name;
+ char *language_name;
/* A locale string such as 'en_US' to let the application know what language the keyboard currently selected */
- sclchar *locale_string;
+ char *locale_string;
/* The QWERTY input mode of this language. This is used for passing as parameter of SCLUI::set_input_mode(), so has to be same with the name in input_mode_configure.xml file's mode name */
- sclchar *inputmode_QTY;
+ char *inputmode_QTY;
/* The translate UTF8 string that will be displayed in the option window's language selection. */
- sclchar *inputmode_QTY_name;
+ char *inputmode_QTY_name;
/* The keyboard ISE's uuid, since each language might have to use different IMEngines. ise-engine-hangul for korean, ise-engine-sunpinyin for chinese,... */
- sclchar *keyboard_ise_uuid;
+ char *keyboard_ise_uuid;
/* Click "?123" button, ISE will show SYM keyboard, and the "?123" button changes the label to main_keyboard_name,
* then click on the button will back to main_keyboard
- * the main_keyboard_name may be "abc" in English, "汉" in Chinese and so on
+ * the main_keyboard_name may be "abc" in English, "¿" in Chinese and so on
*/
- sclchar *main_keyboard_name;
+ char *main_keyboard_name;
/* URL country code */
- sclchar *country_code_URL;
+ char *country_code_URL;
/* The language parameter of this keyboard ise's language change command */
- sclu32 language_code;
+ int language_code;
/* The language change command that this keyboard ise uses */
- sclint language_command;
+ int language_command;
/* The flush parameter of this keyboard ise's flush command */
- sclu32 flush_code;
+ int flush_code;
/* The flush change command that this keyboard ise uses */
- sclint flush_command;
+ int flush_command;
/* If this language is set as latin language, the language itself will be shown when URL or EMAIL layouts are requested */
- sclboolean is_latin_language;
+ bool is_latin_language;
/* If this language accepts caps mode, try to handle AutoCapitalization option */
- sclboolean accepts_caps_mode;
+ bool accepts_caps_mode;
}SDK_ISE_LANG_TABLE;
*
*/
-#include <scl.h>
+#include <sclui.h>
#include "ise.h"
#include "sdk.h"
#include "option.h"
-#include "common.h"
+#include "sclcore.h"
#include "ise_lang_table.h"
static CSDKISE ise_instance;
-extern CSCLUI *gSCLUI;
-extern CISECommon *g_ise_common;
+extern CSCLUI *g_ui;
+extern CSCLCore g_core;
+
extern CONFIG_VALUES g_config_values;
extern KEYBOARD_STATE g_keyboard_state;
static void set_caps_mode(sclint mode) {
- if (gSCLUI->get_shift_state() != SCL_SHIFT_STATE_LOCK) {
- gSCLUI->set_shift_state(mode ? SCL_SHIFT_STATE_ON : SCL_SHIFT_STATE_OFF);
+ if (g_ui->get_shift_state() != SCL_SHIFT_STATE_LOCK) {
+ g_ui->set_shift_state(mode ? SCL_SHIFT_STATE_ON : SCL_SHIFT_STATE_OFF);
}
}
SCLEventReturnType
if (info->accepts_caps_mode) {
// FIXME this if condition means the AC is off
if (g_keyboard_state.layout != ISE_LAYOUT_STYLE_NORMAL) {
- gSCLUI->set_autocapital_shift_state(TRUE);
- gSCLUI->set_shift_state(SCL_SHIFT_STATE_OFF);
+ g_ui->set_autocapital_shift_state(TRUE);
+ g_ui->set_shift_state(SCL_SHIFT_STATE_OFF);
}
// normal layout means the AC is on
else {
- gSCLUI->set_autocapital_shift_state(FALSE);
- ise_send_event(MVK_Shift_Enable, scim::SCIM_KEY_NullMask);
+ g_ui->set_autocapital_shift_state(FALSE);
+ ise_send_event(MVK_Shift_Enable, KEY_MASK_NULL);
set_caps_mode(g_keyboard_state.caps_mode);
}
} else {
- gSCLUI->set_autocapital_shift_state(TRUE);
- ise_send_event(MVK_Shift_Disable, scim::SCIM_KEY_NullMask);
- gSCLUI->set_shift_state(SCL_SHIFT_STATE_OFF);
+ g_ui->set_autocapital_shift_state(TRUE);
+ ise_send_event(MVK_Shift_Disable, KEY_MASK_NULL);
+ g_ui->set_shift_state(SCL_SHIFT_STATE_OFF);
}
}
} else {
sclint loop;
for (loop = 0;loop < get_lang_table_size();loop++) {
if (strcmp(language, get_lang_table()[loop].language) == 0) {
- if (g_ise_common && gSCLUI) {
+ if (g_ui) {
if (get_lang_table()[loop].keyboard_ise_uuid) {
- g_ise_common->set_keyboard_ise_by_uuid(get_lang_table()[loop].keyboard_ise_uuid);
- g_ise_common->send_imengine_event(-1, get_lang_table()[loop].keyboard_ise_uuid,
+ g_core.set_keyboard_ise_by_uuid(get_lang_table()[loop].keyboard_ise_uuid);
+ g_core.send_imengine_event(-1, get_lang_table()[loop].keyboard_ise_uuid,
get_lang_table()[loop].language_command, get_lang_table()[loop].language_code);
}
/* This is to update the screen only for once, not everytime we request a UI update */
- gSCLUI->set_update_pending(TRUE);
- gSCLUI->set_input_mode(input_mode);
+ g_ui->set_update_pending(TRUE);
+ g_ui->set_input_mode(input_mode);
- SclSize size_portrait = gSCLUI->get_input_mode_size(gSCLUI->get_input_mode(), DISPLAYMODE_PORTRAIT);
- SclSize size_landscape = gSCLUI->get_input_mode_size(gSCLUI->get_input_mode(), DISPLAYMODE_LANDSCAPE);
- g_ise_common->set_keyboard_size_hints(size_portrait, size_landscape);
+ 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);
/* Check if we need to turn on the shift key */
LANGUAGE_INFO *info = _language_manager.get_language_info(language);
if (info) {
if (info->accepts_caps_mode) {
if (g_keyboard_state.caps_mode) {
- gSCLUI->set_shift_state(SCL_SHIFT_STATE_ON);
- ise_send_event(MVK_Shift_On, scim::SCIM_KEY_NullMask);
+ g_ui->set_shift_state(SCL_SHIFT_STATE_ON);
+ ise_send_event(MVK_Shift_On, KEY_MASK_NULL);
g_keyboard_state.caps_mode = TRUE;
} else {
- gSCLUI->set_shift_state(SCL_SHIFT_STATE_OFF);
- ise_send_event(MVK_Shift_Off, scim::SCIM_KEY_NullMask);
+ g_ui->set_shift_state(SCL_SHIFT_STATE_OFF);
+ ise_send_event(MVK_Shift_Off, KEY_MASK_NULL);
g_keyboard_state.caps_mode = FALSE;
}
if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_NORMAL) {
// not allow the SCL auto capital shift state
- gSCLUI->set_autocapital_shift_state(FALSE);
+ g_ui->set_autocapital_shift_state(FALSE);
}
} else {
- gSCLUI->set_autocapital_shift_state(TRUE);
+ g_ui->set_autocapital_shift_state(TRUE);
}
} else {
- gSCLUI->set_autocapital_shift_state(TRUE);
+ g_ui->set_autocapital_shift_state(TRUE);
}
/* And set the url postfixes */
for (size_t inner_loop = 0; inner_loop < (sizeof(url_postfixes) / sizeof (const char *)); inner_loop++) {
postfix.replace(offset, strlen(replace_target), get_lang_table()[loop].country_code_URL);
}
- gSCLUI->set_string_substitution(url_postfixes[inner_loop], postfix.c_str());
+ g_ui->set_string_substitution(url_postfixes[inner_loop], postfix.c_str());
}
/* Replace LANGUAGE_STRING with localized language name */
- gSCLUI->set_string_substitution(LANGUAGE_STRING, get_lang_table()[loop].language_name);
+ g_ui->set_string_substitution(LANGUAGE_STRING, get_lang_table()[loop].language_name);
/* Change main_keyboard_name with localized language name */
if (get_lang_table()[loop].main_keyboard_name) {
- gSCLUI->set_string_substitution(PLACEHOLDER_MAIN_KEYBOARD_NAME, get_lang_table()[loop].main_keyboard_name);
+ g_ui->set_string_substitution(PLACEHOLDER_MAIN_KEYBOARD_NAME, get_lang_table()[loop].main_keyboard_name);
}
/* Now we update the whole screen */
- gSCLUI->set_update_pending(FALSE);
+ g_ui->set_update_pending(FALSE);
}
ret = TRUE;
}
if (ret) {
- g_ise_common->update_input_context(ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, 0);
+ g_core.update_input_context(ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, 0);
}
return ret;
{
bool bRet = false;
- if (g_ise_common) {
- int lang_id = get_lang_id(language);
- if (lang_id != -1) {
- if (get_lang_table()[lang_id].flush_code != 0) {
- g_ise_common->send_imengine_event(-1, get_lang_table()[lang_id].keyboard_ise_uuid,
- get_lang_table()[lang_id].flush_command, get_lang_table()[lang_id].flush_code);
- bRet = true;
- } else {
- g_ise_common->reset_keyboard_ise();
- bRet = true;
- }
-
+ int lang_id = get_lang_id(language);
+ if (lang_id != -1) {
+ if (get_lang_table()[lang_id].flush_code != 0) {
+ g_core.send_imengine_event(-1, get_lang_table()[lang_id].keyboard_ise_uuid,
+ get_lang_table()[lang_id].flush_command, get_lang_table()[lang_id].flush_code);
+ bRet = true;
+ } else {
+ g_core.reset_keyboard_ise();
+ bRet = true;
}
+
}
return bRet;
*
*/
+#include <Evas.h>
#include <dlog.h>
+#include <vector>
#undef LOG_TAG
#define LOG_TAG "ISE_DEFAULT"
#include "sdk.h"
#include "option.h"
#include "ise_lang_table.h"
-using namespace scl;
static ISELanguageManager _language_manager;
/*
void on_destroy_option_main_view();
};
-static CSDKOption ise_option_instance;
-
void CSDKOption::on_create_option_main_view(Evas_Object *genlist, Evas_Object *naviframe)
{
{
}
+
+static CSDKOption ise_option_instance;
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2012 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#define Uses_SCIM_UTILITY
-#define Uses_SCIM_IMENGINE
-#define Uses_SCIM_LOOKUP_TABLE
-#define Uses_SCIM_CONFIG_BASE
-#define Uses_SCIM_CONFIG_PATH
-
-#include <Elementary.h>
-#include <Ecore_IMF.h>
-#ifndef WAYLAND
-#include <Ecore_X.h>
-#endif
-#include "option.h"
-
-#ifdef HAVE_CONFIG_H
- #include <config.h>
-#endif
-
-#include <scim.h>
-#include <string.h>
-
-using namespace scim;
-
-static ISELanguageManager _language_manager;
-
-static Evas_Object* create_ise_setup_eo (Evas_Object *parent, Evas_Object *naviframe);
-static void load_config (const ConfigPointer &config);
-static void save_config (const ConfigPointer &config);
-static void reset_config (const ConfigPointer &config);
-static bool query_changed ();
-
-ConfigPointer _scim_config (0);
-
-extern CONFIG_VALUES g_config_values;
-extern Evas_Object* create_option_main_view(Evas_Object *parent, Evas_Object *naviframe);
-
-extern "C" {
- void scim_module_init (void)
- {
- }
-
- void scim_module_exit (void)
- {
- }
-
- Evas_Object* scim_setup_module_create_ui (Evas_Object *parent, Evas_Object *layout)
- {
- setlocale(LC_ALL, "");
- bindtextdomain(PACKAGE, LOCALEDIR);
- textdomain(PACKAGE);
- return create_ise_setup_eo (parent, layout);
- }
-
- String scim_setup_module_get_category (void)
- {
- return String ("Helper");
- }
-
- String scim_setup_module_get_name (void)
- {
- return String ("Tizen Keyboard");
- }
-
- String scim_setup_module_get_description (void)
- {
- return String (("Setup Module of Tizen Keyboard."));
- }
-
- void scim_setup_module_load_config (const ConfigPointer &config)
- {
- load_config (config);
- }
-
- void scim_setup_module_save_config (const ConfigPointer &config)
- {
- save_config (config);
- }
-
- bool scim_setup_module_query_changed ()
- {
- return query_changed ();
- }
-
- bool scim_setup_module_key_proceeding (int key_type)
- {
- return false;
- }
-
- bool scim_setup_module_option_reset(const ConfigPointer &config)
- {
- reset_config (config);
- return true;
- }
-}
-
-static void load_config (const ConfigPointer &config)
-{
- if (!config.null ()) {
- _scim_config = config;
-
- read_ise_config_values();
-
- _language_manager.set_enabled_languages(g_config_values.enabled_languages);
-
- _language_manager.select_language(g_config_values.selected_language.c_str());
- }
-}
-
-static void save_config (const ConfigPointer &config)
-{
- write_options();
-
- if (!config.null ()) {
- _scim_config = config;
- write_ise_config_values();
- }
-}
-
-static void reset_config (const ConfigPointer &config)
-{
- if (!config.null ()) {
- _scim_config = config;
- erase_ise_config_values();
- }
-}
-
-static bool query_changed ()
-{
- load_config(_scim_config);
- read_options();
- return EINA_TRUE;
-}
-
-void
-navi_back_cb(void *data, Evas_Object *obj, void *event_info)
-{
- close_option_window();
-}
-
-static void transition_finished (void *data, Evas_Object *obj, void *event_info)
-{
- /* Delete this smart callback */
- evas_object_smart_callback_del (obj, "transition,finished", transition_finished);
-
- /* Now register an callback to back button for removing all created objects */
- Elm_Object_Item *top_item = elm_naviframe_top_item_get(obj);
- Evas_Object *back_btn = elm_object_item_part_content_get (top_item, "prev_btn");
- evas_object_smart_callback_add (back_btn, "clicked", navi_back_cb, NULL);
-}
-
-static Evas_Object * create_ise_setup_eo (Evas_Object *parent, Evas_Object *naviframe)
-{
- Evas_Object *ret = NULL;
- if(parent && naviframe) {
- ret = create_option_main_view(parent, naviframe);
- /* Currently, we have to wait until the transition gets finished,
- to access the back button of the second page.
- Better to modify to access the pushed item object, sometime later */
- evas_object_smart_callback_add (naviframe, "transition,finished", transition_finished, NULL);
- }
- return ret;
-}
-
-/*
-vi:ts=4:nowrap:ai:expandtab
-*/