From 03914f65a6411fbf51b698b71a4267b23412bf45 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 11 Jun 2015 21:26:19 +0900 Subject: [PATCH 01/16] Fix build error on X11 Change-Id: I520d80bb87356fb6eb6f877b3f5701513321c0f1 --- CMakeLists.txt | 1 - packaging/libscl-core.spec | 1 + src/sclcoreui-efl.cpp | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d84b5e2..80c1b23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,6 @@ SET(PKGS_CHECK_MODULES dlog isf vconf - libscl-common ) diff --git a/packaging/libscl-core.spec b/packaging/libscl-core.spec index 0a6da98..80384c0 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -20,6 +20,7 @@ BuildRequires: pkgconfig(isf) %if %{with wayland} %else BuildRequires: pkgconfig(ecore-x) +BuildRequires: pkgconfig(x11) %endif BuildRequires: pkgconfig(libscl-common) diff --git a/src/sclcoreui-efl.cpp b/src/sclcoreui-efl.cpp index 4ffd69d..a0606f6 100644 --- a/src/sclcoreui-efl.cpp +++ b/src/sclcoreui-efl.cpp @@ -27,6 +27,7 @@ #ifdef WAYLAND #include #else +#include #include #include #endif -- 2.7.4 From 28fc04e21b31ec5b94f667d577504f0a0fe59dc2 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 12 Jun 2015 20:00:13 +0900 Subject: [PATCH 02/16] Fix build warning Change-Id: I6e0e0ddb8ac810c6e053af2883008738dc236f81 --- src/sclconnection-isf.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp index 2a47667..8793790 100644 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -621,12 +621,13 @@ void CSCLConnectionISF::open_connection(const sclchar *display) int fd = m_helper_agent.get_connection_number(); if (fd >= 0) { +#ifndef WAYLAND Evas_Object *main_window = NULL; CSCLCoreImpl *impl = CSCLCoreImpl::get_instance(); if (impl) { main_window = NATIVE_WINDOW_CAST(impl->get_main_window()); } -#ifndef WAYLAND + Ecore_X_Window xwindow = elm_win_xwindow_get(main_window); char xid[255]; snprintf(xid, 255, "%d", xwindow); -- 2.7.4 From fac5c3b58de9ab73db4cda2460d1bddff4abffc5 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 12 Jun 2015 20:24:06 +0900 Subject: [PATCH 03/16] Register input panel surface in wayland Change-Id: I62bdcd7c268874380b8643eacf178d97a6ae1c32 --- CMakeLists.txt | 10 +- packaging/libscl-core.spec | 2 + src/input-method-client-protocol.h | 446 +++++++++++++++++++++++++++++++++++++ src/input-method-protocol.c | 126 +++++++++++ src/sclcoreui-efl.cpp | 133 +++++++++++ 5 files changed, 715 insertions(+), 2 deletions(-) create mode 100644 src/input-method-client-protocol.h create mode 100644 src/input-method-protocol.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 80c1b23..31d0203 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(libscl-core CXX) +PROJECT(libscl-core) SET(SRCS src/sclcoreui.cpp @@ -10,6 +10,12 @@ SET(SRCS src/sclcore.cpp ) +IF (with_wayland) + SET(SRCS ${SRCS} src/input-method-protocol.c) +ELSE (with_wayland) + SET(SRCS ${SRCS}) +ENDIF (with_wayland) + SET(PACKAGE ${PROJECT_NAME}) SET(PKGNAME ${PACKAGE}) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) @@ -36,7 +42,7 @@ SET(PKGS_CHECK_MODULES IF (with_wayland) ADD_DEFINITIONS("-DWAYLAND") - pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES}) + pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES} ecore-wayland wayland-client) ELSE (with_wayland) pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES} ecore-x) ENDIF(with_wayland) diff --git a/packaging/libscl-core.spec b/packaging/libscl-core.spec index 80384c0..2c7e07d 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -18,6 +18,8 @@ BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(isf) %if %{with wayland} +BuildRequires: pkgconfig(ecore-wayland) +BuildRequires: pkgconfig(wayland-client) %else BuildRequires: pkgconfig(ecore-x) BuildRequires: pkgconfig(x11) diff --git a/src/input-method-client-protocol.h b/src/input-method-client-protocol.h new file mode 100644 index 0000000..070a97d --- /dev/null +++ b/src/input-method-client-protocol.h @@ -0,0 +1,446 @@ +/* + * Copyright © 2012, 2013 Intel Corporation + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of + * the copyright holders not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ + +#ifndef INPUT_METHOD_CLIENT_PROTOCOL_H +#define INPUT_METHOD_CLIENT_PROTOCOL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "wayland-client.h" + +struct wl_client; +struct wl_resource; + +struct wl_input_method_context; +struct wl_input_method; +struct wl_input_panel; +struct wl_input_panel_surface; + +extern const struct wl_interface wl_input_method_context_interface; +extern const struct wl_interface wl_input_method_interface; +extern const struct wl_interface wl_input_panel_interface; +extern const struct wl_interface wl_input_panel_surface_interface; + +/** + * wl_input_method_context - input method context + * @surrounding_text: surrounding text event + * @reset: (none) + * @content_type: (none) + * @invoke_action: (none) + * @commit_state: (none) + * @preferred_language: (none) + * + * Corresponds to a text model on input method side. An input method + * context is created on text mode activation on the input method side. It + * allows to receive information about the text model from the application + * via events. Input method contexts do not keep state after deactivation + * and should be destroyed after deactivation is handled. + * + * Text is generally UTF-8 encoded, indices and lengths are in bytes. + * + * Serials are used to synchronize the state between the text input and an + * input method. New serials are sent by the text input in the commit_state + * request and are used by the input method to indicate the known text + * input state in events like preedit_string, commit_string, and keysym. + * The text input can then ignore events from the input method which are + * based on an outdated state (for example after a reset). + */ +struct wl_input_method_context_listener { + /** + * surrounding_text - surrounding text event + * @text: (none) + * @cursor: (none) + * @anchor: (none) + * + * The plain surrounding text around the input position. Cursor + * is the position in bytes within the surrounding text relative to + * the beginning of the text. Anchor is the position in bytes of + * the selection anchor within the surrounding text relative to the + * beginning of the text. If there is no selected text anchor is + * the same as cursor. + */ + void (*surrounding_text)(void *data, + struct wl_input_method_context *wl_input_method_context, + const char *text, + uint32_t cursor, + uint32_t anchor); + /** + * reset - (none) + */ + void (*reset)(void *data, + struct wl_input_method_context *wl_input_method_context); + /** + * content_type - (none) + * @hint: (none) + * @purpose: (none) + */ + void (*content_type)(void *data, + struct wl_input_method_context *wl_input_method_context, + uint32_t hint, + uint32_t purpose); + /** + * invoke_action - (none) + * @button: (none) + * @index: (none) + */ + void (*invoke_action)(void *data, + struct wl_input_method_context *wl_input_method_context, + uint32_t button, + uint32_t index); + /** + * commit_state - (none) + * @serial: serial of text input state + */ + void (*commit_state)(void *data, + struct wl_input_method_context *wl_input_method_context, + uint32_t serial); + /** + * preferred_language - (none) + * @language: (none) + */ + void (*preferred_language)(void *data, + struct wl_input_method_context *wl_input_method_context, + const char *language); +}; + +static inline int +wl_input_method_context_add_listener(struct wl_input_method_context *wl_input_method_context, + const struct wl_input_method_context_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) wl_input_method_context, + (void (**)(void)) listener, data); +} + +#define WL_INPUT_METHOD_CONTEXT_DESTROY 0 +#define WL_INPUT_METHOD_CONTEXT_COMMIT_STRING 1 +#define WL_INPUT_METHOD_CONTEXT_PREEDIT_STRING 2 +#define WL_INPUT_METHOD_CONTEXT_PREEDIT_STYLING 3 +#define WL_INPUT_METHOD_CONTEXT_PREEDIT_CURSOR 4 +#define WL_INPUT_METHOD_CONTEXT_DELETE_SURROUNDING_TEXT 5 +#define WL_INPUT_METHOD_CONTEXT_CURSOR_POSITION 6 +#define WL_INPUT_METHOD_CONTEXT_MODIFIERS_MAP 7 +#define WL_INPUT_METHOD_CONTEXT_KEYSYM 8 +#define WL_INPUT_METHOD_CONTEXT_GRAB_KEYBOARD 9 +#define WL_INPUT_METHOD_CONTEXT_KEY 10 +#define WL_INPUT_METHOD_CONTEXT_MODIFIERS 11 +#define WL_INPUT_METHOD_CONTEXT_LANGUAGE 12 +#define WL_INPUT_METHOD_CONTEXT_TEXT_DIRECTION 13 + +static inline void +wl_input_method_context_set_user_data(struct wl_input_method_context *wl_input_method_context, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) wl_input_method_context, user_data); +} + +static inline void * +wl_input_method_context_get_user_data(struct wl_input_method_context *wl_input_method_context) +{ + return wl_proxy_get_user_data((struct wl_proxy *) wl_input_method_context); +} + +static inline void +wl_input_method_context_destroy(struct wl_input_method_context *wl_input_method_context) +{ + wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, + WL_INPUT_METHOD_CONTEXT_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) wl_input_method_context); +} + +static inline void +wl_input_method_context_commit_string(struct wl_input_method_context *wl_input_method_context, uint32_t serial, const char *text) +{ + wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, + WL_INPUT_METHOD_CONTEXT_COMMIT_STRING, serial, text); +} + +static inline void +wl_input_method_context_preedit_string(struct wl_input_method_context *wl_input_method_context, uint32_t serial, const char *text, const char *commit) +{ + wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, + WL_INPUT_METHOD_CONTEXT_PREEDIT_STRING, serial, text, commit); +} + +static inline void +wl_input_method_context_preedit_styling(struct wl_input_method_context *wl_input_method_context, uint32_t index, uint32_t length, uint32_t style) +{ + wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, + WL_INPUT_METHOD_CONTEXT_PREEDIT_STYLING, index, length, style); +} + +static inline void +wl_input_method_context_preedit_cursor(struct wl_input_method_context *wl_input_method_context, int32_t index) +{ + wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, + WL_INPUT_METHOD_CONTEXT_PREEDIT_CURSOR, index); +} + +static inline void +wl_input_method_context_delete_surrounding_text(struct wl_input_method_context *wl_input_method_context, int32_t index, uint32_t length) +{ + wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, + WL_INPUT_METHOD_CONTEXT_DELETE_SURROUNDING_TEXT, index, length); +} + +static inline void +wl_input_method_context_cursor_position(struct wl_input_method_context *wl_input_method_context, int32_t index, int32_t anchor) +{ + wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, + WL_INPUT_METHOD_CONTEXT_CURSOR_POSITION, index, anchor); +} + +static inline void +wl_input_method_context_modifiers_map(struct wl_input_method_context *wl_input_method_context, struct wl_array *map) +{ + wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, + WL_INPUT_METHOD_CONTEXT_MODIFIERS_MAP, map); +} + +static inline void +wl_input_method_context_keysym(struct wl_input_method_context *wl_input_method_context, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) +{ + wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, + WL_INPUT_METHOD_CONTEXT_KEYSYM, serial, time, sym, state, modifiers); +} + +static inline struct wl_keyboard * +wl_input_method_context_grab_keyboard(struct wl_input_method_context *wl_input_method_context) +{ + struct wl_proxy *keyboard; + + keyboard = wl_proxy_create((struct wl_proxy *) wl_input_method_context, + &wl_keyboard_interface); + if (!keyboard) + return NULL; + + wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, + WL_INPUT_METHOD_CONTEXT_GRAB_KEYBOARD, keyboard); + + return (struct wl_keyboard *) keyboard; +} + +static inline void +wl_input_method_context_key(struct wl_input_method_context *wl_input_method_context, uint32_t serial, uint32_t time, uint32_t key, uint32_t state) +{ + wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, + WL_INPUT_METHOD_CONTEXT_KEY, serial, time, key, state); +} + +static inline void +wl_input_method_context_modifiers(struct wl_input_method_context *wl_input_method_context, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) +{ + wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, + WL_INPUT_METHOD_CONTEXT_MODIFIERS, serial, mods_depressed, mods_latched, mods_locked, group); +} + +static inline void +wl_input_method_context_language(struct wl_input_method_context *wl_input_method_context, uint32_t serial, const char *language) +{ + wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, + WL_INPUT_METHOD_CONTEXT_LANGUAGE, serial, language); +} + +static inline void +wl_input_method_context_text_direction(struct wl_input_method_context *wl_input_method_context, uint32_t serial, uint32_t direction) +{ + wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, + WL_INPUT_METHOD_CONTEXT_TEXT_DIRECTION, serial, direction); +} + +/** + * wl_input_method - input method + * @activate: activate event + * @deactivate: activate event + * + * An input method object is responsible to compose text in response to + * input from hardware or virtual keyboards. There is one input method + * object per seat. On activate there is a new input method context object + * created which allows the input method to communicate with the text + * model. + */ +struct wl_input_method_listener { + /** + * activate - activate event + * @id: (none) + * + * A text model was activated. Creates an input method context + * object which allows communication with the text model. + */ + void (*activate)(void *data, + struct wl_input_method *wl_input_method, + struct wl_input_method_context *id); + /** + * deactivate - activate event + * @context: (none) + * + * The text model corresponding to the context argument was + * deactivated. The input method context should be destroyed after + * deactivation is handled. + */ + void (*deactivate)(void *data, + struct wl_input_method *wl_input_method, + struct wl_input_method_context *context); +}; + +static inline int +wl_input_method_add_listener(struct wl_input_method *wl_input_method, + const struct wl_input_method_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) wl_input_method, + (void (**)(void)) listener, data); +} + +static inline void +wl_input_method_set_user_data(struct wl_input_method *wl_input_method, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) wl_input_method, user_data); +} + +static inline void * +wl_input_method_get_user_data(struct wl_input_method *wl_input_method) +{ + return wl_proxy_get_user_data((struct wl_proxy *) wl_input_method); +} + +static inline void +wl_input_method_destroy(struct wl_input_method *wl_input_method) +{ + wl_proxy_destroy((struct wl_proxy *) wl_input_method); +} + +#define WL_INPUT_PANEL_GET_INPUT_PANEL_SURFACE 0 + +static inline void +wl_input_panel_set_user_data(struct wl_input_panel *wl_input_panel, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) wl_input_panel, user_data); +} + +static inline void * +wl_input_panel_get_user_data(struct wl_input_panel *wl_input_panel) +{ + return wl_proxy_get_user_data((struct wl_proxy *) wl_input_panel); +} + +static inline void +wl_input_panel_destroy(struct wl_input_panel *wl_input_panel) +{ + wl_proxy_destroy((struct wl_proxy *) wl_input_panel); +} + +static inline struct wl_input_panel_surface * +wl_input_panel_get_input_panel_surface(struct wl_input_panel *wl_input_panel, struct wl_surface *surface) +{ + struct wl_proxy *id; + + id = wl_proxy_create((struct wl_proxy *) wl_input_panel, + &wl_input_panel_surface_interface); + if (!id) + return NULL; + + wl_proxy_marshal((struct wl_proxy *) wl_input_panel, + WL_INPUT_PANEL_GET_INPUT_PANEL_SURFACE, id, surface); + + return (struct wl_input_panel_surface *) id; +} + +#ifndef WL_INPUT_PANEL_SURFACE_POSITION_ENUM +#define WL_INPUT_PANEL_SURFACE_POSITION_ENUM +enum wl_input_panel_surface_position { + WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM = 0, +}; +#endif /* WL_INPUT_PANEL_SURFACE_POSITION_ENUM */ + +struct wl_input_panel_surface_listener { + /** + * cursor_rectangle - cursor rectangle + * @x: (none) + * @y: (none) + * @width: (none) + * @height: (none) + * + * Notify when the cursor rectangle relative to the input panel + * surface change. + */ + void (*cursor_rectangle)(void *data, + struct wl_input_panel_surface *wl_input_panel_surface, + int32_t x, + int32_t y, + int32_t width, + int32_t height); +}; + +static inline int +wl_input_panel_surface_add_listener(struct wl_input_panel_surface *wl_input_panel_surface, + const struct wl_input_panel_surface_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) wl_input_panel_surface, + (void (**)(void)) listener, data); +} + +#define WL_INPUT_PANEL_SURFACE_SET_TOPLEVEL 0 +#define WL_INPUT_PANEL_SURFACE_SET_OVERLAY_PANEL 1 + +static inline void +wl_input_panel_surface_set_user_data(struct wl_input_panel_surface *wl_input_panel_surface, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) wl_input_panel_surface, user_data); +} + +static inline void * +wl_input_panel_surface_get_user_data(struct wl_input_panel_surface *wl_input_panel_surface) +{ + return wl_proxy_get_user_data((struct wl_proxy *) wl_input_panel_surface); +} + +static inline void +wl_input_panel_surface_destroy(struct wl_input_panel_surface *wl_input_panel_surface) +{ + wl_proxy_destroy((struct wl_proxy *) wl_input_panel_surface); +} + +static inline void +wl_input_panel_surface_set_toplevel(struct wl_input_panel_surface *wl_input_panel_surface, struct wl_output *output, uint32_t position) +{ + wl_proxy_marshal((struct wl_proxy *) wl_input_panel_surface, + WL_INPUT_PANEL_SURFACE_SET_TOPLEVEL, output, position); +} + +static inline void +wl_input_panel_surface_set_overlay_panel(struct wl_input_panel_surface *wl_input_panel_surface) +{ + wl_proxy_marshal((struct wl_proxy *) wl_input_panel_surface, + WL_INPUT_PANEL_SURFACE_SET_OVERLAY_PANEL); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/input-method-protocol.c b/src/input-method-protocol.c new file mode 100644 index 0000000..ee297f9 --- /dev/null +++ b/src/input-method-protocol.c @@ -0,0 +1,126 @@ +/* + * Copyright © 2012, 2013 Intel Corporation + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of + * the copyright holders not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ +//#ifdef __cplusplus +#pragma message("extern C-----") +//extern "C" { +//#endif + +#include +#include +#include "wayland-util.h" + +extern const struct wl_interface wl_keyboard_interface; +extern const struct wl_interface wl_input_method_context_interface; +extern const struct wl_interface wl_input_method_context_interface; +extern const struct wl_interface wl_input_panel_surface_interface; +extern const struct wl_interface wl_surface_interface; +extern const struct wl_interface wl_output_interface; + +static const struct wl_interface *types[] = { + NULL, + NULL, + NULL, + NULL, + NULL, + &wl_keyboard_interface, + &wl_input_method_context_interface, + &wl_input_method_context_interface, + &wl_input_panel_surface_interface, + &wl_surface_interface, + &wl_output_interface, + NULL, +}; + +static const struct wl_message wl_input_method_context_requests[] = { + { "destroy", "", types + 0 }, + { "commit_string", "us", types + 0 }, + { "preedit_string", "uss", types + 0 }, + { "preedit_styling", "uuu", types + 0 }, + { "preedit_cursor", "i", types + 0 }, + { "delete_surrounding_text", "iu", types + 0 }, + { "cursor_position", "ii", types + 0 }, + { "modifiers_map", "a", types + 0 }, + { "keysym", "uuuuu", types + 0 }, + { "grab_keyboard", "n", types + 5 }, + { "key", "uuuu", types + 0 }, + { "modifiers", "uuuuu", types + 0 }, + { "language", "us", types + 0 }, + { "text_direction", "uu", types + 0 }, +}; + +static const struct wl_message wl_input_method_context_events[] = { + { "surrounding_text", "suu", types + 0 }, + { "reset", "", types + 0 }, + { "content_type", "uu", types + 0 }, + { "invoke_action", "uu", types + 0 }, + { "commit_state", "u", types + 0 }, + { "preferred_language", "s", types + 0 }, +}; + +WL_EXPORT const struct wl_interface wl_input_method_context_interface = { + "wl_input_method_context", 1, + 14, wl_input_method_context_requests, + 6, wl_input_method_context_events, +}; + +static const struct wl_message wl_input_method_events[] = { + { "activate", "n", types + 6 }, + { "deactivate", "o", types + 7 }, +}; + +WL_EXPORT const struct wl_interface wl_input_method_interface = { + "wl_input_method", 1, + 0, NULL, + 2, wl_input_method_events, +}; + +static const struct wl_message wl_input_panel_requests[] = { + { "get_input_panel_surface", "no", types + 8 }, +}; + +WL_EXPORT const struct wl_interface wl_input_panel_interface = { + "wl_input_panel", 1, + 1, wl_input_panel_requests, + 0, NULL, +}; + +static const struct wl_message wl_input_panel_surface_requests[] = { + { "set_toplevel", "ou", types + 10 }, + { "set_overlay_panel", "", types + 0 }, +}; + +static const struct wl_message wl_input_panel_surface_events[] = { + { "cursor_rectangle", "iiii", types + 0 }, +}; + +WL_EXPORT const struct wl_interface wl_input_panel_surface_interface = { + "wl_input_panel_surface", 1, + 2, wl_input_panel_surface_requests, + 1, wl_input_panel_surface_events, +}; + +//#ifdef __cplusplus +//} +//#endif diff --git a/src/sclcoreui-efl.cpp b/src/sclcoreui-efl.cpp index a0606f6..b071dda 100644 --- a/src/sclcoreui-efl.cpp +++ b/src/sclcoreui-efl.cpp @@ -26,12 +26,27 @@ #include #ifdef WAYLAND #include +#include "input-method-client-protocol.h" #else #include #include #include #endif +#ifdef WAYLAND +struct WaylandKeyboard +{ + 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 WaylandKeyboard wlkb = {0}; +#endif using namespace scl; @@ -273,6 +288,100 @@ void signal_handler(int sig) { elm_exit(); } +#ifdef WAYLAND +static bool +_wayland_setup(struct WaylandKeyboard *wlkb, Evas_Object *main_window) +{ + 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) + wlkb->ip = (wl_input_panel *)wl_registry_bind(registry, global->id, &wl_input_panel_interface, 1); + else if (strcmp(global->interface, "wl_output") == 0) + wlkb->output = (wl_output *)wl_registry_bind(registry, global->id, &wl_output_interface, 1); + } + + if (!wlkb->ip) { + LOGW ("Can't get wayland input panel interface\n"); + return false; + } + + if (!wlkb->output) { + LOGW ("Can't get wayland output interface\n"); + return false; + } + + wlkb->ee = ecore_evas_ecore_evas_get(evas_object_evas_get(main_window)); + if (!wlkb->ee) { + LOGW ("ERROR: Unable to create Ecore_Evas object"); + return false; + } + + /* Set input panel surface */ + LOGD ("Setting up input panel\n"); + wlkb->wl_win = ecore_evas_wayland_window_get(wlkb->ee); + if (!wlkb->wl_win) { + LOGW ("Couldn't get wayland window\n"); + return false; + } + + ecore_wl_window_type_set(wlkb->wl_win, ECORE_WL_WINDOW_TYPE_NONE); + wlkb->surface = ecore_wl_window_surface_create(wlkb->wl_win); + if (!wlkb->surface) { + LOGW ("Couldn't create surface\n"); + return false; + } + + ips = wl_input_panel_get_input_panel_surface(wlkb->ip, wlkb->surface); + if (!ips) { + LOGW ("Couldn't get input panel surface\n"); + return false; + } + + wl_input_panel_surface_set_toplevel(ips, wlkb->output, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM); + + return true; +} + +static Eina_Bool +check_evas_engine(struct WaylandKeyboard *wlkb) +{ + 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; + } + + wlkb->ee_engine = env; + ret = EINA_TRUE; + +err: + return ret; +} +#endif + void CSCLCoreUIEFL::run(const sclchar *display) { char *argv[4]; @@ -291,11 +400,33 @@ void CSCLCoreUIEFL::run(const sclchar *display) elm_init(argc, argv); +#ifdef WAYLAND + if (!check_evas_engine(&wlkb)) { + LOGW ("_wlkb_check_evas_engine error!\n"); + elm_shutdown (); + return; + } + LOGD ("Selected engine: '%s'\n", wlkb.ee_engine); +#endif + elm_policy_set(ELM_POLICY_THROTTLE, ELM_POLICY_THROTTLE_NEVER); Evas_Object *main_window = elm_win_add(NULL, uuid, ELM_WIN_UTILITY); + if (!main_window) { + LOGE("Failed to create main window\n"); + return; + } + m_main_window = SCL_WINDOW_CAST(main_window); +#ifdef WAYLAND + if (!_wayland_setup(&wlkb, main_window)) { + LOGW ("ERROR: Unable to setup input panel.\n"); + elm_shutdown(); + return; + } +#endif + elm_win_borderless_set(main_window, EINA_TRUE); elm_win_keyboard_win_set(main_window, EINA_TRUE); elm_win_autodel_set(main_window, EINA_TRUE); @@ -332,6 +463,8 @@ void CSCLCoreUIEFL::run(const sclchar *display) signal(SIGINT, signal_handler); signal(SIGHUP, signal_handler); + evas_object_show(main_window); + elm_run(); impl->fini(); -- 2.7.4 From 1a18fd4cbce225b405298fbd6dff7177da6fa03b Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 22 Jun 2015 03:31:12 -0700 Subject: [PATCH 04/16] Revert "Remove unsupported signal temporarily" This reverts commit 7f074f078c7ca019f0b86689e889988ada8583b6. Change-Id: I7b9aaab5863a8d0de18418826a5400a0204410b4 --- src/sclconnection-isf.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp index b178d9a..96bbb22 100644 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -597,6 +597,8 @@ sclboolean CSCLConnectionISF::init() 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_show_option_window (scim::slot (slot_show_ise_option_window)); + m_helper_agent.signal_connect_check_option_window (scim::slot (slot_check_ise_option_window)); m_helper_agent.signal_connect_process_key_event (scim::slot (slot_process_key_event)); m_initialized = TRUE; -- 2.7.4 From 78196b9bb6243d756158601c9533f026131da995 Mon Sep 17 00:00:00 2001 From: Wonkeun Oh Date: Wed, 17 Jun 2015 19:10:13 +0900 Subject: [PATCH 05/16] Modified window acceleration unit to fix graphic issue Change-Id: I3a191890c7275155834495040a18847bf1cc90de --- src/sclcoreui-efl.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sclcoreui-efl.cpp b/src/sclcoreui-efl.cpp index b071dda..3efd14d 100644 --- a/src/sclcoreui-efl.cpp +++ b/src/sclcoreui-efl.cpp @@ -409,6 +409,7 @@ void CSCLCoreUIEFL::run(const sclchar *display) LOGD ("Selected engine: '%s'\n", wlkb.ee_engine); #endif + elm_config_accel_preference_set("3d"); elm_policy_set(ELM_POLICY_THROTTLE, ELM_POLICY_THROTTLE_NEVER); Evas_Object *main_window = elm_win_add(NULL, uuid, ELM_WIN_UTILITY); -- 2.7.4 From fe33cfa99a409ed91f5e98e7c04f3d2b895f2694 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 2 Jul 2015 10:36:24 +0900 Subject: [PATCH 06/16] Add manifest file Change-Id: Ideb3aa101595ea3a8cb9987be630c2fa787800f3 --- libscl-core.manifest | 5 +++++ packaging/libscl-core.spec | 1 + 2 files changed, 6 insertions(+) create mode 100644 libscl-core.manifest diff --git a/libscl-core.manifest b/libscl-core.manifest new file mode 100644 index 0000000..017d22d --- /dev/null +++ b/libscl-core.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/libscl-core.spec b/packaging/libscl-core.spec index 2c7e07d..031ae7a 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -71,6 +71,7 @@ cp LICENSE %{buildroot}/usr/share/license/%{name} %postun %files +%manifest %{name}.manifest %defattr(-,root,root,-) %{_libdir}/libscl-core.so /usr/share/license/%{name} -- 2.7.4 From 4ded716c428a960f927b7e9625e5d9f739e8cf7c Mon Sep 17 00:00:00 2001 From: Sungmin Kwak Date: Fri, 10 Jul 2015 13:27:44 +0900 Subject: [PATCH 07/16] Delete unnecessary file Change-Id: Ib06f02d0c3e87db909d61c239c97e8ea3c1fd1fa --- packaging/libscl-core.manifest | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 packaging/libscl-core.manifest diff --git a/packaging/libscl-core.manifest b/packaging/libscl-core.manifest deleted file mode 100644 index 017d22d..0000000 --- a/packaging/libscl-core.manifest +++ /dev/null @@ -1,5 +0,0 @@ - - - - - -- 2.7.4 From bde4cbece55e4e378da5e57c6c5b7a23773c522a Mon Sep 17 00:00:00 2001 From: Sungmin Kwak Date: Fri, 10 Jul 2015 13:28:41 +0900 Subject: [PATCH 08/16] Update package version to 0.4.1 Change-Id: Ib6ae5bac73b6cd8d583ee342df03e47715e3e6ee --- packaging/libscl-core.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscl-core.spec b/packaging/libscl-core.spec index 031ae7a..2eb49a0 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -6,7 +6,7 @@ Name: libscl-core Summary: A library for developing software keyboards -Version: 0.4.0 +Version: 0.4.1 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 87bc7b46150a8438939577ccde06deb573b3b3ee Mon Sep 17 00:00:00 2001 From: Sungmin Kwak Date: Mon, 13 Jul 2015 19:04:39 +0900 Subject: [PATCH 09/16] Add x11 dependency Change-Id: I4e3f41114dd76fd9a551a6c81df98d003e59a54c --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 31d0203..b828496 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,7 @@ IF (with_wayland) ADD_DEFINITIONS("-DWAYLAND") pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES} ecore-wayland wayland-client) ELSE (with_wayland) - pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES} ecore-x) + pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES} ecore-x x11) ENDIF(with_wayland) FOREACH(flag ${pkgs_CFLAGS}) -- 2.7.4 From 04396d2079dd961483c530865c6c6795b8384dd7 Mon Sep 17 00:00:00 2001 From: Sungmin Kwak Date: Mon, 13 Jul 2015 19:10:49 +0900 Subject: [PATCH 10/16] Update package version to 0.4.2 Change-Id: Ic61ed8ac0b47ab19f7e04ea381055e00edfab1fc --- packaging/libscl-core.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscl-core.spec b/packaging/libscl-core.spec index 2eb49a0..67f68cb 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -6,7 +6,7 @@ Name: libscl-core Summary: A library for developing software keyboards -Version: 0.4.1 +Version: 0.4.2 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 87d2c3f177b71e43e57741efbb049e78a6cee5a0 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 23 Jul 2015 10:59:52 +0900 Subject: [PATCH 11/16] Use tizen-extension wayland protocol Change-Id: I43591f378cd15b8a470775bb20b0cd4b91f68ec4 --- CMakeLists.txt | 8 +- packaging/libscl-core.spec | 1 + src/input-method-client-protocol.h | 446 ------------------------------------- src/input-method-protocol.c | 126 ----------- src/sclcoreui-efl.cpp | 2 +- 5 files changed, 3 insertions(+), 580 deletions(-) delete mode 100644 src/input-method-client-protocol.h delete mode 100644 src/input-method-protocol.c diff --git a/CMakeLists.txt b/CMakeLists.txt index b828496..e065ab3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,12 +10,6 @@ SET(SRCS src/sclcore.cpp ) -IF (with_wayland) - SET(SRCS ${SRCS} src/input-method-protocol.c) -ELSE (with_wayland) - SET(SRCS ${SRCS}) -ENDIF (with_wayland) - SET(PACKAGE ${PROJECT_NAME}) SET(PKGNAME ${PACKAGE}) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) @@ -42,7 +36,7 @@ SET(PKGS_CHECK_MODULES IF (with_wayland) ADD_DEFINITIONS("-DWAYLAND") - pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES} ecore-wayland wayland-client) + pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES} ecore-wayland wayland-client input-method-client) ELSE (with_wayland) pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES} ecore-x x11) ENDIF(with_wayland) diff --git a/packaging/libscl-core.spec b/packaging/libscl-core.spec index 67f68cb..6d3ae54 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -20,6 +20,7 @@ BuildRequires: pkgconfig(isf) %if %{with wayland} BuildRequires: pkgconfig(ecore-wayland) BuildRequires: pkgconfig(wayland-client) +BuildRequires: pkgconfig(input-method-client) %else BuildRequires: pkgconfig(ecore-x) BuildRequires: pkgconfig(x11) diff --git a/src/input-method-client-protocol.h b/src/input-method-client-protocol.h deleted file mode 100644 index 070a97d..0000000 --- a/src/input-method-client-protocol.h +++ /dev/null @@ -1,446 +0,0 @@ -/* - * Copyright © 2012, 2013 Intel Corporation - * - * Permission to use, copy, modify, distribute, and sell this - * software and its documentation for any purpose is hereby granted - * without fee, provided that the above copyright notice appear in - * all copies and that both that copyright notice and this permission - * notice appear in supporting documentation, and that the name of - * the copyright holders not be used in advertising or publicity - * pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied - * warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ - -#ifndef INPUT_METHOD_CLIENT_PROTOCOL_H -#define INPUT_METHOD_CLIENT_PROTOCOL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include "wayland-client.h" - -struct wl_client; -struct wl_resource; - -struct wl_input_method_context; -struct wl_input_method; -struct wl_input_panel; -struct wl_input_panel_surface; - -extern const struct wl_interface wl_input_method_context_interface; -extern const struct wl_interface wl_input_method_interface; -extern const struct wl_interface wl_input_panel_interface; -extern const struct wl_interface wl_input_panel_surface_interface; - -/** - * wl_input_method_context - input method context - * @surrounding_text: surrounding text event - * @reset: (none) - * @content_type: (none) - * @invoke_action: (none) - * @commit_state: (none) - * @preferred_language: (none) - * - * Corresponds to a text model on input method side. An input method - * context is created on text mode activation on the input method side. It - * allows to receive information about the text model from the application - * via events. Input method contexts do not keep state after deactivation - * and should be destroyed after deactivation is handled. - * - * Text is generally UTF-8 encoded, indices and lengths are in bytes. - * - * Serials are used to synchronize the state between the text input and an - * input method. New serials are sent by the text input in the commit_state - * request and are used by the input method to indicate the known text - * input state in events like preedit_string, commit_string, and keysym. - * The text input can then ignore events from the input method which are - * based on an outdated state (for example after a reset). - */ -struct wl_input_method_context_listener { - /** - * surrounding_text - surrounding text event - * @text: (none) - * @cursor: (none) - * @anchor: (none) - * - * The plain surrounding text around the input position. Cursor - * is the position in bytes within the surrounding text relative to - * the beginning of the text. Anchor is the position in bytes of - * the selection anchor within the surrounding text relative to the - * beginning of the text. If there is no selected text anchor is - * the same as cursor. - */ - void (*surrounding_text)(void *data, - struct wl_input_method_context *wl_input_method_context, - const char *text, - uint32_t cursor, - uint32_t anchor); - /** - * reset - (none) - */ - void (*reset)(void *data, - struct wl_input_method_context *wl_input_method_context); - /** - * content_type - (none) - * @hint: (none) - * @purpose: (none) - */ - void (*content_type)(void *data, - struct wl_input_method_context *wl_input_method_context, - uint32_t hint, - uint32_t purpose); - /** - * invoke_action - (none) - * @button: (none) - * @index: (none) - */ - void (*invoke_action)(void *data, - struct wl_input_method_context *wl_input_method_context, - uint32_t button, - uint32_t index); - /** - * commit_state - (none) - * @serial: serial of text input state - */ - void (*commit_state)(void *data, - struct wl_input_method_context *wl_input_method_context, - uint32_t serial); - /** - * preferred_language - (none) - * @language: (none) - */ - void (*preferred_language)(void *data, - struct wl_input_method_context *wl_input_method_context, - const char *language); -}; - -static inline int -wl_input_method_context_add_listener(struct wl_input_method_context *wl_input_method_context, - const struct wl_input_method_context_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) wl_input_method_context, - (void (**)(void)) listener, data); -} - -#define WL_INPUT_METHOD_CONTEXT_DESTROY 0 -#define WL_INPUT_METHOD_CONTEXT_COMMIT_STRING 1 -#define WL_INPUT_METHOD_CONTEXT_PREEDIT_STRING 2 -#define WL_INPUT_METHOD_CONTEXT_PREEDIT_STYLING 3 -#define WL_INPUT_METHOD_CONTEXT_PREEDIT_CURSOR 4 -#define WL_INPUT_METHOD_CONTEXT_DELETE_SURROUNDING_TEXT 5 -#define WL_INPUT_METHOD_CONTEXT_CURSOR_POSITION 6 -#define WL_INPUT_METHOD_CONTEXT_MODIFIERS_MAP 7 -#define WL_INPUT_METHOD_CONTEXT_KEYSYM 8 -#define WL_INPUT_METHOD_CONTEXT_GRAB_KEYBOARD 9 -#define WL_INPUT_METHOD_CONTEXT_KEY 10 -#define WL_INPUT_METHOD_CONTEXT_MODIFIERS 11 -#define WL_INPUT_METHOD_CONTEXT_LANGUAGE 12 -#define WL_INPUT_METHOD_CONTEXT_TEXT_DIRECTION 13 - -static inline void -wl_input_method_context_set_user_data(struct wl_input_method_context *wl_input_method_context, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_input_method_context, user_data); -} - -static inline void * -wl_input_method_context_get_user_data(struct wl_input_method_context *wl_input_method_context) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_input_method_context); -} - -static inline void -wl_input_method_context_destroy(struct wl_input_method_context *wl_input_method_context) -{ - wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, - WL_INPUT_METHOD_CONTEXT_DESTROY); - - wl_proxy_destroy((struct wl_proxy *) wl_input_method_context); -} - -static inline void -wl_input_method_context_commit_string(struct wl_input_method_context *wl_input_method_context, uint32_t serial, const char *text) -{ - wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, - WL_INPUT_METHOD_CONTEXT_COMMIT_STRING, serial, text); -} - -static inline void -wl_input_method_context_preedit_string(struct wl_input_method_context *wl_input_method_context, uint32_t serial, const char *text, const char *commit) -{ - wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, - WL_INPUT_METHOD_CONTEXT_PREEDIT_STRING, serial, text, commit); -} - -static inline void -wl_input_method_context_preedit_styling(struct wl_input_method_context *wl_input_method_context, uint32_t index, uint32_t length, uint32_t style) -{ - wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, - WL_INPUT_METHOD_CONTEXT_PREEDIT_STYLING, index, length, style); -} - -static inline void -wl_input_method_context_preedit_cursor(struct wl_input_method_context *wl_input_method_context, int32_t index) -{ - wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, - WL_INPUT_METHOD_CONTEXT_PREEDIT_CURSOR, index); -} - -static inline void -wl_input_method_context_delete_surrounding_text(struct wl_input_method_context *wl_input_method_context, int32_t index, uint32_t length) -{ - wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, - WL_INPUT_METHOD_CONTEXT_DELETE_SURROUNDING_TEXT, index, length); -} - -static inline void -wl_input_method_context_cursor_position(struct wl_input_method_context *wl_input_method_context, int32_t index, int32_t anchor) -{ - wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, - WL_INPUT_METHOD_CONTEXT_CURSOR_POSITION, index, anchor); -} - -static inline void -wl_input_method_context_modifiers_map(struct wl_input_method_context *wl_input_method_context, struct wl_array *map) -{ - wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, - WL_INPUT_METHOD_CONTEXT_MODIFIERS_MAP, map); -} - -static inline void -wl_input_method_context_keysym(struct wl_input_method_context *wl_input_method_context, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) -{ - wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, - WL_INPUT_METHOD_CONTEXT_KEYSYM, serial, time, sym, state, modifiers); -} - -static inline struct wl_keyboard * -wl_input_method_context_grab_keyboard(struct wl_input_method_context *wl_input_method_context) -{ - struct wl_proxy *keyboard; - - keyboard = wl_proxy_create((struct wl_proxy *) wl_input_method_context, - &wl_keyboard_interface); - if (!keyboard) - return NULL; - - wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, - WL_INPUT_METHOD_CONTEXT_GRAB_KEYBOARD, keyboard); - - return (struct wl_keyboard *) keyboard; -} - -static inline void -wl_input_method_context_key(struct wl_input_method_context *wl_input_method_context, uint32_t serial, uint32_t time, uint32_t key, uint32_t state) -{ - wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, - WL_INPUT_METHOD_CONTEXT_KEY, serial, time, key, state); -} - -static inline void -wl_input_method_context_modifiers(struct wl_input_method_context *wl_input_method_context, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) -{ - wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, - WL_INPUT_METHOD_CONTEXT_MODIFIERS, serial, mods_depressed, mods_latched, mods_locked, group); -} - -static inline void -wl_input_method_context_language(struct wl_input_method_context *wl_input_method_context, uint32_t serial, const char *language) -{ - wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, - WL_INPUT_METHOD_CONTEXT_LANGUAGE, serial, language); -} - -static inline void -wl_input_method_context_text_direction(struct wl_input_method_context *wl_input_method_context, uint32_t serial, uint32_t direction) -{ - wl_proxy_marshal((struct wl_proxy *) wl_input_method_context, - WL_INPUT_METHOD_CONTEXT_TEXT_DIRECTION, serial, direction); -} - -/** - * wl_input_method - input method - * @activate: activate event - * @deactivate: activate event - * - * An input method object is responsible to compose text in response to - * input from hardware or virtual keyboards. There is one input method - * object per seat. On activate there is a new input method context object - * created which allows the input method to communicate with the text - * model. - */ -struct wl_input_method_listener { - /** - * activate - activate event - * @id: (none) - * - * A text model was activated. Creates an input method context - * object which allows communication with the text model. - */ - void (*activate)(void *data, - struct wl_input_method *wl_input_method, - struct wl_input_method_context *id); - /** - * deactivate - activate event - * @context: (none) - * - * The text model corresponding to the context argument was - * deactivated. The input method context should be destroyed after - * deactivation is handled. - */ - void (*deactivate)(void *data, - struct wl_input_method *wl_input_method, - struct wl_input_method_context *context); -}; - -static inline int -wl_input_method_add_listener(struct wl_input_method *wl_input_method, - const struct wl_input_method_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) wl_input_method, - (void (**)(void)) listener, data); -} - -static inline void -wl_input_method_set_user_data(struct wl_input_method *wl_input_method, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_input_method, user_data); -} - -static inline void * -wl_input_method_get_user_data(struct wl_input_method *wl_input_method) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_input_method); -} - -static inline void -wl_input_method_destroy(struct wl_input_method *wl_input_method) -{ - wl_proxy_destroy((struct wl_proxy *) wl_input_method); -} - -#define WL_INPUT_PANEL_GET_INPUT_PANEL_SURFACE 0 - -static inline void -wl_input_panel_set_user_data(struct wl_input_panel *wl_input_panel, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_input_panel, user_data); -} - -static inline void * -wl_input_panel_get_user_data(struct wl_input_panel *wl_input_panel) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_input_panel); -} - -static inline void -wl_input_panel_destroy(struct wl_input_panel *wl_input_panel) -{ - wl_proxy_destroy((struct wl_proxy *) wl_input_panel); -} - -static inline struct wl_input_panel_surface * -wl_input_panel_get_input_panel_surface(struct wl_input_panel *wl_input_panel, struct wl_surface *surface) -{ - struct wl_proxy *id; - - id = wl_proxy_create((struct wl_proxy *) wl_input_panel, - &wl_input_panel_surface_interface); - if (!id) - return NULL; - - wl_proxy_marshal((struct wl_proxy *) wl_input_panel, - WL_INPUT_PANEL_GET_INPUT_PANEL_SURFACE, id, surface); - - return (struct wl_input_panel_surface *) id; -} - -#ifndef WL_INPUT_PANEL_SURFACE_POSITION_ENUM -#define WL_INPUT_PANEL_SURFACE_POSITION_ENUM -enum wl_input_panel_surface_position { - WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM = 0, -}; -#endif /* WL_INPUT_PANEL_SURFACE_POSITION_ENUM */ - -struct wl_input_panel_surface_listener { - /** - * cursor_rectangle - cursor rectangle - * @x: (none) - * @y: (none) - * @width: (none) - * @height: (none) - * - * Notify when the cursor rectangle relative to the input panel - * surface change. - */ - void (*cursor_rectangle)(void *data, - struct wl_input_panel_surface *wl_input_panel_surface, - int32_t x, - int32_t y, - int32_t width, - int32_t height); -}; - -static inline int -wl_input_panel_surface_add_listener(struct wl_input_panel_surface *wl_input_panel_surface, - const struct wl_input_panel_surface_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) wl_input_panel_surface, - (void (**)(void)) listener, data); -} - -#define WL_INPUT_PANEL_SURFACE_SET_TOPLEVEL 0 -#define WL_INPUT_PANEL_SURFACE_SET_OVERLAY_PANEL 1 - -static inline void -wl_input_panel_surface_set_user_data(struct wl_input_panel_surface *wl_input_panel_surface, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_input_panel_surface, user_data); -} - -static inline void * -wl_input_panel_surface_get_user_data(struct wl_input_panel_surface *wl_input_panel_surface) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_input_panel_surface); -} - -static inline void -wl_input_panel_surface_destroy(struct wl_input_panel_surface *wl_input_panel_surface) -{ - wl_proxy_destroy((struct wl_proxy *) wl_input_panel_surface); -} - -static inline void -wl_input_panel_surface_set_toplevel(struct wl_input_panel_surface *wl_input_panel_surface, struct wl_output *output, uint32_t position) -{ - wl_proxy_marshal((struct wl_proxy *) wl_input_panel_surface, - WL_INPUT_PANEL_SURFACE_SET_TOPLEVEL, output, position); -} - -static inline void -wl_input_panel_surface_set_overlay_panel(struct wl_input_panel_surface *wl_input_panel_surface) -{ - wl_proxy_marshal((struct wl_proxy *) wl_input_panel_surface, - WL_INPUT_PANEL_SURFACE_SET_OVERLAY_PANEL); -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/input-method-protocol.c b/src/input-method-protocol.c deleted file mode 100644 index ee297f9..0000000 --- a/src/input-method-protocol.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright © 2012, 2013 Intel Corporation - * - * Permission to use, copy, modify, distribute, and sell this - * software and its documentation for any purpose is hereby granted - * without fee, provided that the above copyright notice appear in - * all copies and that both that copyright notice and this permission - * notice appear in supporting documentation, and that the name of - * the copyright holders not be used in advertising or publicity - * pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied - * warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ -//#ifdef __cplusplus -#pragma message("extern C-----") -//extern "C" { -//#endif - -#include -#include -#include "wayland-util.h" - -extern const struct wl_interface wl_keyboard_interface; -extern const struct wl_interface wl_input_method_context_interface; -extern const struct wl_interface wl_input_method_context_interface; -extern const struct wl_interface wl_input_panel_surface_interface; -extern const struct wl_interface wl_surface_interface; -extern const struct wl_interface wl_output_interface; - -static const struct wl_interface *types[] = { - NULL, - NULL, - NULL, - NULL, - NULL, - &wl_keyboard_interface, - &wl_input_method_context_interface, - &wl_input_method_context_interface, - &wl_input_panel_surface_interface, - &wl_surface_interface, - &wl_output_interface, - NULL, -}; - -static const struct wl_message wl_input_method_context_requests[] = { - { "destroy", "", types + 0 }, - { "commit_string", "us", types + 0 }, - { "preedit_string", "uss", types + 0 }, - { "preedit_styling", "uuu", types + 0 }, - { "preedit_cursor", "i", types + 0 }, - { "delete_surrounding_text", "iu", types + 0 }, - { "cursor_position", "ii", types + 0 }, - { "modifiers_map", "a", types + 0 }, - { "keysym", "uuuuu", types + 0 }, - { "grab_keyboard", "n", types + 5 }, - { "key", "uuuu", types + 0 }, - { "modifiers", "uuuuu", types + 0 }, - { "language", "us", types + 0 }, - { "text_direction", "uu", types + 0 }, -}; - -static const struct wl_message wl_input_method_context_events[] = { - { "surrounding_text", "suu", types + 0 }, - { "reset", "", types + 0 }, - { "content_type", "uu", types + 0 }, - { "invoke_action", "uu", types + 0 }, - { "commit_state", "u", types + 0 }, - { "preferred_language", "s", types + 0 }, -}; - -WL_EXPORT const struct wl_interface wl_input_method_context_interface = { - "wl_input_method_context", 1, - 14, wl_input_method_context_requests, - 6, wl_input_method_context_events, -}; - -static const struct wl_message wl_input_method_events[] = { - { "activate", "n", types + 6 }, - { "deactivate", "o", types + 7 }, -}; - -WL_EXPORT const struct wl_interface wl_input_method_interface = { - "wl_input_method", 1, - 0, NULL, - 2, wl_input_method_events, -}; - -static const struct wl_message wl_input_panel_requests[] = { - { "get_input_panel_surface", "no", types + 8 }, -}; - -WL_EXPORT const struct wl_interface wl_input_panel_interface = { - "wl_input_panel", 1, - 1, wl_input_panel_requests, - 0, NULL, -}; - -static const struct wl_message wl_input_panel_surface_requests[] = { - { "set_toplevel", "ou", types + 10 }, - { "set_overlay_panel", "", types + 0 }, -}; - -static const struct wl_message wl_input_panel_surface_events[] = { - { "cursor_rectangle", "iiii", types + 0 }, -}; - -WL_EXPORT const struct wl_interface wl_input_panel_surface_interface = { - "wl_input_panel_surface", 1, - 2, wl_input_panel_surface_requests, - 1, wl_input_panel_surface_events, -}; - -//#ifdef __cplusplus -//} -//#endif diff --git a/src/sclcoreui-efl.cpp b/src/sclcoreui-efl.cpp index 3efd14d..46dd493 100644 --- a/src/sclcoreui-efl.cpp +++ b/src/sclcoreui-efl.cpp @@ -26,7 +26,7 @@ #include #ifdef WAYLAND #include -#include "input-method-client-protocol.h" +#include #else #include #include -- 2.7.4 From 55956c5311009d1b15b059a8db1a219d41bedcfa Mon Sep 17 00:00:00 2001 From: Li Zhang Date: Fri, 24 Jul 2015 18:59:44 +0800 Subject: [PATCH 12/16] Update ISE geometry to ISF Change-Id: Ifbdd45404f4141299f07fa8d1583a85aa864c4a2 --- src/sclconnection-isf.cpp | 7 +++++++ src/sclconnection-isf.h | 1 + src/sclconnection.cpp | 7 +++++++ src/sclconnection.h | 1 + src/sclcoreimpl.cpp | 5 +++++ 5 files changed, 21 insertions(+) diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp index 7dc2569..2a32322 100644 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -934,6 +934,13 @@ void CSCLConnectionISF::get_keyboard_ise(const sclchar *uuid) } } +void CSCLConnectionISF::update_geometry(int x, int y, int width, int height) +{ + if (m_initialized) { + m_helper_agent.update_geometry(x, y, width, height); + } +} + extern "C" { void scim_module_init (void) { diff --git a/src/sclconnection-isf.h b/src/sclconnection-isf.h index 632ae4e..9a3f020 100644 --- a/src/sclconnection-isf.h +++ b/src/sclconnection-isf.h @@ -78,6 +78,7 @@ public: void candidate_hide(void); void set_keyboard_ise_by_uuid(const sclchar *uuid); void get_keyboard_ise(const sclchar *uuid); + void update_geometry(int x, int y, int width, int height); private: sclboolean m_initialized; diff --git a/src/sclconnection.cpp b/src/sclconnection.cpp index b63c028..c8bb36d 100644 --- a/src/sclconnection.cpp +++ b/src/sclconnection.cpp @@ -291,3 +291,10 @@ void CSCLConnection::get_keyboard_ise(const sclchar *uuid) m_impl->get_keyboard_ise(uuid); } } + +void CSCLConnection::update_geometry(int x, int y, int width, int height) +{ + if (m_impl) { + m_impl->update_geometry(x, y, width, height); + } +} diff --git a/src/sclconnection.h b/src/sclconnection.h index d4c5642..efadd1e 100644 --- a/src/sclconnection.h +++ b/src/sclconnection.h @@ -78,6 +78,7 @@ public: virtual void candidate_hide(void); virtual void set_keyboard_ise_by_uuid(const sclchar *uuid); virtual void get_keyboard_ise(const sclchar *uuid); + virtual void update_geometry(int x, int y, int width, int height); protected: std::string m_backend_identifier; diff --git a/src/sclcoreimpl.cpp b/src/sclcoreimpl.cpp index 16d179b..99c4a77 100644 --- a/src/sclcoreimpl.cpp +++ b/src/sclcoreimpl.cpp @@ -287,6 +287,11 @@ int CSCLCoreImpl::get_screen_rotation_degree() void CSCLCoreImpl::set_keyboard_size_hints(SclSize portrait, SclSize landscape) { + int degree = m_core_ui.get_screen_rotation_degree(); + if (degree == 90 || degree == 270) + m_connection.update_geometry(0, 0, landscape.width, landscape.height); + else + m_connection.update_geometry(0, 0, portrait.width, portrait.height); m_core_ui.set_keyboard_size_hints(portrait, landscape); } -- 2.7.4 From 828b20b476ebd754eb6c7a5da94080a3519ae688 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 30 Jul 2015 17:24:10 +0900 Subject: [PATCH 13/16] Add set_selection () API to select text Change-Id: Ic32a97b479c98ccb63f2decffb285cf318e42a43 --- src/sclconnection-isf.cpp | 7 +++++++ src/sclconnection-isf.h | 1 + src/sclconnection.cpp | 8 ++++++++ src/sclconnection.h | 1 + src/sclcore.cpp | 7 +++++++ src/sclcore.h | 8 ++++++++ src/sclcoreimpl.cpp | 5 +++++ src/sclcoreimpl.h | 2 ++ 8 files changed, 39 insertions(+) diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp index 2a32322..a35abb2 100644 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -934,6 +934,13 @@ void CSCLConnectionISF::get_keyboard_ise(const sclchar *uuid) } } +void CSCLConnectionISF::set_selection(sclint start, sclint end) +{ + if (m_initialized) { + m_helper_agent.set_selection(start, end); + } +} + void CSCLConnectionISF::update_geometry(int x, int y, int width, int height) { if (m_initialized) { diff --git a/src/sclconnection-isf.h b/src/sclconnection-isf.h index 9a3f020..2ef0605 100644 --- a/src/sclconnection-isf.h +++ b/src/sclconnection-isf.h @@ -78,6 +78,7 @@ public: void candidate_hide(void); void set_keyboard_ise_by_uuid(const sclchar *uuid); void get_keyboard_ise(const sclchar *uuid); + void set_selection(sclint start, sclint end); void update_geometry(int x, int y, int width, int height); private: diff --git a/src/sclconnection.cpp b/src/sclconnection.cpp index c8bb36d..b1ddef3 100644 --- a/src/sclconnection.cpp +++ b/src/sclconnection.cpp @@ -292,9 +292,17 @@ void CSCLConnection::get_keyboard_ise(const sclchar *uuid) } } +void CSCLConnection::set_selection(sclint start, sclint end) +{ + if (m_impl) { + m_impl->set_selection(start, end); + } +} + void CSCLConnection::update_geometry(int x, int y, int width, int height) { if (m_impl) { m_impl->update_geometry(x, y, width, height); } } + diff --git a/src/sclconnection.h b/src/sclconnection.h index efadd1e..24905d1 100644 --- a/src/sclconnection.h +++ b/src/sclconnection.h @@ -78,6 +78,7 @@ public: virtual void candidate_hide(void); virtual void set_keyboard_ise_by_uuid(const sclchar *uuid); virtual void get_keyboard_ise(const sclchar *uuid); + virtual void set_selection(sclint start, sclint end); virtual void update_geometry(int x, int y, int width, int height); protected: diff --git a/src/sclcore.cpp b/src/sclcore.cpp index 1e5f5ff..64f7c1b 100644 --- a/src/sclcore.cpp +++ b/src/sclcore.cpp @@ -292,3 +292,10 @@ void CSCLCore::destroy_option_window(sclwindow window) m_impl->destroy_option_window(window); } } + +void CSCLCore::set_selection(sclint start, sclint end) +{ + if (m_impl) { + m_impl->set_selection(start, end); + } +} diff --git a/src/sclcore.h b/src/sclcore.h index 7c446d2..bc5be66 100644 --- a/src/sclcore.h +++ b/src/sclcore.h @@ -310,6 +310,14 @@ public: */ void destroy_option_window(sclwindow window); + /** + * @ brief Request to select text. + * + * @param[in] start The start cursor position in text. + * @param[in] end The end cursor position in text. + */ + void set_selection(sclint start, sclint end); + private: CSCLCoreImpl *m_impl; }; diff --git a/src/sclcoreimpl.cpp b/src/sclcoreimpl.cpp index 99c4a77..d705522 100644 --- a/src/sclcoreimpl.cpp +++ b/src/sclcoreimpl.cpp @@ -304,3 +304,8 @@ void CSCLCoreImpl::destroy_option_window(sclwindow window) { m_core_ui.destroy_option_window(window); } + +void CSCLCoreImpl::set_selection(sclint start, sclint end) +{ + m_connection.set_selection(start, end); +} diff --git a/src/sclcoreimpl.h b/src/sclcoreimpl.h index 62d2c56..933b84d 100644 --- a/src/sclcoreimpl.h +++ b/src/sclcoreimpl.h @@ -96,6 +96,8 @@ public: sclwindow create_option_window(); void destroy_option_window(sclwindow window); + void set_selection(sclint start, sclint end); + private: ISCLCoreEventCallback *m_event_callback; -- 2.7.4 From 2f5b8a2f46b599c5f4f4ff47505f8d68237a060a Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 30 Jul 2015 18:59:25 +0900 Subject: [PATCH 14/16] Update package version to 0.4.3 Change-Id: I212786dd84d485112ffafab880cecf454415730d --- packaging/libscl-core.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscl-core.spec b/packaging/libscl-core.spec index 6d3ae54..280363c 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -6,7 +6,7 @@ Name: libscl-core Summary: A library for developing software keyboards -Version: 0.4.2 +Version: 0.4.3 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From fd0cb8ad56d5522c67a10eafc6ec34edeb90403b Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 31 Jul 2015 11:49:37 +0900 Subject: [PATCH 15/16] Request to showing main window in advance in wayland environment Change-Id: Ia826fc7f00a883b9a15c08444f2b712e335bf6df --- src/sclcoreui-efl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sclcoreui-efl.cpp b/src/sclcoreui-efl.cpp index 46dd493..cd75b88 100644 --- a/src/sclcoreui-efl.cpp +++ b/src/sclcoreui-efl.cpp @@ -464,7 +464,9 @@ void CSCLCoreUIEFL::run(const sclchar *display) signal(SIGINT, signal_handler); signal(SIGHUP, signal_handler); +#ifdef WAYLAND evas_object_show(main_window); +#endif elm_run(); -- 2.7.4 From 4e6adad8ce02021e87f583acf5e5eeea8c8a8868 Mon Sep 17 00:00:00 2001 From: Haifeng Deng Date: Fri, 7 Aug 2015 15:56:38 +0800 Subject: [PATCH 16/16] Add config_flush () Change-Id: Iba55c303b1e459ac2c374fb20d06c69b32409b6e Signed-off-by: Haifeng Deng --- src/sclconnection-isf.cpp | 15 +++++++++++++++ src/sclconnection-isf.h | 1 + src/sclconnection.cpp | 9 +++++++++ src/sclconnection.h | 1 + src/sclcore.cpp | 9 +++++++++ src/sclcore.h | 5 +++++ src/sclcoreimpl.cpp | 5 +++++ src/sclcoreimpl.h | 1 + 8 files changed, 46 insertions(+) diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp index a35abb2..96514eb 100644 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -667,6 +667,7 @@ sclboolean CSCLConnectionISF::config_read_int(const sclchar *name, sclint &value sclboolean ret = FALSE; if (m_initialized && _scim_config) { value = _scim_config->read(name, value); + ret = TRUE; } return ret; } @@ -676,6 +677,7 @@ sclboolean CSCLConnectionISF::config_read_string(const sclchar *name, std::strin sclboolean ret = FALSE; if (m_initialized && _scim_config) { value = _scim_config->read(name, value); + ret = TRUE; } return ret; } @@ -685,6 +687,7 @@ sclboolean CSCLConnectionISF::config_write_int(const sclchar *name, sclint value sclboolean ret = FALSE; if (m_initialized && _scim_config) { _scim_config->write(name, value); + ret = TRUE; } return ret; } @@ -694,6 +697,7 @@ sclboolean CSCLConnectionISF::config_write_string(const sclchar *name, const std sclboolean ret = FALSE; if (m_initialized && _scim_config) { _scim_config->write(name, value); + ret = TRUE; } return ret; } @@ -703,6 +707,17 @@ sclboolean CSCLConnectionISF::config_erase(const sclchar *name) sclboolean ret = FALSE; if (m_initialized && _scim_config) { _scim_config->erase(name); + ret = TRUE; + } + return ret; +} + +sclboolean CSCLConnectionISF::config_flush(void) +{ + sclboolean ret = FALSE; + if (m_initialized && _scim_config) { + _scim_config->flush(); + ret = TRUE; } return ret; } diff --git a/src/sclconnection-isf.h b/src/sclconnection-isf.h index 2ef0605..a31098f 100644 --- a/src/sclconnection-isf.h +++ b/src/sclconnection-isf.h @@ -53,6 +53,7 @@ public: sclboolean config_write_int(const sclchar *name, sclint value); sclboolean config_write_string(const sclchar *name, const std::string value); sclboolean config_erase(const sclchar *name); + sclboolean config_flush(void); void send_imengine_event(sclint ic, const sclchar *ic_uuid, const sclint command, const sclu32 value); void reset_keyboard_ise(); diff --git a/src/sclconnection.cpp b/src/sclconnection.cpp index b1ddef3..77dd424 100644 --- a/src/sclconnection.cpp +++ b/src/sclconnection.cpp @@ -124,6 +124,15 @@ sclboolean CSCLConnection::config_erase(const sclchar *name) return ret; } +sclboolean CSCLConnection::config_flush(void) +{ + sclboolean ret = FALSE; + if (m_impl) { + ret = m_impl->config_flush(); + } + return ret; +} + void CSCLConnection::send_imengine_event(sclint ic, const sclchar *ic_uuid, const sclint command, const sclu32 value) { if (m_impl) { diff --git a/src/sclconnection.h b/src/sclconnection.h index 24905d1..bf9df23 100644 --- a/src/sclconnection.h +++ b/src/sclconnection.h @@ -53,6 +53,7 @@ public: virtual sclboolean config_write_int(const sclchar *name, sclint value); virtual sclboolean config_write_string(const sclchar *name, const std::string value); virtual sclboolean config_erase(const sclchar *name); + virtual sclboolean config_flush(void); virtual void send_imengine_event(sclint ic, const sclchar *ic_uuid, const sclint command, const sclu32 value); virtual void reset_keyboard_ise(); diff --git a/src/sclcore.cpp b/src/sclcore.cpp index 64f7c1b..aa17f15 100644 --- a/src/sclcore.cpp +++ b/src/sclcore.cpp @@ -93,6 +93,15 @@ sclboolean CSCLCore::config_erase(const sclchar *name) return ret; } +sclboolean CSCLCore::config_flush(void) +{ + sclboolean ret = FALSE; + if (m_impl) { + ret = m_impl->config_flush(); + } + return ret; +} + void CSCLCore::send_imengine_event(sclint ic, const sclchar *ic_uuid, const sclint command, const sclu32 value) { if (m_impl) { diff --git a/src/sclcore.h b/src/sclcore.h index bc5be66..521b165 100644 --- a/src/sclcore.h +++ b/src/sclcore.h @@ -78,6 +78,11 @@ public: sclboolean config_erase(const sclchar *name); /** + * @brief Request ISF to permanently writes all changes. + */ + sclboolean config_flush(void); + + /** * @brief Send an Event to IMEngine * * @param[in] ic The handle of the IMEngineInstance to receive the event. diff --git a/src/sclcoreimpl.cpp b/src/sclcoreimpl.cpp index d705522..de45bab 100644 --- a/src/sclcoreimpl.cpp +++ b/src/sclcoreimpl.cpp @@ -125,6 +125,11 @@ sclboolean CSCLCoreImpl::config_erase(const sclchar *name) return m_connection.config_erase(name); } +sclboolean CSCLCoreImpl::config_flush(void) +{ + return m_connection.config_flush(); +} + void CSCLCoreImpl::send_imengine_event(sclint ic, const sclchar *ic_uuid, const sclint command, const sclu32 value) { m_connection.send_imengine_event(ic, ic_uuid, command, value); diff --git a/src/sclcoreimpl.h b/src/sclcoreimpl.h index 933b84d..2a7d61f 100644 --- a/src/sclcoreimpl.h +++ b/src/sclcoreimpl.h @@ -58,6 +58,7 @@ public: sclboolean config_write_int(const sclchar *name, sclint value); sclboolean config_write_string(const sclchar *name, const std::string value); sclboolean config_erase(const sclchar *name); + sclboolean config_flush(void); void send_imengine_event(sclint ic, const sclchar *ic_uuid, const sclint command, const sclu32 value); void reset_keyboard_ise(); -- 2.7.4