Merge "Change filter_event to return true even read_from_socket fails" into tizen_3.0
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 1 Feb 2017 00:37:27 +0000 (16:37 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 1 Feb 2017 00:37:27 +0000 (16:37 -0800)
19 files changed:
configure.ac
ism/extras/efl_panel/Makefile.am
ism/extras/efl_panel/isf_panel_efl.cpp
ism/extras/efl_panel/remote_input.cpp
ism/extras/pkgmgr_parser/Makefile.am
ism/extras/pkgmgr_parser/ime_parser.c
ism/extras/wayland_immodule/wayland_imcontext.c
ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp
ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp
ism/src/Makefile.am
ism/src/isf_info_manager.cpp
ism/src/isf_panel_agent_base.cpp
ism/src/isf_panel_agent_base.h
ism/src/isf_panel_agent_manager.cpp
ism/src/isf_panel_agent_manager.h
ism/src/isf_remote_client.cpp
ism/src/isf_remote_control.cpp
ism/src/privilege_checker.cpp
packaging/isf.spec

index 0069e02..0db15b6 100644 (file)
@@ -1,6 +1,6 @@
 # Process this file with autoconf to produce a configure script
 #AC_INIT(scim, 1.4.7, suzhe@tsinghua.org.cn)
-AC_INIT(isf, 3.0.158, isf@samsung.com)
+AC_INIT(isf, 3.0.165, isf@samsung.com)
 AC_CONFIG_SRCDIR([ism/src/scim.h])
 
 ###########################################################
@@ -10,7 +10,7 @@ AC_CONFIG_SRCDIR([ism/src/scim.h])
 # ISF version
 ISF_MAJOR_VERSION=3
 ISF_MINOR_VERSION=0
-ISF_MICRO_VERSION=158
+ISF_MICRO_VERSION=165
 
 ISF_VERSION=$ISF_MAJOR_VERSION.$ISF_MINOR_VERSION.$ISF_MICRO_VERSION
 
index d881bf0..919e69a 100644 (file)
@@ -38,6 +38,7 @@ endif
 
 isf_panel_efl_CXXFLAGS = @ECOREX_CFLAGS@ \
                          @ECORE_WL_CFLAGS@ \
+                         @EINA_CFLAGS@ \
                          @EDJE_CFLAGS@ \
                          @ELEMENTARY_CFLAGS@ \
                          @VCONF_CFLAGS@ \
@@ -57,6 +58,7 @@ isf_panel_efl_CXXFLAGS = @ECOREX_CFLAGS@ \
 isf_panel_efl_LDFLAGS  = @LTLIBINTL@ -rpath $(libdir) \
                          @ECOREX_LIBS@ \
                          @ECORE_WL_LIBS@ \
+                         @EINA_LIBS@ \
                          @EDJE_LIBS@ \
                          @ELEMENTARY_LIBS@ \
                          @VCONF_LIBS@ \
index 5dbf9f3..3643ff9 100644 (file)
@@ -38,6 +38,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <glib.h>
+#include <Eina.h>
 #include <Evas.h>
 #include <Ecore.h>
 #include <malloc.h>
index 14f31c9..1e94cc1 100644 (file)
@@ -28,6 +28,7 @@
 #include <math.h>
 #include <Ecore_Wayland.h>
 #include <xkbcommon/xkbcommon.h>
+#include "isf_debug.h"
 
 #ifdef LOG_TAG
 # undef LOG_TAG
index 861060f..6e2ae44 100644 (file)
@@ -8,6 +8,7 @@ AM_CPPFLAGS       = -I$(top_builddir) \
                  -I$(top_srcdir)/ism/intl \
                  -I$(top_srcdir)/ism/utils \
                  -I$(includedir) \
+                 -DSCIM_LIBEXECDIR=\"@SCIM_LIBEXECDIR@\" \
                  @ISF_BUILDING_DLL@
 
 CONFIG_IMEPARSER_MODULE = libimeparser.la
index 90e2e45..8cf1199 100644 (file)
@@ -27,7 +27,7 @@
 #define EXPORT_API __attribute__((visibility("default")))
 #endif
 
-#define SCIM_HELPER_LAUNCHER_PROGRAM "/usr/lib/scim-1.0/scim-helper-launcher"
+#define SCIM_HELPER_LAUNCHER_PROGRAM  (SCIM_LIBEXECDIR "/scim-helper-launcher")
 
 #ifdef LOG_TAG
 #undef LOG_TAG
index 7bf4048..eb0b1e2 100644 (file)
@@ -109,6 +109,7 @@ static Ecore_Event_Handler *_conformant_change_handler   = NULL;
 static Eina_Bool             _custom_conformant_event     = EINA_FALSE;
 static Eina_Bool             _received_will_hide_event    = EINA_FALSE;
 static Eina_Bool             _conformant_reset_done       = EINA_FALSE;
+static Eina_Bool             _conformant_reset_started    = EINA_FALSE;
 static Evas                 *_active_context_canvas       = NULL;
 static unsigned int          _active_context_window_id    = 0;
 
@@ -447,12 +448,12 @@ analyze_surrounding_text (Ecore_IMF_Context *ctx)
             break;
     }
 
