Apply Scaled W,H for touch events 78/40678/2
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 8 Jun 2015 06:23:48 +0000 (15:23 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Tue, 9 Jun 2015 03:19:53 +0000 (12:19 +0900)
Change-Id: I273417c23760681e42f1733b3079b8aae0f50a00

include/event.h
pkgmgr_widget/common/CMakeLists.txt
src/event.c
src/main.c
src/parser.c
src/pkgmgr.c
src/server.c
src/shortcut_service.c
src/slave_life.c

index 6778ec9..924ab94 100644 (file)
@@ -34,6 +34,8 @@ struct event_data {
        int updated; /* Timestamp is updated */
        double tv;
        input_event_source_e source;
+       double ratio_w;
+       double ratio_h;
 };
 
 enum event_state {
@@ -54,7 +56,7 @@ enum event_handler_activate_type {
 extern int event_init(void);
 extern int event_fini(void);
 extern int event_input_fd(void);
-extern int event_activate(int x, int y, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data);
+extern int event_activate(int x, int y, double ratio_w, double ratio_h, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data);
 extern int event_deactivate(int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data);
 extern int event_is_activated(void);
 extern int event_reset_cbdata(int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data, void *new_data);
index 66496d3..463a665 100644 (file)
@@ -1,10 +1,10 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(common C)
 
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
-
 ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
 
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
+
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
 ADD_LIBRARY(${PROJECT_NAME} STATIC
        src/common.c
index a76357a..4b8872e 100644 (file)
@@ -111,6 +111,8 @@ struct event_listener {
        double tv;
        int x; /* RelX */
        int y; /* RelY */
+       double ratio_w;
+       double ratio_h;
 };
 
 static int event_control_fini(void);
@@ -571,6 +573,8 @@ static int invoke_event_cb(struct event_listener *listener, struct event_data *i
 
        modified_item.x -= listener->x;
        modified_item.y -= listener->y;
+       modified_item.ratio_w = listener->ratio_w;
+       modified_item.ratio_h = listener->ratio_h;
 
        if (!WIDGET_CONF_USE_EVENT_TIME) {
                item->tv = current_time_get();
@@ -960,7 +964,7 @@ int event_deactivate_thread(enum event_handler_activate_type activate_type)
 /*!
  * x, y is the starting point.
  */
-HAPI int event_activate(int x, int y, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data)
+HAPI int event_activate(int x, int y, double ratio_w, double ratio_h, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data)
 {
        struct event_listener *listener;
        int ret = WIDGET_ERROR_NONE;
@@ -988,6 +992,8 @@ HAPI int event_activate(int x, int y, int (*event_cb)(enum event_state state, st
        listener->state = EVENT_STATE_ACTIVATE;
        listener->x = x;
        listener->y = y;
+       listener->ratio_w = ratio_w;
+       listener->ratio_h = ratio_h;
 
        if (s_info.event_handler_activated == EVENT_HANDLER_DEACTIVATED) {
                /*!
index 3bee66a..c5cc9f8 100644 (file)
@@ -365,6 +365,7 @@ int main(int argc, char *argv[])
        }
 
        widget_conf_init();
+       widget_conf_set_search_input_node(1);
        widget_conf_load();
        widget_abi_init();
 
index 6177dd0..41c4957 100644 (file)
 static Eina_List *s_list;
 int errno;
 
-
 #define RETURN_TYPE long
 
-
 struct parser {
        char *filename;
        double period;
index b3f1365..8201e0b 100644 (file)
@@ -463,7 +463,6 @@ static int pkgmgr_cb(uid_t target_uid, int req_id, const char *type, const char
        return WIDGET_ERROR_NONE;
 }
 
-
 HAPI int pkgmgr_init(void)
 {
        if (s_info.listen_pc) {
index 43b562b..6441984 100644 (file)
@@ -646,7 +646,7 @@ static int mouse_event_widget_route_cb(enum event_state state, struct event_data
                return WIDGET_ERROR_INVALID_PARAMETER;
        }
 
-       packet = packet_create_noack((const char *)&cmd, "ssdiii", package_name(pkg), instance_id(inst), event_info->tv, event_info->x, event_info->y, (int)event_info->source);
+       packet = packet_create_noack((const char *)&cmd, "ssdiiidd", package_name(pkg), instance_id(inst), event_info->tv, event_info->x, event_info->y, (int)event_info->source, event_info->ratio_w, event_info->ratio_h);
        if (!packet) {
                return WIDGET_ERROR_FAULT;
        }
@@ -720,15 +720,15 @@ static int mouse_event_widget_consume_cb(enum event_state state, struct event_da
         */
        switch (state) {
        case EVENT_STATE_ACTIVATE:
-               script_handler_update_pointer(script, event_info->x, event_info->y, 1);
+               script_handler_update_pointer(script, event_info->x * event_info->ratio_w, event_info->y * event_info->ratio_h, 1);
                (void)script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_DOWN, timestamp);
                break;
        case EVENT_STATE_ACTIVATED:
-               script_handler_update_pointer(script, event_info->x, event_info->y, -1);
+               script_handler_update_pointer(script, event_info->x * event_info->ratio_w, event_info->y * event_info->ratio_h, -1);
                (void)script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_MOVE, timestamp);
                break;
        case EVENT_STATE_DEACTIVATE:
-               script_handler_update_pointer(script, event_info->x, event_info->y, 0);
+               script_handler_update_pointer(script, event_info->x * event_info->ratio_w, event_info->y * event_info->ratio_h, 0);
                (void)script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_UP, timestamp);
                break;
        default:
@@ -820,7 +820,7 @@ static int mouse_event_gbar_route_cb(enum event_state state, struct event_data *
                return WIDGET_ERROR_INVALID_PARAMETER;
        }
 
-       packet = packet_create_noack((const char *)&cmd, "ssdiii", package_name(pkg), instance_id(inst), event_info->tv, event_info->x, event_info->y, (int)event_info->source);
+       packet = packet_create_noack((const char *)&cmd, "ssdiiidd", package_name(pkg), instance_id(inst), event_info->tv, event_info->x, event_info->y, (int)event_info->source, event_info->ratio_w, event_info->ratio_h);
        if (!packet) {
                return WIDGET_ERROR_FAULT;
        }
@@ -895,15 +895,15 @@ static int mouse_event_gbar_consume_cb(enum event_state state, struct event_data
 
        switch (state) {
        case EVENT_STATE_ACTIVATE:
-               script_handler_update_pointer(script, event_info->x, event_info->y, 1);
+               script_handler_update_pointer(script, event_info->x * event_info->ratio_w, event_info->y * event_info->ratio_h, 1);
                (void)script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_DOWN, timestamp);
                break;
        case EVENT_STATE_ACTIVATED:
-               script_handler_update_pointer(script, event_info->x, event_info->y, -1);
+               script_handler_update_pointer(script, event_info->x * event_info->ratio_w, event_info->y * event_info->ratio_h, -1);
                (void)script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_MOVE, timestamp);
                break;
        case EVENT_STATE_DEACTIVATE:
-               script_handler_update_pointer(script, event_info->x, event_info->y, 0);
+               script_handler_update_pointer(script, event_info->x * event_info->ratio_w, event_info->y * event_info->ratio_h, 0);
                (void)script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_UP, timestamp);
                break;
        default:
@@ -1613,6 +1613,8 @@ static struct packet *client_gbar_mouse_enter(pid_t pid, int handle, const struc
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -1621,8 +1623,8 @@ static struct packet *client_gbar_mouse_enter(pid_t pid, int handle, const struc
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Invalid parameter\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -1644,7 +1646,7 @@ static struct packet *client_gbar_mouse_enter(pid_t pid, int handle, const struc
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, -1);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_IN, timestamp);
                ret = 0;
        } else {
@@ -1669,6 +1671,8 @@ static struct packet *client_gbar_mouse_leave(pid_t pid, int handle, const struc
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -1677,8 +1681,8 @@ static struct packet *client_gbar_mouse_leave(pid_t pid, int handle, const struc
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -1700,7 +1704,7 @@ static struct packet *client_gbar_mouse_leave(pid_t pid, int handle, const struc
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, -1);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OUT, timestamp);
                ret = 0;
        } else {
@@ -1725,6 +1729,8 @@ static struct packet *client_gbar_mouse_down(pid_t pid, int handle, const struct
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -1733,8 +1739,8 @@ static struct packet *client_gbar_mouse_down(pid_t pid, int handle, const struct
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -1756,7 +1762,7 @@ static struct packet *client_gbar_mouse_down(pid_t pid, int handle, const struct
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, 1);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, 1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_DOWN, timestamp);
                ret = 0;
        } else {
@@ -1781,6 +1787,8 @@ static struct packet *client_gbar_mouse_up(pid_t pid, int handle, const struct p
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -1789,8 +1797,8 @@ static struct packet *client_gbar_mouse_up(pid_t pid, int handle, const struct p
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -1812,7 +1820,7 @@ static struct packet *client_gbar_mouse_up(pid_t pid, int handle, const struct p
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, 0);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, 0);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_UP, timestamp);
                ret = 0;
        } else {
@@ -1837,6 +1845,8 @@ static struct packet *client_gbar_mouse_move(pid_t pid, int handle, const struct
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -1845,8 +1855,8 @@ static struct packet *client_gbar_mouse_move(pid_t pid, int handle, const struct
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -1868,7 +1878,7 @@ static struct packet *client_gbar_mouse_move(pid_t pid, int handle, const struct
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, -1);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_MOVE, timestamp);
                ret = 0;
        } else {
@@ -1893,6 +1903,8 @@ static struct packet *client_widget_mouse_move(pid_t pid, int handle, const stru
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -1901,8 +1913,8 @@ static struct packet *client_widget_mouse_move(pid_t pid, int handle, const stru
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -1924,7 +1936,7 @@ static struct packet *client_widget_mouse_move(pid_t pid, int handle, const stru
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, -1);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_MOVE, timestamp);
                ret = 0;
        } else {
@@ -1991,7 +2003,7 @@ static struct packet *client_gbar_key_set(pid_t pid, int handle, const struct pa
        }
 
        if (package_widget_type(pkg) == WIDGET_TYPE_BUFFER) {
-               ret = event_activate(0, 0, key_event_gbar_route_cb, inst);
+               ret = event_activate(0, 0, 1.0f, 1.0f, key_event_gbar_route_cb, inst);
                if (ret == WIDGET_ERROR_NONE) {
                        if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) {
                                (void)slave_set_priority(package_slave(pkg), WIDGET_CONF_SLAVE_EVENT_BOOST_ON);
@@ -2001,7 +2013,7 @@ static struct packet *client_gbar_key_set(pid_t pid, int handle, const struct pa
                        }
                }
        } else if (package_widget_type(pkg) == WIDGET_TYPE_SCRIPT) {
-               ret = event_activate(0, 0, key_event_gbar_consume_cb, inst);
+               ret = event_activate(0, 0, 1.0f, 1.0f, key_event_gbar_consume_cb, inst);
                if (ret == WIDGET_ERROR_NONE) {
                        if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) {
                                (void)slave_set_priority(package_slave(pkg), WIDGET_CONF_SLAVE_EVENT_BOOST_ON);
@@ -2123,7 +2135,7 @@ static struct packet *client_widget_key_set(pid_t pid, int handle, const struct
        }
 
        if (package_widget_type(pkg) == WIDGET_TYPE_BUFFER) {
-               ret = event_activate(0, 0, key_event_widget_route_cb, inst);
+               ret = event_activate(0, 0, 1.0f, 1.0f, key_event_widget_route_cb, inst);
                if (ret == WIDGET_ERROR_NONE) {
                        if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) {
                                (void)slave_set_priority(package_slave(pkg), WIDGET_CONF_SLAVE_EVENT_BOOST_ON);
@@ -2133,7 +2145,7 @@ static struct packet *client_widget_key_set(pid_t pid, int handle, const struct
                        }
                }
        } else if (package_widget_type(pkg) == WIDGET_TYPE_SCRIPT) {
-               ret = event_activate(0, 0, key_event_widget_consume_cb, inst);
+               ret = event_activate(0, 0, 1.0f, 1.0f, key_event_widget_consume_cb, inst);
                if (ret == WIDGET_ERROR_NONE) {
                        if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) {
                                (void)slave_set_priority(package_slave(pkg), WIDGET_CONF_SLAVE_EVENT_BOOST_ON);
@@ -2234,6 +2246,9 @@ static struct packet *client_widget_mouse_set(pid_t pid, int handle, const struc
        int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
+       int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2242,8 +2257,8 @@ static struct packet *client_widget_mouse_set(pid_t pid, int handle, const struc
                goto out;
        }
 
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2256,7 +2271,7 @@ static struct packet *client_widget_mouse_set(pid_t pid, int handle, const struc
 
        if (package_widget_type(pkg) == WIDGET_TYPE_BUFFER) {
                if (package_direct_input(pkg) == 0 || packet_set_fd((struct packet *)packet, event_input_fd()) < 0) {
-                       ret = event_activate(x, y, mouse_event_widget_route_cb, inst);
+                       ret = event_activate(x, y, ratio_w, ratio_h, mouse_event_widget_route_cb, inst);
                        if (ret == WIDGET_ERROR_NONE) {
                                if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) {
                                        (void)slave_set_priority(package_slave(pkg), WIDGET_CONF_SLAVE_EVENT_BOOST_ON);
@@ -2279,7 +2294,7 @@ static struct packet *client_widget_mouse_set(pid_t pid, int handle, const struc
                        }
                }
        } else if (package_widget_type(pkg) == WIDGET_TYPE_SCRIPT) {
-               ret = event_activate(x, y, mouse_event_widget_consume_cb, inst);
+               ret = event_activate(x, y, ratio_w, ratio_h, mouse_event_widget_consume_cb, inst);
                if (ret == WIDGET_ERROR_NONE) {
                        if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) {
                                (void)slave_set_priority(package_slave(pkg), WIDGET_CONF_SLAVE_EVENT_BOOST_ON);
@@ -2307,6 +2322,9 @@ static struct packet *client_widget_mouse_unset(pid_t pid, int handle, const str
        int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
+       int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2315,8 +2333,8 @@ static struct packet *client_widget_mouse_unset(pid_t pid, int handle, const str
                goto out;
        }
 
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2330,7 +2348,7 @@ static struct packet *client_widget_mouse_unset(pid_t pid, int handle, const str
        if (package_widget_type(pkg) == WIDGET_TYPE_BUFFER) {
                if (package_direct_input(pkg) == 0) {
                        /* Forcely update the X,Y position using viewer's */
-                       event_set_mouse_xy(x, y, timestamp);
+                       event_set_mouse_xy(x * ratio_w, y * ratio_h, timestamp);
 
                        ret = event_deactivate(mouse_event_widget_route_cb, inst);
                        if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) {
@@ -2357,7 +2375,7 @@ static struct packet *client_widget_mouse_unset(pid_t pid, int handle, const str
                }
        } else if (package_widget_type(pkg) == WIDGET_TYPE_SCRIPT) {
                /* Forcely update the X,Y position using viewer's */
-               event_set_mouse_xy(x, y, timestamp);
+               event_set_mouse_xy(x * ratio_w, y * ratio_h, timestamp);
 
                ret = event_deactivate(mouse_event_widget_consume_cb, inst);
                if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) {
@@ -2388,6 +2406,9 @@ static struct packet *client_gbar_mouse_set(pid_t pid, int handle, const struct
        int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
+       int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2396,8 +2417,8 @@ static struct packet *client_gbar_mouse_set(pid_t pid, int handle, const struct
                goto out;
        }
 
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2410,7 +2431,7 @@ static struct packet *client_gbar_mouse_set(pid_t pid, int handle, const struct
 
        if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
                if (package_direct_input(pkg) == 0 || packet_set_fd((struct packet *)packet, event_input_fd()) < 0) {
-                       ret = event_activate(x, y, mouse_event_gbar_route_cb, inst);
+                       ret = event_activate(x, y, ratio_w, ratio_h, mouse_event_gbar_route_cb, inst);
                        if (ret == WIDGET_ERROR_NONE) {
                                if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) {
                                        (void)slave_set_priority(package_slave(pkg), WIDGET_CONF_SLAVE_EVENT_BOOST_ON);
@@ -2433,7 +2454,7 @@ static struct packet *client_gbar_mouse_set(pid_t pid, int handle, const struct
                        }
                }
        } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
-               ret = event_activate(x, y, mouse_event_gbar_consume_cb, inst);
+               ret = event_activate(x, y, ratio_w, ratio_h, mouse_event_gbar_consume_cb, inst);
                if (ret == WIDGET_ERROR_NONE) {
                        if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) {
                                (void)slave_set_priority(package_slave(pkg), WIDGET_CONF_SLAVE_EVENT_BOOST_ON);
@@ -2463,6 +2484,8 @@ static struct packet *client_widget_mouse_on_scroll(pid_t pid, int handle, const
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2471,8 +2494,8 @@ static struct packet *client_widget_mouse_on_scroll(pid_t pid, int handle, const
                goto out;
        }
 
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2494,7 +2517,7 @@ static struct packet *client_widget_mouse_on_scroll(pid_t pid, int handle, const
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, -1);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_ON_SCROLL, timestamp);
                ret = 0;
        } else {
@@ -2519,6 +2542,8 @@ static struct packet *client_widget_mouse_off_scroll(pid_t pid, int handle, cons
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2527,8 +2552,8 @@ static struct packet *client_widget_mouse_off_scroll(pid_t pid, int handle, cons
                goto out;
        }
 
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2550,7 +2575,7 @@ static struct packet *client_widget_mouse_off_scroll(pid_t pid, int handle, cons
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, -1);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OFF_SCROLL, timestamp);
                ret = 0;
        } else {
@@ -2575,6 +2600,8 @@ static struct packet *client_widget_mouse_on_hold(pid_t pid, int handle, const s
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2583,8 +2610,8 @@ static struct packet *client_widget_mouse_on_hold(pid_t pid, int handle, const s
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2606,7 +2633,7 @@ static struct packet *client_widget_mouse_on_hold(pid_t pid, int handle, const s
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, -1);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_ON_HOLD, timestamp);
                ret = 0;
        } else {
@@ -2631,6 +2658,8 @@ static struct packet *client_widget_mouse_off_hold(pid_t pid, int handle, const
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2639,8 +2668,8 @@ static struct packet *client_widget_mouse_off_hold(pid_t pid, int handle, const
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2662,7 +2691,7 @@ static struct packet *client_widget_mouse_off_hold(pid_t pid, int handle, const
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, -1);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OFF_HOLD, timestamp);
                ret = 0;
        } else {
@@ -2687,6 +2716,8 @@ static struct packet *client_gbar_mouse_on_scroll(pid_t pid, int handle, const s
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2695,8 +2726,8 @@ static struct packet *client_gbar_mouse_on_scroll(pid_t pid, int handle, const s
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2718,7 +2749,7 @@ static struct packet *client_gbar_mouse_on_scroll(pid_t pid, int handle, const s
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, -1);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_ON_SCROLL, timestamp);
                ret = 0;
        } else {
@@ -2743,6 +2774,8 @@ static struct packet *client_gbar_mouse_off_scroll(pid_t pid, int handle, const
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2751,8 +2784,8 @@ static struct packet *client_gbar_mouse_off_scroll(pid_t pid, int handle, const
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2774,7 +2807,7 @@ static struct packet *client_gbar_mouse_off_scroll(pid_t pid, int handle, const
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, -1);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OFF_SCROLL, timestamp);
                ret = 0;
        } else {
@@ -2799,6 +2832,8 @@ static struct packet *client_gbar_mouse_on_hold(pid_t pid, int handle, const str
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2807,8 +2842,8 @@ static struct packet *client_gbar_mouse_on_hold(pid_t pid, int handle, const str
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2830,7 +2865,7 @@ static struct packet *client_gbar_mouse_on_hold(pid_t pid, int handle, const str
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, -1);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_ON_HOLD, timestamp);
                ret = 0;
        } else {
@@ -2855,6 +2890,8 @@ static struct packet *client_gbar_mouse_off_hold(pid_t pid, int handle, const st
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2863,8 +2900,8 @@ static struct packet *client_gbar_mouse_off_hold(pid_t pid, int handle, const st
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2886,7 +2923,7 @@ static struct packet *client_gbar_mouse_off_hold(pid_t pid, int handle, const st
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, -1);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OFF_HOLD, timestamp);
                ret = 0;
        } else {
@@ -2910,6 +2947,9 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc
        int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
+       int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2918,8 +2958,8 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc
                goto out;
        }
 
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2933,7 +2973,7 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc
        if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
                if (package_direct_input(pkg) == 0) {
                        /* Forcely update the X,Y position using viewer's */
-                       event_set_mouse_xy(x, y, timestamp);
+                       event_set_mouse_xy(x * ratio_w, y * ratio_h, timestamp);
 
                        ret = event_deactivate(mouse_event_gbar_route_cb, inst);
                        if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) {
@@ -2942,7 +2982,7 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc
                        /*
                         * This delete callback will be removed when the instance will be destroyed.
                         if (ret == 0) {
-                        instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_gbar_route_cb);
+                                instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_gbar_route_cb);
                         }
                         */
                } else {
@@ -2960,7 +3000,7 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc
                }
        } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
                /* Forcely update the X,Y position using viewer's */
-               event_set_mouse_xy(x, y, timestamp);
+               event_set_mouse_xy(x * ratio_w, y * ratio_h, timestamp);
 
                ret = event_deactivate(mouse_event_gbar_consume_cb, inst);
                if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) {
@@ -2969,7 +3009,7 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc
                /*
                 * This delete callback will be removed when the instance will be destroyed.
                 if (ret == 0) {
-                instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_gbar_consume_cb);
+                       instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_gbar_consume_cb);
                 }
                 */
        } else {
@@ -2992,6 +3032,8 @@ static struct packet *client_widget_mouse_enter(pid_t pid, int handle, const str
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -3000,8 +3042,8 @@ static struct packet *client_widget_mouse_enter(pid_t pid, int handle, const str
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -3023,7 +3065,7 @@ static struct packet *client_widget_mouse_enter(pid_t pid, int handle, const str
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, -1);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_IN, timestamp);
                ret = 0;
        } else {
@@ -3048,6 +3090,8 @@ static struct packet *client_widget_mouse_leave(pid_t pid, int handle, const str
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -3056,8 +3100,8 @@ static struct packet *client_widget_mouse_leave(pid_t pid, int handle, const str
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -3079,7 +3123,7 @@ static struct packet *client_widget_mouse_leave(pid_t pid, int handle, const str
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, -1);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OUT, timestamp);
                ret = 0;
        } else {
@@ -3104,6 +3148,8 @@ static struct packet *client_widget_mouse_down(pid_t pid, int handle, const stru
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -3112,8 +3158,8 @@ static struct packet *client_widget_mouse_down(pid_t pid, int handle, const stru
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -3135,7 +3181,7 @@ static struct packet *client_widget_mouse_down(pid_t pid, int handle, const stru
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, 1);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, 1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_DOWN, timestamp);
                ret = 0;
        } else {
@@ -3160,6 +3206,8 @@ static struct packet *client_widget_mouse_up(pid_t pid, int handle, const struct
        struct inst_info *inst;
        const struct pkg_info *pkg;
        int source;
+       double ratio_w;
+       double ratio_h;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -3168,8 +3216,8 @@ static struct packet *client_widget_mouse_up(pid_t pid, int handle, const struct
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &x, &y, &source);
-       if (ret != 6) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
+       if (ret != 8) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -3191,7 +3239,7 @@ static struct packet *client_widget_mouse_up(pid_t pid, int handle, const struct
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, 0);
+               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, 0);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_UP, timestamp);
                ret = 0;
        } else {
index 9141f81..3edbf50 100644 (file)
@@ -28,6 +28,7 @@
 #include <Eina.h>
 #include <sys/smack.h>
 
+#include <security-server.h>
 #include <shortcut.h>
 
 #include "service_common.h"
@@ -93,7 +94,6 @@ static inline struct tcb *get_reply_context(double seq)
        return tcb;
 }
 
-/*
 static void send_reply_packet(struct tcb *tcb, struct packet *packet, int ret)
 {
        struct packet *reply_packet;
@@ -110,7 +110,6 @@ static void send_reply_packet(struct tcb *tcb, struct packet *packet, int ret)
 
        packet_destroy(reply_packet);
 }
-*/
 
 /*!
  * SERVICE THREAD
index cfa35d5..202b2d1 100644 (file)
@@ -200,7 +200,7 @@ static struct slave_node *slave_deactivate(struct slave_node *slave, int no_time
                (void)slave_rpc_disconnect(slave);
        } else if (slave->terminate_timer) {
                ErrPrint("Terminate timer is already fired (%d)\n", slave->pid);
-       } else if ((!no_timer && !slave->secured) || slave_is_app(slave)) {
+       } else if (!slave->extra_bundle_data && ((!no_timer && !slave->secured) || slave_is_app(slave))) {
                DbgPrint("Fire the terminate timer: %d (%d)\n", slave->pid, slave_is_app(slave));
                slave->terminate_timer = ecore_timer_add(WIDGET_CONF_SLAVE_ACTIVATE_TIME, terminate_timer_cb, slave);
                if (!slave->terminate_timer) {
@@ -645,9 +645,19 @@ static Eina_Bool relaunch_timer_cb(void *data)
                slave->relaunch_timer = NULL;
                invoke_slave_fault_handler(slave);
        } else {
-               bundle *param;
+               bundle *param = NULL;
+
+               if (slave->extra_bundle_data) {
+                       param = bundle_decode((bundle_raw *)slave->extra_bundle_data, strlen(slave->extra_bundle_data));
+                       if (!param) {
+                               ErrPrint("Invalid extra_bundle_data[%s]\n", slave->extra_bundle_data);
+                       }
+               }
+
+               if (!param) {
+                       param = bundle_create();
+               }
 
-               param = bundle_create();
                if (!param) {
                        ErrPrint("Failed to create a bundle\n");
 
@@ -658,7 +668,12 @@ static Eina_Bool relaunch_timer_cb(void *data)
 
                        invoke_slave_fault_handler(slave);
                } else {
-                       bundle_add_str(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN);
+                       if (bundle_add_str(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN) == BUNDLE_ERROR_KEY_EXISTS) {
+                               if (bundle_del(param, BUNDLE_SLAVE_SVC_OP_TYPE) == BUNDLE_ERROR_NONE) {
+                                       DbgPrint("Main operation is deleted\n");
+                               }
+                               bundle_add_str(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN);
+                       }
                        bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_NAME, slave_name(slave));
                        bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_SECURED, ((WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) || slave->secured) ? "true" : "false");
                        bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_ABI, slave->abi);
@@ -768,7 +783,12 @@ HAPI int slave_activate(struct slave_node *slave)
                        }
                }
 
-               bundle_add_str(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN);
+               if (bundle_add_str(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN) == BUNDLE_ERROR_KEY_EXISTS) {
+                       if (bundle_del(param, BUNDLE_SLAVE_SVC_OP_TYPE) == BUNDLE_ERROR_NONE) {
+                               DbgPrint("Main operation is deleted\n");
+                       }
+                       bundle_add_str(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN);
+               }
                bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_NAME, slave_name(slave));
                bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_SECURED, ((WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) || slave->secured) ? "true" : "false");
                bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_ABI, slave->abi);