-    if (imcontext->cursor_position == 0)
-        return EINA_TRUE;
-
     if (imcontext->preedit_text && strcmp (imcontext->preedit_text, "") != 0)
         return EINA_FALSE;
 
+    if (imcontext->cursor_position == 0)
+        return EINA_TRUE;
+
     ecore_imf_context_surrounding_get (ctx, &plain_str, &cursor_pos);
 
     if (!plain_str) goto done;
@@ -904,6 +905,8 @@ static Eina_Bool reset_conformant_area(Ecore_IMF_Context *ctx)
             ev->state = 0;
             ecore_event_add(ECORE_WL_EVENT_CONFORMANT_CHANGE, ev, NULL, NULL);
         }
+
+        _conformant_reset_started = EINA_TRUE;
     }
 
     return reset;
@@ -947,6 +950,7 @@ static void restore_conformant_area(Ecore_IMF_Context *ctx)
             ev->state = 0;
             ecore_event_add(ECORE_WL_EVENT_CONFORMANT_CHANGE, ev, NULL, NULL);
         }
+        _conformant_reset_started = EINA_FALSE;
     }
 }
 
@@ -968,7 +972,7 @@ _hide_timer_handler(void *data)
     Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)data;
     _send_input_panel_hide_request(ctx);
 
-    if (!reset_conformant_area(ctx)) {
+    if (!reset_conformant_area(ctx) && !_conformant_reset_started) {
         LOGD("No need to reset conformant, sending ACK right away");
         _send_will_hide_ack((WaylandIMContext *)ecore_imf_context_data_get(ctx));
     }
@@ -992,12 +996,13 @@ _input_panel_hide(Ecore_IMF_Context *ctx, Eina_Bool instant)
     if (!ctx) return;
 
     will_hide = EINA_TRUE;
+    _conformant_reset_started = EINA_FALSE;
 
     if (instant || (_hide_timer && ecore_timer_pending_get(_hide_timer) <= 0.0)) {
         _clear_hide_timer();
         _send_input_panel_hide_request(ctx);
 
-        if (!reset_conformant_area(ctx)) {
+        if (!reset_conformant_area(ctx) && !_conformant_reset_started) {
             LOGD("No need to reset conformant, sending ACK right away");
             _send_will_hide_ack((WaylandIMContext *)ecore_imf_context_data_get(ctx));
         }
@@ -1209,34 +1214,36 @@ commit_preedit(WaylandIMContext *imcontext)
     }
 }
 
-static void
+static Eina_Bool
 set_focus(Ecore_IMF_Context *ctx)
 {
     LOGD("");
     WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
-    if (!imcontext) return;
+    if (!imcontext) return EINA_FALSE;
 
     if (!imcontext->window) {
         LOGW("window is not given\n");
-        return;
+        return EINA_FALSE;
     }
 
     Ecore_Wl_Input *input = ecore_wl_window_keyboard_get(imcontext->window);
     if (!input) {
         LOGW("Can't get Wl_Input\n");
-        return;
+        return EINA_FALSE;
     }
 
     struct wl_seat *seat = ecore_wl_input_seat_get(input);
     if (!seat) {
         LOGW("Can't get Wl_seat\n");
-        return;
+        return EINA_FALSE;
     }
 
     imcontext->input = input;
 
     wl_text_input_activate(imcontext->text_input, seat,
             ecore_wl_window_surface_get(imcontext->window));
+
+    return EINA_TRUE;
 }
 
 static void
@@ -1375,6 +1382,7 @@ static void _render_post_cb(void *data, Evas *e, void *event_info)
 {
     void *callback = evas_event_callback_del(e, EVAS_CALLBACK_RENDER_POST, _render_post_cb);
     _conformant_reset_done = EINA_TRUE;
+    _conformant_reset_started = EINA_FALSE;
     LOGD("[_render_post_cb], _conformant_reset_done = 1 , %p\n", callback);
     send_will_hide_ack(NULL);
 }
@@ -1397,6 +1405,7 @@ static Eina_Bool _conformant_change_cb(void *data, int ev_type, void *ev)
         LOGD("_conformant_reset_done = 0, registering _render_post_cb : %p %p\n", _active_context_canvas, window);
         _conformant_reset_done = EINA_FALSE;
         if (_active_context_canvas && ecore_wl_window_conformant_get(window) && !_custom_conformant_event) {
+            evas_event_callback_del(_active_context_canvas, EVAS_CALLBACK_RENDER_POST, _render_post_cb);
             evas_event_callback_add(_active_context_canvas, EVAS_CALLBACK_RENDER_POST, _render_post_cb, ctx);
         }
     } else {
@@ -1517,11 +1526,6 @@ show_input_panel(Ecore_IMF_Context *ctx)
     if ((!imcontext) || (!imcontext->text_input))
         return EINA_FALSE;
 
-    if (hw_keyboard_mode) {
-        LOGD ("H/W keyboard is existed.\n");
-        return EINA_FALSE;
-    }
-
     if (!imcontext->input) {
         set_focus(ctx);
         if (!imcontext->input) {
@@ -2058,7 +2062,11 @@ text_input_private_command(void                 *data,
         Ecore_Wl_Window *window = imcontext->window;
         if (!window) return;
 
-        if (!reset_conformant_area(imcontext->ctx)) {
+        if (!reset_conformant_area(imcontext->ctx) && !_conformant_reset_started) {
+            LOGD("Could not reset conformant area, send will_hide_ack right away %d", _conformant_reset_started);
+            _send_will_hide_ack(imcontext);
+        } else if (_conformant_reset_done) {
+            LOGD("Conformant reset has been already finished, send will_hide_ack right away");
             _send_will_hide_ack(imcontext);
         }
     } else if (strncmp(command, szConformantRestore, strlen(szConformantRestore)) == 0) {
@@ -2459,7 +2467,11 @@ wayland_im_context_focus_in(Ecore_IMF_Context *ctx)
     _focused_ctx = ctx;
     //
 
-    set_focus(ctx);
+    if (!set_focus(ctx)) {
+        _focused_ctx = NULL;
+        LOGW("Fail to set focus!");
+        return;
+    }
 
     LOGD ("ctx : %p. on demand : %d\n", ctx, ecore_imf_context_input_panel_show_on_demand_get (ctx));
 
@@ -2489,10 +2501,8 @@ wayland_im_context_focus_out(Ecore_IMF_Context *ctx)
 
     if (!imcontext || !imcontext->input) return;
 
-    if (imcontext->text_input) {
-        if (ecore_imf_context_input_panel_enabled_get(ctx)) {
-            ecore_imf_context_input_panel_hide(ctx);
-        }
+    if (ecore_imf_context_input_panel_enabled_get(ctx)) {
+        ecore_imf_context_input_panel_hide(ctx);
     }
 
     set_focus_out(ctx);
@@ -2573,7 +2583,7 @@ wayland_im_context_cursor_position_set (Ecore_IMF_Context *ctx,
 
             set_autocapital (ctx);
 
-            if (!imcontext->preedit_text)
+            if (!imcontext->preedit_text || strlen(imcontext->preedit_text) == 0)
                 wl_text_input_set_cursor_position (imcontext->text_input, cursor_pos);
         }
     }
index 6e14dc3..722a267 100644 (file)
@@ -1636,11 +1636,13 @@ private:
         Socket client_socket(client);
         m_send_trans.write_to_socket(client_socket);
     }
-private:
 
-    static void send_fail_reply (int client_id)
+    void send_fail_reply (int client)
     {
-        Socket client_socket (client_id);
+        SCIM_DEBUG_MAIN(4) << __FUNCTION__ << " (" << client << ")\n";
+        LOGD ("client id:%d\n", client);
+
+        Socket client_socket (client);
         Transaction trans;
         trans.clear ();
         trans.put_command (SCIM_TRANS_CMD_REPLY);
@@ -1648,6 +1650,8 @@ private:
         trans.write_to_socket (client_socket);
     }
 
+private:
+
     bool filter_event(int fd) {
         SCIM_DEBUG_MAIN(1) << "PanelAgent::filter_event ()\n";
 
index 0e5b792..7beaeeb 100644 (file)
@@ -616,7 +616,7 @@ static const struct wl_keyboard_listener wsc_im_keyboard_listener = {
 #endif
 
 static void
-_wsc_im_activate (void *data, struct wl_input_method *input_method, struct wl_input_method_context *im_ctx, uint32_t text_input_id)
+_wsc_im_activate (void *data, struct wl_input_method *input_method, struct wl_input_method_context *im_ctx, uint32_t text_input_id, uint32_t focus_in_event)
 {
     struct weescim *wsc = (weescim*)data;
     if (!wsc) return;
@@ -666,17 +666,19 @@ _wsc_im_activate (void *data, struct wl_input_method *input_method, struct wl_in
 
     isf_wsc_context_add (wsc_ctx);
 
-    isf_wsc_context_focus_in (wsc_ctx);
+    if (focus_in_event)
+        isf_wsc_context_focus_in (wsc_ctx);
 }
 
 static void
-_wsc_im_deactivate (void *data, struct wl_input_method *input_method, struct wl_input_method_context *im_ctx)
+_wsc_im_deactivate (void *data, struct wl_input_method *input_method, struct wl_input_method_context *im_ctx, uint32_t focus_out_event)
 {
     struct weescim *wsc = (weescim*)data;
     if (!wsc || !wsc->wsc_ctx) return;
     WSCContextISF *wsc_ctx = wsc->wsc_ctx;
 
-    isf_wsc_context_focus_out (wsc_ctx);
+    if (focus_out_event)
+        isf_wsc_context_focus_out (wsc_ctx);
 
 #if ENABLE_GRAB_KEYBOARD
     if (wsc_ctx->keyboard) {
@@ -1766,20 +1768,24 @@ remote_surrounding_text_fd_read_func (void* data, Ecore_Fd_Handler* fd_handler)
     int len = read (fd, buff, sizeof (buff) - 1);
 
     if (len == 0) {
-        LOGD ("update");
+        SECURE_LOGD ("remote_surrounding_text : %s, surrounding_cursor : %d\n", wsc_ctx->remote_surrounding_text, wsc_ctx->surrounding_cursor);
         isf_wsc_context_send_surrounding_text (wsc_ctx, wsc_ctx->remote_surrounding_text ? wsc_ctx->remote_surrounding_text : "", wsc_ctx->surrounding_cursor);
     } else if (len < 0) {
         LOGW ("failed");
     } else {
         buff[len] = '\0';
         if (wsc_ctx->remote_surrounding_text == NULL) {
-            wsc_ctx->remote_surrounding_text = (char*)malloc (len + 1);
-            if (wsc_ctx->remote_surrounding_text) {
-                memcpy (wsc_ctx->remote_surrounding_text, buff, len);
-                wsc_ctx->remote_surrounding_text[len] = '\0';
-                return ECORE_CALLBACK_RENEW;
-            } else {
-                LOGE ("malloc failed");
+            if (len >= (int)sizeof(int)) {
+                /* Add one byte for terminating NULL character and subtract <int> byte for cursor position */
+                wsc_ctx->remote_surrounding_text = (char*)malloc (len + 1 - sizeof(int));
+                if (wsc_ctx->remote_surrounding_text) {
+                    memcpy(&(wsc_ctx->surrounding_cursor), buff, sizeof(int));
+                    memcpy (wsc_ctx->remote_surrounding_text, buff + sizeof(int), len - sizeof(int));
+                    wsc_ctx->remote_surrounding_text[len - sizeof(int)] = '\0';
+                    return ECORE_CALLBACK_RENEW;
+                } else {
+                    LOGE ("malloc failed");
+                }
             }
         } else {
             int old_len = strlen (wsc_ctx->remote_surrounding_text);
@@ -2303,6 +2309,9 @@ panel_slot_commit_string (int context, const WideString &wstr, bool remote_mode)
                 return;
             }
             check_input_resource (ic, INPUT_RESOURCE_REMOTE);
+
+            if (ic->impl->panel_layout == ECORE_IMF_INPUT_PANEL_LAYOUT_URL)
+                wsc_context_delete_surrounding (ic, -ic->impl->cursor_pos, ic->impl->surrounding_text.length ());
         } else {
             check_input_resource (ic, INPUT_RESOURCE_LOCAL);
         }
index 1dc0d55..5f48636 100644 (file)
@@ -164,13 +164,14 @@ libscim@SCIM_EPOCH@_la_SOURCES = \
                          isf_remote_client.cpp
 
 libscim@SCIM_EPOCH@_la_CXXFLAGS = @EVAS_CFLAGS@ \
-                         @ECORE_CFLAGS@ \
+                         @EINA_CFLAGS@ \
                          @ECORE_IMF_CFLAGS@ \
                          @DLOG_CFLAGS@ \
                          @DB_UTIL_CFLAGS@ \
                          @TZPLATFORM_CONFIG_CFLAGS@ \
                          @PKGMGR_INFO_CFLAGS@ \
-                         @VCONF_CFLAGS@
+                         @VCONF_CFLAGS@ \
+                         @GLIB_CFLAGS@
 
 libscim@SCIM_EPOCH@_la_LDFLAGS  = -version-info $(SCIM_CURRENT):$(SCIM_REVISION):$(SCIM_AGE) \
                          -export-dynamic \
@@ -179,12 +180,13 @@ libscim@SCIM_EPOCH@_la_LDFLAGS  = -version-info $(SCIM_CURRENT):$(SCIM_REVISION)
                          @LIBTOOL_EXPORT_OPTIONS@ \
                          @LIBICONV@ \
                          @LTLIBINTL@ \
-                         @ECORE_LIBS@ \
+                         @EINA_LIBS@ \
                          @DLOG_LIBS@ \
                          @DB_UTIL_LIBS@ \
                          @TZPLATFORM_CONFIG_LIBS@ \
                          @PKGMGR_INFO_LIBS@ \
                          @VCONF_LIBS@ \
+                         @GLIB_LIBS@ \
                          -lstdc++
 
 libscim@SCIM_EPOCH@_la_LIBADD  = libltdlc.la
index 2d275cb..38ca94a 100644 (file)
@@ -231,6 +231,18 @@ get_imengine_client_context (uint32 helper_ic, int& client, uint32& context)
     context  = ((helper_ic >> 16) & 0x7FFF);
 }
 
+static bool
+clients_equal (int first, int second)
+{
+    return ((first & 0xFFFF) == (second & 0xFFFF));
+}
+
+static bool
+contexts_equal (uint32 first, uint32 second)
+{
+    return ((first & 0x7FFF) == (second & 0x7FFF));
+}
+
 //==================================== InfoManager ===========================
 class InfoManager::InfoManagerImpl
 {
@@ -3285,6 +3297,11 @@ client context helpers: %d, helpers uuid count: %d",
             SCIM_DEBUG_MAIN (5) << "Target UUID = " << target_uuid << "  Focused UUId = " << focused_uuid << "\nTarget Client = " << target_client << "\n";
 
             if (client_info.type == FRONTEND_CLIENT) {
+                /* If the original context value is greater than 0x7FFF, the line below would not work properly
+                   since the target_context acquired by get_imengnie_client_context() is always smaller than 0x7FFF.
+                   But since the send_imengine_event() of scim_helper module will call IMEngine's
+                   process_helper_event() function directly, instead of sending SEND_IMENGINE_EVENT message.
+                   So we are not going to handle this kind of exceptional case for now. */
                 m_panel_agent_manager.process_helper_event (target_client, target_context, target_uuid, hiit->second.uuid, nest_trans);
             }
         }
@@ -3311,12 +3328,18 @@ client context helpers: %d, helpers uuid count: %d",
             if (target_client == -1) {
                 /* FIXUP: monitor 'Invalid Window' error */
                 LOGW ("focused target client is NULL");
-            } else if (target_client == focused_client && target_context == focused_context && target_uuid == focused_uuid) {
-                ClientInfo client_info = socket_get_client_info (target_client);
+            } else if (target_uuid == focused_uuid &&
+                clients_equal (target_client, focused_client) &&
+                contexts_equal (target_context, focused_context)) {
+                ClientInfo client_info = socket_get_client_info (focused_client);
 
                 if (client_info.type == FRONTEND_CLIENT) {
-                    m_panel_agent_manager.socket_helper_key_event (target_client, target_context, cmd, key);
+                    m_panel_agent_manager.socket_helper_key_event (focused_client, focused_context, cmd, key);
                 }
+            } else {
+                LOGD ("[target_client : %d, focused_client : %d] => %d, [target_context : %u, focused_context : %u] => %d",
+                    target_client, focused_client, clients_equal (target_client, focused_client),
+                    target_context, focused_context, contexts_equal (target_context, focused_context));
             }
         }
     }
@@ -3357,13 +3380,13 @@ client context helpers: %d, helpers uuid count: %d",
             if (target_uuid.length () == 0)
                 target_uuid = focused_uuid;
 
-            if (target_client  == focused_client &&
-                target_context == focused_context &&
-                target_uuid    == focused_uuid) {
-                ClientInfo client_info = socket_get_client_info (target_client);
+            if (target_uuid == focused_uuid &&
+                clients_equal (target_client, focused_client) &&
+                contexts_equal (target_context, focused_context)) {
+                ClientInfo client_info = socket_get_client_info (focused_client);
 
                 if (client_info.type == FRONTEND_CLIENT) {
-                    m_panel_agent_manager.commit_string (target_client, target_context, wstr);
+                    m_panel_agent_manager.commit_string (focused_client, focused_context, wstr);
                 } else {
                     std::cerr << "target client is not existed!!!" << "\n";
                 }
@@ -3448,13 +3471,13 @@ client context helpers: %d, helpers uuid count: %d",
         if (target_uuid.length () == 0)
             target_uuid = focused_uuid;
 
-        if (target_client  == focused_client &&
-            target_context == focused_context &&
-            target_uuid    == focused_uuid) {
-            ClientInfo client_info = socket_get_client_info (target_client);
+        if (target_uuid == focused_uuid &&
+            clients_equal (target_client, focused_client) &&
+            contexts_equal (target_context, focused_context)) {
+            ClientInfo client_info = socket_get_client_info (focused_client);
 
             if (client_info.type == FRONTEND_CLIENT) {
-                m_panel_agent_manager.show_preedit_string (target_client, target_context);
+                m_panel_agent_manager.show_preedit_string (focused_client, focused_context);
             }
         }
     }
@@ -3477,13 +3500,13 @@ client context helpers: %d, helpers uuid count: %d",
         if (target_uuid.length () == 0)
             target_uuid = focused_uuid;
 
-        if (target_client  == focused_client &&
-            target_context == focused_context &&
-            target_uuid    == focused_uuid) {
-            ClientInfo client_info = socket_get_client_info (target_client);
+        if (target_uuid == focused_uuid &&
+            clients_equal (target_client, focused_client) &&
+            contexts_equal (target_context, focused_context)) {
+            ClientInfo client_info = socket_get_client_info (focused_client);
 
             if (client_info.type == FRONTEND_CLIENT) {
-                m_panel_agent_manager.hide_preedit_string (target_client, target_context);
+                m_panel_agent_manager.hide_preedit_string (focused_client, focused_context);
             }
         }
     }
@@ -3507,13 +3530,13 @@ client context helpers: %d, helpers uuid count: %d",
         if (target_uuid.length () == 0)
             target_uuid = focused_uuid;
 
-        if (target_client  == focused_client &&
-            target_context == focused_context &&
-            target_uuid    == focused_uuid) {
-            ClientInfo client_info = socket_get_client_info (target_client);
+        if (target_uuid == focused_uuid &&
+            clients_equal (target_client, focused_client) &&
+            contexts_equal (target_context, focused_context)) {
+            ClientInfo client_info = socket_get_client_info (focused_client);
 
             if (client_info.type == FRONTEND_CLIENT) {
-                m_panel_agent_manager.update_preedit_string (target_client, target_context, preedit, commit, attrs, caret);
+                m_panel_agent_manager.update_preedit_string (focused_client, focused_context, preedit, commit, attrs, caret);
             }
         }
     }
@@ -3561,9 +3584,12 @@ client context helpers: %d, helpers uuid count: %d",
                 if (icit != m_start_helper_ic_index.end ()) {
                     m_panel_agent_manager.helper_attach_input_context_and_update_screen (client, icit->second, m_current_screen);
                     m_start_helper_ic_index.erase (icit);
+                    result = true;
+                } else {
+                    m_panel_agent_manager.send_fail_reply(client);
                 }
-
-                result = true;
+            } else {
+                m_panel_agent_manager.send_fail_reply(client);
             }
         }
 
index 4a247c3..6605a95 100644 (file)
@@ -575,6 +575,10 @@ void PanelAgentBase::set_prediction_allow (int client, uint32 context, String uu
     LOGW ("not implemented for %s", m_name.c_str ());
 }
 
+void PanelAgentBase::send_fail_reply (int client)
+{
+    LOGW ("not implemented for %s", m_name.c_str ());
+}
 } /* namespace scim */
 
 /*
index 36335e8..f5ae88e 100644 (file)
@@ -924,6 +924,16 @@ public:
     * @return none.
     */
     virtual void set_prediction_allow (int client, uint32 context, String uuid, int mode);
+
+    /**
+    * @brief send_fail_reply.
+    *
+    * @param
+    *
+    * @return none.
+    */
+    virtual void send_fail_reply (int client);
+
 };
 
 /**  @} */
index 7ae0a51..e8c8482 100644 (file)
@@ -902,6 +902,14 @@ void PanelAgentManager::set_prediction_allow (int id, uint32 context_id, String
         _p->set_prediction_allow (id, context_id, uuid, mode);
 }
 
+void PanelAgentManager::send_fail_reply (int id)
+{
+    PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+    if (!_p.null ())
+        _p->send_fail_reply (id);
+}
+
 } /* namespace scim */
 
 /*
index f766a75..ba5d055 100644 (file)
@@ -357,6 +357,7 @@ public:
     void remote_commit_string (int target_client, uint32  target_context, const WideString& wstr);
     void remote_delete_surrounding_text (int client, uint32 context_id, uint32 offset, uint32 len);
     void set_prediction_allow (int id, uint32 context_id, String uuid, int mode);
+    void send_fail_reply (int client);
 };
 
 /**  @} */
index 2bc0ddf..9f62137 100644 (file)
@@ -31,6 +31,7 @@
 #include <string.h>
 #include <dlog.h>
 #include "scim.h"
+#include "isf_debug.h"
 
 #ifdef LOG_TAG
 # undef LOG_TAG
index fd80d6a..a790b72 100644 (file)
@@ -2,11 +2,12 @@
 #define Uses_ISF_REMOTE_CLIENT
 #define Uses_STL_STRING
 
-#include <Ecore.h>
+#include <glib.h>
 #include <dlog.h>
 
 #include "scim.h"
 #include "isf_remote_control.h"
+#include "isf_debug.h"
 
 #ifdef LOG_TAG
 # undef LOG_TAG
@@ -19,7 +20,10 @@ static bool focus_flag;
 
 struct _remote_control_client {
     RemoteInputClient remote_client;
-    Ecore_Fd_Handler *remote_fd_handler = NULL;
+    GIOChannel *remote_client_iochannel = NULL;
+    guint remote_client_iochannel_read;
+    guint remote_client_iochannel_err;
+    guint remote_client_iochannel_hup;
     int remote_client_id;
     remote_control_focus_in_cb focus_in_cb;
     void* focus_in_cb_user_data;
@@ -33,78 +37,86 @@ struct _remote_control_client {
     void* input_resource_changed_cb_user_data;
 };
 
-static Eina_Bool
-remote_handler(void *data, Ecore_Fd_Handler *fd_handler)
+static gboolean
+remote_handler(GIOChannel *source, GIOCondition condition, gpointer user_data)
 {
-    remote_control_client *client = static_cast<remote_control_client*>(data);
-
-    if (client->remote_client.has_pending_event()) {
-        switch (client->remote_client.recv_callback_message()) {
-            case REMOTE_CONTROL_CALLBACK_FOCUS_IN:
-            {
-                LOGD ("REMOTE_CONTROL_CALLBACK_FOCUS_IN");
-                focus_flag = true;
-                client->focus_in_cb (client->focus_in_cb_user_data);
-                break;
-            }
-            case REMOTE_CONTROL_CALLBACK_FOCUS_OUT:
-            {
-                LOGD ("REMOTE_CONTROL_CALLBACK_FOCUS_OUT");
-                focus_flag = false;
-                client->focus_out_cb (client->focus_out_cb_user_data);
-                break;
-            }
-            case REMOTE_CONTROL_CALLBACK_ENTRY_METADATA:
-            {
-                if (focus_flag) {
-                    remote_control_entry_metadata_s *data = new remote_control_entry_metadata_s;
-                    int hint = 0, layout = 0, variation = 0, autocapital_type = 0, return_key_disabled = 0;
-
-                    client->remote_client.get_entry_metadata (&hint, &layout, &variation, &autocapital_type, &return_key_disabled);
-                    data->hint = static_cast<Ecore_IMF_Input_Hints> (hint);
-                    data->layout = static_cast<Ecore_IMF_Input_Panel_Layout> (layout);
-                    data->variation = variation;
-                    data->autocapital_type = static_cast<Ecore_IMF_Autocapital_Type> (autocapital_type);
-                    data->return_key_disabled = return_key_disabled;
-
-                    LOGD ("REMOTE_CONTROL_CALLBACK_ENTRY_METADATA hint: 0x%04x, layout: %d, variation: %d, autocapital: %d, return_key: %d",
-                        data->hint, data->layout, data->variation, data->autocapital_type, data->return_key_disabled);
-                    client->metadata_cb (client->metadata_cb_user_data, data);
-                    delete data;
+    if (condition == G_IO_IN) {
+        remote_control_client *client = static_cast<remote_control_client*>(user_data);
+        if (client->remote_client.has_pending_event()) {
+            switch (client->remote_client.recv_callback_message()) {
+                case REMOTE_CONTROL_CALLBACK_FOCUS_IN:
+                {
+                    LOGD ("REMOTE_CONTROL_CALLBACK_FOCUS_IN");
+                    focus_flag = true;
+                    client->focus_in_cb (client->focus_in_cb_user_data);
+                    break;
                 }
-                break;
-            }
-            case REMOTE_CONTROL_CALLBACK_TEXT_UPDATED:
-            {
-                if (focus_flag) {
-                    String surrounding_text;
-                    int cursor = -1;
-
-                    client->remote_client.get_surrounding_text (surrounding_text, &cursor);
-                    SECURE_LOGD ("REMOTE_CONTROL_CALLBACK_TEXT_UPDATED \"%s\" %d", surrounding_text.c_str (), cursor);
-                    client->text_updated_cb (client->text_updated_cb_user_data, surrounding_text.c_str (), cursor);
+                case REMOTE_CONTROL_CALLBACK_FOCUS_OUT:
+                {
+                    LOGD ("REMOTE_CONTROL_CALLBACK_FOCUS_OUT");
+                    focus_flag = false;
+                    client->focus_out_cb (client->focus_out_cb_user_data);
+                    break;
                 }
-                break;
-            }
-            case REMOTE_CONTROL_CALLBACK_INPUT_RESOURCE:
-            {
-                if (focus_flag) {
-                    int resource = 0;
-
-                    client->remote_client.get_input_resource (&resource);
-                    LOGD ("REMOTE_CONTROL_CALLBACK_INPUT_RESOURCE: %s", (resource ? "REMOTE" : "LOCAL"));
-                    client->input_resource_changed_cb (client->input_resource_changed_cb_user_data,
-                        static_cast<remote_control_input_resource> (resource));
+                case REMOTE_CONTROL_CALLBACK_ENTRY_METADATA:
+                {
+                    if (focus_flag) {
+                        remote_control_entry_metadata_s *data = new remote_control_entry_metadata_s;
+                        int hint = 0, layout = 0, variation = 0, autocapital_type = 0, return_key_disabled = 0;
+
+                        client->remote_client.get_entry_metadata (&hint, &layout, &variation, &autocapital_type, &return_key_disabled);
+                        data->hint = static_cast<Ecore_IMF_Input_Hints> (hint);
+                        data->layout = static_cast<Ecore_IMF_Input_Panel_Layout> (layout);
+                        data->variation = variation;
+                        data->autocapital_type = static_cast<Ecore_IMF_Autocapital_Type> (autocapital_type);
+                        data->return_key_disabled = return_key_disabled;
+
+                        LOGD ("REMOTE_CONTROL_CALLBACK_ENTRY_METADATA hint: 0x%04x, layout: %d, variation: %d, autocapital: %d, return_key: %d",
+                            data->hint, data->layout, data->variation, data->autocapital_type, data->return_key_disabled);
+                        client->metadata_cb (client->metadata_cb_user_data, data);
+                        delete data;
+                    }
+                    break;
+                }
+                case REMOTE_CONTROL_CALLBACK_TEXT_UPDATED:
+                {
+                    if (focus_flag) {
+                        String surrounding_text;
+                        int cursor = -1;
+
+                        client->remote_client.get_surrounding_text (surrounding_text, &cursor);
+                        SECURE_LOGD ("REMOTE_CONTROL_CALLBACK_TEXT_UPDATED \"%s\" %d", surrounding_text.c_str (), cursor);
+                        client->text_updated_cb (client->text_updated_cb_user_data, surrounding_text.c_str (), cursor);
+                    }
+                    break;
+                }
+                case REMOTE_CONTROL_CALLBACK_INPUT_RESOURCE:
+                {
+                    if (focus_flag) {
+                        int resource = 0;
+
+                        client->remote_client.get_input_resource (&resource);
+                        LOGD ("REMOTE_CONTROL_CALLBACK_INPUT_RESOURCE: %s", (resource ? "REMOTE" : "LOCAL"));
+                        client->input_resource_changed_cb (client->input_resource_changed_cb_user_data,
+                            static_cast<remote_control_input_resource> (resource));
+                    }
+                    break;
                 }
-                break;
+                case REMOTE_CONTROL_CALLBACK_ERROR:
+                    break;
+                default:
+                    break;
             }
-            case REMOTE_CONTROL_CALLBACK_ERROR:
-                break;
-            default:
-                break;
+        } else {
+            LOGE ("Failed to receive callback message\n");
+            return (gboolean)FALSE;
         }
+    } else if (condition == G_IO_ERR || condition == G_IO_HUP) {
+        LOGE ("Failed to receive callback message\n");
+        return (gboolean)FALSE;
     }
-    return ECORE_CALLBACK_RENEW;
+
+    return (gboolean)TRUE;
 }
 
 EXAPI remote_control_client * remote_control_connect(void)
@@ -127,12 +139,16 @@ EXAPI remote_control_client * remote_control_connect(void)
         client->remote_client_id = client->remote_client.get_panel2remote_connection_number();
 
         if (client->remote_client_id >= 0) {
-            client->remote_fd_handler = ecore_main_fd_handler_add(client->remote_client_id, ECORE_FD_READ, remote_handler, client, NULL, NULL);
+            client->remote_client_iochannel = g_io_channel_unix_new(client->remote_client_id);
 
-            if (client->remote_fd_handler == NULL) {
+            if (client->remote_client_iochannel == NULL) {
                 LOGE ("REMOTE_CONTROL_INVALID_OPERATION");
                 goto cleanup;
             }
+
+            client->remote_client_iochannel_read = g_io_add_watch (client->remote_client_iochannel, G_IO_IN,  remote_handler, client);
+            client->remote_client_iochannel_err = g_io_add_watch (client->remote_client_iochannel, G_IO_ERR,  remote_handler, client);
+            client->remote_client_iochannel_hup = g_io_add_watch (client->remote_client_iochannel, G_IO_HUP,  remote_handler, client);
         }
         else {
             LOGE ("REMOTE_CONTROL_INVALID_OPERATION");
@@ -164,8 +180,22 @@ EXAPI int remote_control_disconnect(remote_control_client *client)
     if (error_e)
         return error_e;
 
-    if (client->remote_fd_handler)
-        ecore_main_fd_handler_del(client->remote_fd_handler);
+    if (client->remote_client_iochannel)
+        g_io_channel_unref (client->remote_client_iochannel);
+
+    if (client->remote_client_iochannel_read)
+        g_source_remove (client->remote_client_iochannel_read);
+
+    if (client->remote_client_iochannel_err)
+        g_source_remove (client->remote_client_iochannel_err);
+
+    if (client->remote_client_iochannel_hup)
+        g_source_remove (client->remote_client_iochannel_hup);
+
+    client->remote_client_iochannel = NULL;
+    client->remote_client_iochannel_read = 0;
+    client->remote_client_iochannel_err = 0;
+    client->remote_client_iochannel_hup = 0;
 
     client->remote_client.close_connection();
 
index ebb689e..31e646d 100644 (file)
@@ -34,7 +34,6 @@ cynara_log (const char *string, int cynara_status) {
 PrivilegeChecker::PrivilegeChecker (int sockfd)
 {
     m_client = NULL;
-    m_session = NULL;
     m_user = NULL;
     m_sockfd = sockfd;
 }
@@ -44,9 +43,6 @@ PrivilegeChecker::~PrivilegeChecker ()
     if (m_client)
         free (m_client);
 
-    if (m_session)
-        free (m_session);
-
     if (m_user)
         free (m_user);
 }
@@ -78,25 +74,15 @@ PrivilegeChecker::initializeCreditionals ()
         goto CLEANUP;
     }
 
-    m_session = cynara_session_from_pid (pid);
-    if (!m_session) {
-        SCIM_DEBUG_MAIN(1) << "cynara_session_from_pid(): failed";
-        goto CLEANUP;
-    }
-
     return true;
 CLEANUP:
     if (m_client)
         free (m_client);
 
-    if (m_session)
-        free (m_session);
-
     if (m_user)
         free (m_user);
 
     m_client = NULL;
-    m_session = NULL;
     m_user = NULL;
 
     return false;
@@ -112,7 +98,7 @@ PrivilegeChecker::checkPrivilege (const char *privilege)
     if (!p_cynara)
         return false;
 
-    int ret = cynara_check (p_cynara, m_client, m_session, m_user, privilege);
+    int ret = cynara_check (p_cynara, m_client, "", m_user, privilege);
     cynara_log("cynara_check()", ret);
     if (ret != CYNARA_API_ACCESS_ALLOWED)
         return false;
index 8e92393..ae3e2c8 100644 (file)
@@ -1,7 +1,7 @@
 %bcond_with wayland
 Name:       isf
 Summary:    Input Service Framework
-Version:    3.0.158
+Version:    3.0.165
 Release:    1
 Group:      Graphics & UI Framework/Input
 License:    LGPL-2.1+
@@ -21,6 +21,7 @@ BuildRequires:  pkgconfig(ecore-x)
 BuildRequires:  pkgconfig(x11)
 BuildRequires:  pkgconfig(tts)
 %endif
+BuildRequires:  pkgconfig(eina)
 BuildRequires:  pkgconfig(ecore)
 BuildRequires:  pkgconfig(evas)
 BuildRequires:  pkgconfig(edje)
@@ -100,7 +101,7 @@ CXXFLAGS+=" -DWAYLAND"
 
 export GC_SECTIONS_FLAGS="-fdata-sections -ffunction-sections -Wl,--gc-sections"
 
-CFLAGS+=" -fvisibility=hidden -fvisibility-inlines-hidden ${GC_SECTIONS_FLAGS} "; export CFLAGS
+CFLAGS+=" -fvisibility=hidden ${GC_SECTIONS_FLAGS} "; export CFLAGS
 
 CXXFLAGS+=" -fvisibility=hidden -fvisibility-inlines-hidden ${GC_SECTIONS_FLAGS} ";export CXXFLAGS