Implement the input event monitor.
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 14 Mar 2013 14:50:06 +0000 (14:50 +0000)
committerSung-jae Park <nicesj.park@samsung.com>
Fri, 15 Mar 2013 01:31:14 +0000 (01:31 +0000)
To automatically send the input event to livebox which has focus.
Update event handling code.

Merge the event packet from event thread and then forward it to the main thread.

Change-Id: Ie9f3387b8ccce2617f9000f2d6f6daed72dffdaa

CMakeLists.txt
include/event.h [new file with mode: 0644]
include/instance.h
include/script_handler.h
src/event.c [new file with mode: 0644]
src/instance.c
src/main.c
src/script_handler.c
src/server.c

index 4d1c793..507375c 100644 (file)
@@ -76,6 +76,7 @@ ADD_EXECUTABLE(${PROJECT_NAME}
        src/critical_log.c
        src/liveinfo.c
        src/pkgmgr.c
+       src/event.c
 )
 
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkg_LDFLAGS} "-ldl")
diff --git a/include/event.h b/include/event.h
new file mode 100644 (file)
index 0000000..525bfc6
--- /dev/null
@@ -0,0 +1,19 @@
+struct event_data {
+       int x;
+       int y;
+       int device;
+};
+
+enum event_state {
+       EVENT_STATE_ACTIVATE,
+       EVENT_STATE_ACTIVATED,
+       EVENT_STATE_DEACTIVATE,
+};
+
+extern int event_init(void);
+extern int event_fini(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_deactivate(void);
+extern int event_is_activated(void);
+
+/* End of a file */
index 30a4aef..4556ea9 100644 (file)
  * reference count of an instance reaches to ZERO.
  */
 
+enum instance_event {
+       INSTANCE_EVENT_DESTROY,
+       INSTNACE_EVENT_UNKNOWN,
+};
+
 enum instance_state {
        INST_INIT = 0x0, /*!< Only keeps in the master */
 
@@ -213,4 +218,7 @@ extern void *instance_client_list(struct inst_info *inst);
 extern void instance_init(void);
 extern void instance_fini(void);
 
+extern int instance_event_callback_add(struct inst_info *inst, enum instance_event type, int (*event_cb)(struct inst_info *inst, void *data), void *data);
+extern int instance_event_callback_del(struct inst_info *inst, enum instance_event type, int (*event_cb)(struct inst_info *inst, void *data));
+
 /* End of a file */
index 7ca8a4d..4ba013b 100644 (file)
@@ -30,7 +30,7 @@ extern int script_init(void);
 extern int script_fini(void);
 
 extern int script_signal_emit(Evas *e, const char *part, const char *signal, double sx, double sy, double ex, double ey);
-extern int script_handler_update_pointer(struct script_info *inst, double x, double y, int down);
+extern int script_handler_update_pointer(struct script_info *inst, int x, int y, int down);
 extern int script_handler_resize(struct script_info *info, int w, int h);
 
 /* End of a file */
diff --git a/src/event.c b/src/event.c
new file mode 100644 (file)
index 0000000..a749575
--- /dev/null
@@ -0,0 +1,471 @@
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <errno.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <linux/input.h>
+
+#include <Eina.h>
+#include <Ecore.h>
+#include <dlog.h>
+
+#include "util.h"
+#include "debug.h"
+#include "conf.h"
+#include "event.h"
+
+#define CRITICAL_SECTION_BEGIN(lock) do { \
+       int ret; \
+       ret = pthread_mutex_lock(&lock); \
+       if (ret != 0) { \
+               ErrPrint("Unable to get lock: %s\n", strerror(ret)); \
+       } \
+} while (0)
+
+#define CRITICAL_SECTION_END(lock) do { \
+       int ret; \
+       ret = pthread_mutex_unlock(&lock); \
+       if (ret != 0) { \
+               ErrPrint("Unable to unlock: %s\n", strerror(ret)); \
+       } \
+} while (0)
+
+#define CANCEL_SECTION_BEGIN() do { \
+       int ret; \
+       ret = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); \
+       if (ret != 0) \
+               ErrPrint("Unable to set cancelate state: %s\n", strerror(ret)); \
+} while (0)
+
+#define CANCEL_SECTION_END() do { \
+       int ret; \
+       ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); \
+       if (ret != 0) \
+               ErrPrint("Unable to set cancelate state: %s\n", strerror(ret)); \
+} while (0)
+
+#define PIPE_READ      0
+#define PIPE_WRITE     1
+#define EVENT_CH       'e'
+
+int errno;
+
+static struct info {
+       pthread_t tid;
+       Eina_List *event_list;
+       int handle;
+       pthread_mutex_t event_list_lock;
+       int evt_pipe[2];
+       Ecore_Fd_Handler *event_handler;
+
+       int (*event_cb)(enum event_state state, struct event_data *event, void *data);
+       void *cbdata;
+
+       enum event_state event_state;
+       struct event_data event_data;
+
+       int x;
+       int y;
+} s_info = {
+       .event_list = NULL,
+       .handle = -1,
+       .event_handler = NULL,
+
+       .event_cb = NULL,
+       .cbdata = NULL,
+
+       .event_state = EVENT_STATE_DEACTIVATE,
+
+       .event_data = {
+               .x = 0,
+               .y = 0,
+               .device = -1,
+       },
+};
+
+HAPI int event_init(void)
+{
+       int ret;
+       ret = pthread_mutex_init(&s_info.event_list_lock, NULL);
+       if (ret != 0) {
+               ErrPrint("Mutex: %s\n", strerror(ret));
+               return -EFAULT;
+       }
+       return 0;
+}
+
+HAPI int event_fini(void)
+{
+       int ret;
+       ret = pthread_mutex_destroy(&s_info.event_list_lock);
+       if (ret != 0)
+               ErrPrint("Mutex destroy failed: %s\n", strerror(ret));
+       return 0;
+}
+
+static inline int processing_input_event(struct input_event *event)
+{
+       struct event_data *item;
+
+       switch (event->type) {
+       case EV_SYN:
+               switch (event->code) {
+               case SYN_REPORT:
+                       if (s_info.event_data.x < 0 || s_info.event_data.y < 0) {
+                               /* Waiting full event packet */
+                               break;
+                       }
+
+                       item = malloc(sizeof(*item));
+                       if (item) {
+                               char event_ch;
+
+                               memcpy(item, &s_info.event_data, sizeof(*item));
+
+                               CRITICAL_SECTION_BEGIN(s_info.event_list_lock);
+                               s_info.event_list = eina_list_append(s_info.event_list, item);
+                               CRITICAL_SECTION_END(s_info.event_list_lock);
+
+                               event_ch = EVENT_CH;
+                               if (write(s_info.evt_pipe[PIPE_WRITE], &event_ch, sizeof(event_ch)) != sizeof(event_ch)) {
+                                       ErrPrint("Unable to send an event: %s\n", strerror(errno));
+                                       return -EIO;
+                               }
+                       }
+                       break;
+               case SYN_CONFIG:
+                       break;
+               case SYN_MT_REPORT:
+                       break;
+               /*
+               case SYN_DROPPED:
+                       DbgPrint("EV_SYN, SYN_DROPPED\n");
+                       break;
+               */
+               default:
+                       DbgPrint("EV_SYN, 0x%x\n", event->code);
+                       break;
+               }
+               break;
+       case EV_KEY:
+               break;
+       case EV_REL:
+               break;
+       case EV_ABS:
+               switch (event->code) {
+               case ABS_DISTANCE:
+                       break;
+               case ABS_MT_POSITION_X:
+                       s_info.event_data.x = event->value - s_info.x;
+                       break;
+               case ABS_MT_POSITION_Y:
+                       s_info.event_data.y = event->value - s_info.y;
+                       break;
+               case ABS_MT_SLOT:
+                       break;
+               case ABS_MT_TRACKING_ID:
+                       s_info.event_data.device = event->value;
+                       break;
+               case ABS_MT_TOUCH_MAJOR:
+                       break;
+               case ABS_MT_TOUCH_MINOR:
+                       break;
+               case ABS_MT_WIDTH_MAJOR:
+                       break;
+               case ABS_MT_WIDTH_MINOR:
+                       break;
+               default:
+                       DbgPrint("EV_ABS, 0x%x\n", event->code);
+                       break;
+               }
+               break;
+       case EV_MSC:
+               break;
+       case EV_SW:
+               break;
+       case EV_LED:
+               break;
+       case EV_SND:
+               break;
+       case EV_REP:
+               break;
+       case EV_FF:
+               break;
+       case EV_PWR:
+               break;
+       case EV_FF_STATUS:
+               break;
+       default:
+               DbgPrint("0x%X, 0x%X\n", event->type, event->code);
+               break;
+       }
+
+       return 0;
+}
+
+static void *event_main(void *data)
+{
+       fd_set set;
+       int ret = 0;
+       struct input_event input_event;
+       char *ptr = (char *)&input_event;
+       int offset = 0;
+       int readsize = 0;
+
+       DbgPrint("event_main initiated\n");
+
+       while (1) {
+               CANCEL_SECTION_BEGIN();
+               FD_ZERO(&set);
+               FD_SET(s_info.handle, &set);
+               ret = select(s_info.handle + 1, &set, NULL, NULL, NULL);
+               if (ret < 0) {
+                       ret = -errno;
+                       if (errno == EINTR) {
+                               DbgPrint("Select receives INTR\n");
+                               CANCEL_SECTION_END();
+                               continue;
+                       }
+                       ErrPrint("Error: %s\n", strerror(errno));
+                       CANCEL_SECTION_END();
+                       return (void *)ret;
+               } else if (ret == 0) {
+                       ErrPrint("Timeout expired\n");
+                       CANCEL_SECTION_END();
+                       return (void *)-ETIMEDOUT;
+               }
+               CANCEL_SECTION_END();
+
+               if (!FD_ISSET(s_info.handle, &set)) {
+                       ErrPrint("Unexpected handle is toggled\n");
+                       ret = -EINVAL;
+                       break;
+               }
+
+               readsize = read(s_info.handle, ptr + offset, sizeof(input_event) - offset);
+               if (readsize < 0) {
+                       ErrPrint("Unable to read device: %s / fd: %d / offset: %d / size: %d - %d\n", strerror(errno), s_info.handle, offset, sizeof(input_event), readsize);
+                       ret = -EFAULT;
+                       break;
+               }
+
+               offset += readsize;
+               if (offset == sizeof(input_event)) {
+                       offset = 0;
+                       if (processing_input_event(&input_event) < 0) {
+                               ret = -EFAULT;
+                               break;
+                       }
+               }
+       }
+
+       return (void *)ret;
+}
+
+static Eina_Bool event_read_cb(void *data, Ecore_Fd_Handler *handler)
+{
+       int fd;
+       struct event_data *item;
+       char event_ch;
+
+       fd = ecore_main_fd_handler_fd_get(handler);
+       if (fd < 0) {
+               ErrPrint("Invalid fd\n");
+               return ECORE_CALLBACK_CANCEL;
+       }
+
+       if (read(fd, &event_ch, sizeof(event_ch)) != sizeof(event_ch)) {
+               ErrPrint("Unable to read event ch: %s\n", strerror(errno));
+               return ECORE_CALLBACK_CANCEL;
+       }
+
+       CRITICAL_SECTION_BEGIN(s_info.event_list_lock);
+       item = eina_list_nth(s_info.event_list, 0);
+       if (item)
+               s_info.event_list = eina_list_remove(s_info.event_list, item);
+       else
+               ErrPrint("Unable to get event\n");
+       CRITICAL_SECTION_END(s_info.event_list_lock);
+
+       if (item && s_info.event_cb) {
+               switch (s_info.event_state) {
+               case EVENT_STATE_DEACTIVATE:
+                       s_info.event_state = EVENT_STATE_ACTIVATE;
+                       break;
+               case EVENT_STATE_ACTIVATE:
+                       s_info.event_state = EVENT_STATE_ACTIVATED;
+                       break;
+               case EVENT_STATE_ACTIVATED:
+               default:
+                       break;
+               }
+               s_info.event_cb(s_info.event_state, item, s_info.cbdata);
+       }
+
+       free(item);
+       return ECORE_CALLBACK_RENEW;
+}
+
+static inline char *detect_input_device(void)
+{
+       /*!
+        * \NOTE
+        * Implements this first.
+        * We should detect the input device.
+        */
+       return strdup("/dev/input/event1");
+}
+
+HAPI int event_activate(int x, int y, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data)
+{
+       int status;
+       char *device_node;
+
+       if (s_info.handle >= 0) {
+               DbgPrint("Already activated\n");
+               return 0;
+       }
+
+       device_node = detect_input_device();
+       if (!device_node) {
+               ErrPrint("Input device is not recognized\n");
+               return -ENOTSUP;
+       }
+
+       s_info.handle = open(device_node, O_RDONLY);
+       free(device_node);
+       if (s_info.handle < 0) {
+               ErrPrint("Unable to access the device: %s\n", strerror(errno));
+               return -EIO;
+       }
+
+       if (fcntl(s_info.handle, F_SETFD, FD_CLOEXEC) < 0)
+               ErrPrint("Error: %s\n", strerror(errno));
+
+       if (fcntl(s_info.handle, F_SETFL, O_NONBLOCK) < 0)
+               ErrPrint("Error: %s\n", strerror(errno));
+
+       status = pipe2(s_info.evt_pipe, O_NONBLOCK | O_CLOEXEC);
+       if (status < 0) {
+               ErrPrint("Unable to prepare evt pipe: %s\n", strerror(errno));
+               if (close(s_info.handle) < 0)
+                       ErrPrint("Failed to close handle: %s\n", strerror(errno));
+               s_info.handle = -1;
+               return -EFAULT;
+       }
+
+       s_info.event_handler = ecore_main_fd_handler_add(s_info.evt_pipe[PIPE_READ], ECORE_FD_READ, event_read_cb, NULL, NULL, NULL);
+       if (!s_info.event_handler) {
+               if (close(s_info.handle) < 0)
+                       ErrPrint("Failed to close handle: %s\n", strerror(errno));
+
+               if (close(s_info.evt_pipe[PIPE_READ]) < 0)
+                       ErrPrint("Failed to close handle: %s\n", strerror(errno));
+
+               if (close(s_info.evt_pipe[PIPE_WRITE]) < 0)
+                       ErrPrint("Failed to close handle: %s\n", strerror(errno));
+
+               s_info.handle = -1;
+               return -EFAULT;
+       }
+
+       status = pthread_create(&s_info.tid, NULL, event_main, NULL);
+       if (status != 0) {
+               ErrPrint("Failed to initiate the thread: %s\n", strerror(status));
+               ecore_main_fd_handler_del(s_info.event_handler);
+               s_info.event_handler = NULL;
+
+               if (close(s_info.handle) < 0)
+                       ErrPrint("close: %s\n", strerror(errno));
+               s_info.handle = -1;
+
+               if (close(s_info.evt_pipe[PIPE_READ]) < 0)
+                       ErrPrint("close: %s\n", strerror(errno));
+
+               if (close(s_info.evt_pipe[PIPE_WRITE]) < 0)
+                       ErrPrint("close: %s\n", strerror(errno));
+
+               return -EFAULT;
+       }
+
+       s_info.event_cb = event_cb;
+       s_info.cbdata = data;
+       s_info.x = x;
+       s_info.y = y;
+
+       DbgPrint("Event handler activated\n");
+       return 0;
+}
+
+HAPI int event_deactivate(void)
+{
+       int status;
+       struct event_data *event;
+       void *ret;
+
+       if (s_info.handle < 0) {
+               ErrPrint("Event handler is not actiavated\n");
+               return 0;
+       }
+
+       status = pthread_cancel(s_info.tid);
+       if (status != 0)
+               ErrPrint("Failed to cacnel a thread: %s\n", strerror(errno));
+
+       status = pthread_join(s_info.tid, &ret);
+       if (status != 0)
+               ErrPrint("Failed to join a thread: %s\n", strerror(errno));
+       else if (ret == PTHREAD_CANCELED)
+               DbgPrint("Thread is canceled\n");
+
+       ecore_main_fd_handler_del(s_info.event_handler);
+       s_info.event_handler = NULL;
+
+       if (close(s_info.evt_pipe[PIPE_READ]) < 0)
+               ErrPrint("Failed to close: %s\n", strerror(errno));
+
+       if (close(s_info.evt_pipe[PIPE_WRITE]) < 0)
+               ErrPrint("Failed to close: %s\n", strerror(errno));
+
+       if (close(s_info.handle) < 0)
+               ErrPrint("Unable to release the fd: %s\n", strerror(errno));
+
+       s_info.handle = -1;
+       DbgPrint("Event handler deactivated\n");
+
+       EINA_LIST_FREE(s_info.event_list, event) {
+               if (s_info.event_cb) {
+                       if (s_info.event_state == EVENT_STATE_DEACTIVATE) {
+                               s_info.event_state = EVENT_STATE_ACTIVATE;
+                       } else if (s_info.event_state == EVENT_STATE_ACTIVATE) {
+                               s_info.event_state = EVENT_STATE_ACTIVATED;
+                       }
+                       s_info.event_cb(s_info.event_state, event, s_info.cbdata);
+               }
+               free(event);
+       }
+
+       if (s_info.event_state != EVENT_STATE_DEACTIVATE) {
+               s_info.event_state = EVENT_STATE_DEACTIVATE;
+
+               if (s_info.event_cb)
+                       s_info.event_cb(s_info.event_state, &s_info.event_data, s_info.cbdata);
+       }
+
+       s_info.event_data.x = -1;
+       s_info.event_data.y = -1;
+
+       return 0;
+}
+
+HAPI int event_is_activated(void)
+{
+       return s_info.handle >= 0;
+}
+
+/* End of a file */
index fc66287..0236f25 100644 (file)
@@ -72,6 +72,11 @@ struct period_cbdata {
        double period;
 };
 
+struct event_item {
+       int (*event_cb)(struct inst_info *inst, void *data);
+       void *data;
+};
+
 struct inst_info {
        struct pkg_info *info;
 
@@ -129,6 +134,8 @@ struct inst_info {
        int refcnt;
 
        Ecore_Timer *update_timer; /*!< Only used for secured livebox */
+
+       Eina_List *delete_event_list;
 };
 
 #define CLIENT_SEND_EVENT(instance, packet)    ((instance)->client ? client_rpc_async_request((instance)->client, (packet)) : client_broadcast((instance), (packet)))
@@ -442,12 +449,81 @@ static int send_pd_destroyed_to_client(struct inst_info *inst, int status)
        return CLIENT_SEND_EVENT(inst, packet);
 }
 
+static inline void invoke_delete_callbacks(struct inst_info *inst)
+{
+       Eina_List *l;
+       Eina_List *n;
+       struct event_item *item;
+
+       EINA_LIST_FOREACH_SAFE(inst->delete_event_list, l, n, item) {
+               if (item->event_cb(inst, item->data) < 0) {
+                       if (eina_list_data_find(inst->delete_event_list, item)) {
+                               inst->delete_event_list = eina_list_remove(inst->delete_event_list, item);
+                               free(item);
+                       }
+               }
+       }
+}
+
+HAPI int instance_event_callback_add(struct inst_info *inst, enum instance_event type, int (*event_cb)(struct inst_info *inst, void *data), void *data)
+{
+       struct event_item *item;
+
+       if (!event_cb)
+               return -EINVAL;
+
+       switch (type) {
+       case INSTANCE_EVENT_DESTROY:
+               item = malloc(sizeof(*item));
+               if (!item) {
+                       ErrPrint("Heap: %s\n", strerror(errno));
+                       return -ENOMEM;
+               }
+
+               item->event_cb = event_cb;
+               item->data = data;
+
+               inst->delete_event_list = eina_list_append(inst->delete_event_list, item);
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+HAPI int instance_event_callback_del(struct inst_info *inst, enum instance_event type, int (*event_cb)(struct inst_info *inst, void *data))
+{
+       Eina_List *l;
+       Eina_List *n;
+       struct event_item *item;
+
+       switch (type) {
+       case INSTANCE_EVENT_DESTROY:
+               EINA_LIST_FOREACH_SAFE(inst->delete_event_list, l, n, item) {
+                       if (item->event_cb == event_cb) {
+                               inst->delete_event_list = eina_list_remove(inst->delete_event_list, item);
+                               free(item);
+                               return 0;
+                       }
+               }
+               break;
+       default:
+               break;
+       }
+
+       return -ENOENT;
+}
+
 static inline void destroy_instance(struct inst_info *inst)
 {
        struct pkg_info *pkg;
        enum lb_type lb_type;
        enum pd_type pd_type;
        struct slave_node *slave;
+       struct event_item *item;
+
+       invoke_delete_callbacks(inst);
 
        pkg = inst->info;
 
@@ -492,6 +568,9 @@ static inline void destroy_instance(struct inst_info *inst)
         * will be released by the package object
         * it is readonly value for instances
         */
+       EINA_LIST_FREE(inst->delete_event_list, item) {
+               free(item);
+       }
        DbgFree(inst->category);
        DbgFree(inst->cluster);
        DbgFree(inst->content);
index 32538bd..afdce30 100644 (file)
@@ -49,6 +49,7 @@
 #include "util.h"
 #include "debug.h"
 #include "critical_log.h"
+#include "event.h"
 
 #if defined(FLOG)
 FILE *__file_log_fp;
@@ -110,6 +111,7 @@ static inline int app_create(void)
        ret = server_init();
        DbgPrint("Server initialized: %d\n", ret);
 
+       event_init();
        return 0;
 }
 
@@ -117,6 +119,8 @@ static inline int app_terminate(void)
 {
        int ret;
 
+       event_fini();
+
        ret = setting_fini();
        DbgPrint("Finalize setting : %d\n", ret);
 
index 2fe88da..ff8f82d 100644 (file)
@@ -118,8 +118,8 @@ struct script_info {
        int w;
        int h;
 
-       double x;
-       double y;
+       int x;
+       int y;
        int down;
 
        struct script_port *port;
@@ -221,7 +221,7 @@ int script_signal_emit(Evas *e, const char *part, const char *signal, double sx,
        if (!part || strlen(part) == 0)
                part = "";
 
-       ret = instance_signal_emit(info->inst, signal, part, sx, sy, ex, ey, info->x, info->y, info->down);
+       ret = instance_signal_emit(info->inst, signal, part, sx, sy, ex, ey, (double)info->x / (double)info->w, (double)info->y / (double)info->h, info->down);
        return ret;
 }
 
@@ -1298,7 +1298,7 @@ HAPI int script_fini(void)
        return 0;
 }
 
-HAPI int script_handler_update_pointer(struct script_info *info, double x, double y, int down)
+HAPI int script_handler_update_pointer(struct script_info *info, int x, int y, int down)
 {
        if (!info)
                return 0;
index c22c399..012fd9b 100644 (file)
@@ -46,6 +46,7 @@
 #include "abi.h"
 #include "liveinfo.h"
 #include "io.h"
+#include "event.h"
 
 static struct info {
        int info_fd;
@@ -71,6 +72,169 @@ struct deleted_item {
        struct inst_info *inst;
 };
 
+static int event_lb_route_cb(enum event_state state, struct event_data *event_info, void *data)
+{
+       struct inst_info *inst = data;
+       const struct pkg_info *pkg;
+       struct slave_node *slave;
+       struct packet *packet;
+       const char *cmdstr;
+
+       pkg = instance_package(inst);
+       if (!pkg)
+               return -EINVAL;
+
+       slave = package_slave(pkg);
+       if (!slave)
+               return -EINVAL;
+
+       switch (state) {
+       case EVENT_STATE_ACTIVATE:
+               cmdstr = "lb_mouse_down";
+               break;
+       case EVENT_STATE_ACTIVATED:
+               cmdstr = "lb_mouse_move";
+               break;
+       case EVENT_STATE_DEACTIVATE:
+               cmdstr = "lb_mouse_up";
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       packet = packet_create_noack(cmdstr, "ssdii", package_name(pkg), instance_id(inst), util_timestamp(), event_info->x, event_info->y);
+       if (!packet)
+               return -EFAULT;
+
+       return slave_rpc_request_only(slave, package_name(pkg), packet, 0);
+}
+
+static int event_lb_consume_cb(enum event_state state, struct event_data *event_info, void *data)
+{
+       struct script_info *script;
+       struct inst_info *inst = data;
+       const struct pkg_info *pkg;
+       double timestamp;
+       Evas *e;
+
+       pkg = instance_package(inst);
+       if (!pkg)
+               return 0;
+
+       script = instance_lb_script(inst);
+       if (!script)
+               return -EFAULT;
+
+       e = script_handler_evas(script);
+       if (!e)
+               return -EFAULT;
+
+       timestamp = util_timestamp();
+
+       switch (state) {
+       case EVENT_STATE_ACTIVATE:
+               script_handler_update_pointer(script, event_info->x, event_info->y, 1);
+               evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
+               evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
+               break;
+       case EVENT_STATE_ACTIVATED:
+               script_handler_update_pointer(script, event_info->x, event_info->y, -1);
+               evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
+               break;
+       case EVENT_STATE_DEACTIVATE:
+               script_handler_update_pointer(script, event_info->x, event_info->y, 0);
+               evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
+               evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
+               break;
+       default:
+               break;
+       }
+
+       return 0;
+}
+
+static int event_pd_route_cb(enum event_state state, struct event_data *event_info, void *data)
+{
+       struct inst_info *inst = data;
+       const struct pkg_info *pkg;
+       struct slave_node *slave;
+       struct packet *packet;
+       const char *cmdstr;
+
+       pkg = instance_package(inst);
+       if (!pkg)
+               return -EINVAL;
+
+       slave = package_slave(pkg);
+       if (!slave)
+               return -EINVAL;
+
+       DbgPrint("Event: %dx%d\n", event_info->x, event_info->y);
+       switch (state) {
+       case EVENT_STATE_ACTIVATE:
+               cmdstr = "pd_mouse_down";
+               break;
+       case EVENT_STATE_ACTIVATED:
+               cmdstr = "pd_mouse_move";
+               break;
+       case EVENT_STATE_DEACTIVATE:
+               cmdstr = "pd_mouse_up";
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       packet = packet_create_noack(cmdstr, "ssdii", package_name(pkg), instance_id(inst), util_timestamp(), event_info->x, event_info->y);
+       if (!packet)
+               return -EFAULT;
+
+       return slave_rpc_request_only(slave, package_name(pkg), packet, 0);
+}
+
+static int event_pd_consume_cb(enum event_state state, struct event_data *event_info, void *data)
+{
+       struct script_info *script;
+       struct inst_info *inst = data;
+       const struct pkg_info *pkg;
+       double timestamp;
+       Evas *e;
+
+       pkg = instance_package(inst);
+       if (!pkg)
+               return 0;
+
+       script = instance_pd_script(inst);
+       if (!script)
+               return -EFAULT;
+
+       e = script_handler_evas(script);
+       if (!e)
+               return -EFAULT;
+
+       DbgPrint("Event: %dx%d\n", event_info->x, event_info->y);
+       timestamp = util_timestamp();
+
+       switch (state) {
+       case EVENT_STATE_ACTIVATE:
+               script_handler_update_pointer(script, event_info->x, event_info->y, 1);
+               evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
+               evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
+               break;
+       case EVENT_STATE_ACTIVATED:
+               script_handler_update_pointer(script, event_info->x, event_info->y, -1);
+               evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
+               break;
+       case EVENT_STATE_DEACTIVATE:
+               script_handler_update_pointer(script, event_info->x, event_info->y, 0);
+               evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
+               evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
+               break;
+       default:
+               break;
+       }
+       return 0;
+}
+
 static struct packet *client_acquire(pid_t pid, int handle, const struct packet *packet) /*!< timestamp, ret */
 {
        struct client_node *client;
@@ -144,8 +308,8 @@ static struct packet *client_clicked(pid_t pid, int handle, const struct packet
        const char *id;
        const char *event;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        int ret;
        struct inst_info *inst;
 
@@ -156,14 +320,14 @@ static struct packet *client_clicked(pid_t pid, int handle, const struct packet
                goto out;
        }
 
-       ret = packet_get(packet, "sssddd", &pkgname, &id, &event, &timestamp, &x, &y);
+       ret = packet_get(packet, "sssdii", &pkgname, &id, &event, &timestamp, &x, &y);
        if (ret != 6) {
                ErrPrint("Parameter is not matched\n");
                ret = -EINVAL;
                goto out;
        }
 
-       DbgPrint("pid[%d] pkgname[%s] id[%s] event[%s] timestamp[%lf] x[%lf] y[%lf]\n", pid, pkgname, id, event, timestamp, x, y);
+       DbgPrint("pid[%d] pkgname[%s] id[%s] event[%s] timestamp[%lf] x[%d] y[%d]\n", pid, pkgname, id, event, timestamp, x, y);
 
        /*!
         * \NOTE:
@@ -619,11 +783,9 @@ static struct packet *client_pd_mouse_enter(pid_t pid, int handle, const struct
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -634,8 +796,8 @@ static struct packet *client_pd_mouse_enter(pid_t pid, int handle, const struct
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
-       if (ret != 7) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
                ErrPrint("Invalid parameter\n");
                ret = -EINVAL;
                goto out;
@@ -733,11 +895,9 @@ static struct packet *client_pd_mouse_leave(pid_t pid, int handle, const struct
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -748,8 +908,8 @@ static struct packet *client_pd_mouse_leave(pid_t pid, int handle, const struct
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
-       if (ret != 7) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
                ErrPrint("Parameter is not matched\n");
                ret = -EINVAL;
                goto out;
@@ -847,11 +1007,9 @@ static struct packet *client_pd_mouse_down(pid_t pid, int handle, const struct p
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -862,14 +1020,14 @@ static struct packet *client_pd_mouse_down(pid_t pid, int handle, const struct p
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
-       if (ret != 7) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
                ErrPrint("Parameter is not matched\n");
                ret = -EINVAL;
                goto out;
        }
 
-       DbgPrint("(%dx%d) - (%lfx%lf)\n", w, h, x, y);
+       DbgPrint("(%dx%d)\n", x, y);
 
        /*!
         * \NOTE:
@@ -945,7 +1103,7 @@ static struct packet *client_pd_mouse_down(pid_t pid, int handle, const struct p
                }
 
                script_handler_update_pointer(script, x, y, 1);
-               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
+               evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
                evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
                ret = 0;
        } else {
@@ -964,11 +1122,9 @@ static struct packet *client_pd_mouse_up(pid_t pid, int handle, const struct pac
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -979,14 +1135,14 @@ static struct packet *client_pd_mouse_up(pid_t pid, int handle, const struct pac
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
-       if (ret != 7) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
                ErrPrint("Parameter is not matched\n");
                ret = -EINVAL;
                goto out;
        }
 
-       DbgPrint("(%dx%d) - (%lfx%lf)\n", w, h, x, y);
+       DbgPrint("(%dx%d)\n", x, y);
        /*!
         * \NOTE:
         * Trust the package name which are sent by the client.
@@ -1061,7 +1217,7 @@ static struct packet *client_pd_mouse_up(pid_t pid, int handle, const struct pac
                }
 
                script_handler_update_pointer(script, x, y, 0);
-               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
+               evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
                evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
                ret = 0;
        } else {
@@ -1080,11 +1236,9 @@ static struct packet *client_pd_mouse_move(pid_t pid, int handle, const struct p
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -1095,14 +1249,14 @@ static struct packet *client_pd_mouse_move(pid_t pid, int handle, const struct p
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
-       if (ret != 7) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
                ErrPrint("Parameter is not matched\n");
                ret = -EINVAL;
                goto out;
        }
 
-       DbgPrint("(%dx%d) - (%lfx%lf)\n", w, h, x, y);
+       DbgPrint("(%dx%d)\n", x, y);
        /*!
         * \NOTE:
         * Trust the package name which are sent by the client.
@@ -1177,7 +1331,7 @@ static struct packet *client_pd_mouse_move(pid_t pid, int handle, const struct p
                }
 
                script_handler_update_pointer(script, x, y, -1);
-               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
+               evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
                ret = 0;
        } else {
                ErrPrint("Unsupported package\n");
@@ -1195,11 +1349,9 @@ static struct packet *client_lb_mouse_move(pid_t pid, int handle, const struct p
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -1210,8 +1362,8 @@ static struct packet *client_lb_mouse_move(pid_t pid, int handle, const struct p
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
-       if (ret != 7) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
                ErrPrint("Parameter is not matched\n");
                ret = -EINVAL;
                goto out;
@@ -1290,7 +1442,7 @@ static struct packet *client_lb_mouse_move(pid_t pid, int handle, const struct p
                }
 
                script_handler_update_pointer(script, x, y, -1);
-               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
+               evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
                ret = 0;
        } else {
                ErrPrint("Unsupported package\n");
@@ -1302,17 +1454,296 @@ out:
        return NULL;
 }
 
+static int inst_del_cb(struct inst_info *inst, void *data)
+{
+       event_deactivate();
+       return -1; /* Delete this callback */
+}
+
+static struct packet *client_lb_mouse_set(pid_t pid, int handle, const struct packet *packet)
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       double timestamp;
+       int x;
+       int y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_pid(pid);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Parameter is not matched\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       inst = package_find_instance_by_id(pkgname, id);
+       if (!inst) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       pkg = instance_package(inst);
+       if (!pkg) {
+               ErrPrint("Package[%s] info is not exists\n", pkgname);
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (package_is_fault(pkg)) {
+               /*!
+                * \note
+                * If the package is registered as fault module,
+                * slave has not load it, so we don't need to do anything at here!
+                */
+               DbgPrint("Package[%s] is faulted\n", pkgname);
+               ret = -EFAULT;
+       } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+               if (event_is_activated()) {
+                       if (event_deactivate() == 0)
+                               instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb);
+               }
+
+               ret = event_activate(x, y, event_lb_route_cb, inst);
+               if (ret == 0)
+                       instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, NULL);
+       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
+               if (event_is_activated()) {
+                       if (event_deactivate() == 0)
+                               instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb);
+               }
+
+               ret = event_activate(x, y, event_lb_consume_cb, inst);
+               if (ret == 0)
+                       instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, NULL);
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = -EINVAL;
+       }
+out:
+       return NULL;
+}
+
+static struct packet *client_lb_mouse_unset(pid_t pid, int handle, const struct packet *packet)
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       double timestamp;
+       int x;
+       int y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+       client = client_find_by_pid(pid);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = -ENOENT;
+               goto out;
+       }
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Parameter is not matched\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       inst = package_find_instance_by_id(pkgname, id);
+       if (!inst) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       pkg = instance_package(inst);
+       if (!pkg) {
+               ErrPrint("Package[%s] info is not exists\n", pkgname);
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (package_is_fault(pkg)) {
+               /*!
+                * \note
+                * If the package is registered as fault module,
+                * slave has not load it, so we don't need to do anything at here!
+                */
+               DbgPrint("Package[%s] is faulted\n", pkgname);
+               ret = -EFAULT;
+       } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+               ret = event_deactivate();
+               if (ret == 0)
+                       instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb);
+       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
+               ret = event_deactivate();
+               if (ret == 0)
+                       instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb);
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = -EINVAL;
+       }
+out:
+       return NULL;
+}
+
+static struct packet *client_pd_mouse_set(pid_t pid, int handle, const struct packet *packet)
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       double timestamp;
+       int x;
+       int y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_pid(pid);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Parameter is not matched\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       inst = package_find_instance_by_id(pkgname, id);
+       if (!inst) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       pkg = instance_package(inst);
+       if (!pkg) {
+               ErrPrint("Package[%s] info is not exists\n", pkgname);
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (package_is_fault(pkg)) {
+               /*!
+                * \note
+                * If the package is registered as fault module,
+                * slave has not load it, so we don't need to do anything at here!
+                */
+               DbgPrint("Package[%s] is faulted\n", pkgname);
+               ret = -EFAULT;
+       } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+               if (event_is_activated()) {
+                       if (event_deactivate() == 0)
+                               instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb);
+               }
+
+               ret = event_activate(x, y, event_pd_route_cb, inst);
+               if (ret == 0)
+                       instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, NULL);
+       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+               if (event_is_activated()) {
+                       if (event_deactivate() == 0)
+                               instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb);
+               }
+
+               ret = event_activate(x, y, event_pd_consume_cb, inst);
+               if (ret == 0)
+                       instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, NULL);
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = -EINVAL;
+       }
+
+out:
+       return NULL;
+}
+
+static struct packet *client_pd_mouse_unset(pid_t pid, int handle, const struct packet *packet)
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       double timestamp;
+       int x;
+       int y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_pid(pid);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Parameter is not matched\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       inst = package_find_instance_by_id(pkgname, id);
+       if (!inst) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       pkg = instance_package(inst);
+       if (!pkg) {
+               ErrPrint("Package[%s] info is not exists\n", pkgname);
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (package_is_fault(pkg)) {
+               /*!
+                * \note
+                * If the package is registered as fault module,
+                * slave has not load it, so we don't need to do anything at here!
+                */
+               DbgPrint("Package[%s] is faulted\n", pkgname);
+               ret = -EFAULT;
+       } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+               ret = event_deactivate();
+               if (ret == 0)
+                       instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb);
+       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+               ret = event_deactivate();
+               if (ret == 0)
+                       instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb);
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = -EINVAL;
+       }
+out:
+       return NULL;
+}
+
 static struct packet *client_lb_mouse_enter(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
 {
        struct client_node *client;
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -1323,8 +1754,8 @@ static struct packet *client_lb_mouse_enter(pid_t pid, int handle, const struct
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
-       if (ret != 7) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
                ErrPrint("Parameter is not matched\n");
                ret = -EINVAL;
                goto out;
@@ -1421,11 +1852,9 @@ static struct packet *client_lb_mouse_leave(pid_t pid, int handle, const struct
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -1436,8 +1865,8 @@ static struct packet *client_lb_mouse_leave(pid_t pid, int handle, const struct
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
-       if (ret != 7) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
                ErrPrint("Parameter is not matched\n");
                ret = -EINVAL;
                goto out;
@@ -1535,11 +1964,9 @@ static struct packet *client_lb_mouse_down(pid_t pid, int handle, const struct p
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -1550,8 +1977,8 @@ static struct packet *client_lb_mouse_down(pid_t pid, int handle, const struct p
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
-       if (ret != 7) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
                ErrPrint("Parameter is not matched\n");
                ret = -EINVAL;
                goto out;
@@ -1631,7 +2058,7 @@ static struct packet *client_lb_mouse_down(pid_t pid, int handle, const struct p
                }
 
                script_handler_update_pointer(script, x, y, 1);
-               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
+               evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
                evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
                ret = 0;
        } else {
@@ -1650,11 +2077,9 @@ static struct packet *client_lb_mouse_up(pid_t pid, int handle, const struct pac
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -1665,8 +2090,8 @@ static struct packet *client_lb_mouse_up(pid_t pid, int handle, const struct pac
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
-       if (ret != 7) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
                ErrPrint("Parameter is not matched\n");
                ret = -EINVAL;
                goto out;
@@ -1746,7 +2171,7 @@ static struct packet *client_lb_mouse_up(pid_t pid, int handle, const struct pac
                }
 
                script_handler_update_pointer(script, x, y, 0);
-               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
+               evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
                evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
                ret = 0;
        } else {
@@ -1765,11 +2190,9 @@ static struct packet *client_pd_access_read(pid_t pid, int handle, const struct
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -1780,8 +2203,8 @@ static struct packet *client_pd_access_read(pid_t pid, int handle, const struct
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
-       if (ret != 7) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
                ErrPrint("Invalid parameter\n");
                ret = -EINVAL;
                goto out;
@@ -1881,11 +2304,9 @@ static struct packet *client_pd_access_read_prev(pid_t pid, int handle, const st
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -1896,8 +2317,8 @@ static struct packet *client_pd_access_read_prev(pid_t pid, int handle, const st
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
-       if (ret != 7) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
                ErrPrint("Invalid parameter\n");
                ret = -EINVAL;
                goto out;
@@ -1997,11 +2418,9 @@ static struct packet *client_pd_access_read_next(pid_t pid, int handle, const st
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -2012,8 +2431,8 @@ static struct packet *client_pd_access_read_next(pid_t pid, int handle, const st
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
-       if (ret != 7) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
                ErrPrint("Invalid parameter\n");
                ret = -EINVAL;
                goto out;
@@ -2113,11 +2532,9 @@ static struct packet *client_pd_access_activate(pid_t pid, int handle, const str
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -2128,8 +2545,8 @@ static struct packet *client_pd_access_activate(pid_t pid, int handle, const str
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
-       if (ret != 7) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
                ErrPrint("Invalid parameter\n");
                ret = -EINVAL;
                goto out;
@@ -2229,11 +2646,9 @@ static struct packet *client_pd_key_down(pid_t pid, int handle, const struct pac
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -2244,8 +2659,8 @@ static struct packet *client_pd_key_down(pid_t pid, int handle, const struct pac
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
-       if (ret != 7) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
                ErrPrint("Invalid parameter\n");
                ret = -EINVAL;
                goto out;
@@ -2403,11 +2818,9 @@ static struct packet *client_pd_key_up(pid_t pid, int handle, const struct packe
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -2418,7 +2831,7 @@ static struct packet *client_pd_key_up(pid_t pid, int handle, const struct packe
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
        if (ret != 7) {
                ErrPrint("Invalid parameter\n");
                ret = -EINVAL;
@@ -2519,11 +2932,9 @@ static struct packet *client_lb_access_read(pid_t pid, int handle, const struct
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -2534,7 +2945,7 @@ static struct packet *client_lb_access_read(pid_t pid, int handle, const struct
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
        if (ret != 7) {
                ErrPrint("Parameter is not matched\n");
                ret = -EINVAL;
@@ -2636,11 +3047,9 @@ static struct packet *client_lb_access_read_prev(pid_t pid, int handle, const st
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -2651,7 +3060,7 @@ static struct packet *client_lb_access_read_prev(pid_t pid, int handle, const st
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
        if (ret != 7) {
                ErrPrint("Parameter is not matched\n");
                ret = -EINVAL;
@@ -2753,11 +3162,9 @@ static struct packet *client_lb_access_read_next(pid_t pid, int handle, const st
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -2768,7 +3175,7 @@ static struct packet *client_lb_access_read_next(pid_t pid, int handle, const st
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
        if (ret != 7) {
                ErrPrint("Parameter is not matched\n");
                ret = -EINVAL;
@@ -2870,11 +3277,9 @@ static struct packet *client_lb_access_activate(pid_t pid, int handle, const str
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -2885,7 +3290,7 @@ static struct packet *client_lb_access_activate(pid_t pid, int handle, const str
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
        if (ret != 7) {
                ErrPrint("Parameter is not matched\n");
                ret = -EINVAL;
@@ -2987,11 +3392,9 @@ static struct packet *client_lb_key_down(pid_t pid, int handle, const struct pac
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -3002,7 +3405,7 @@ static struct packet *client_lb_key_down(pid_t pid, int handle, const struct pac
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
        if (ret != 7) {
                ErrPrint("Parameter is not matched\n");
                ret = -EINVAL;
@@ -3104,11 +3507,9 @@ static struct packet *client_lb_key_up(pid_t pid, int handle, const struct packe
        const char *pkgname;
        const char *id;
        int ret;
-       int w;
-       int h;
        double timestamp;
-       double x;
-       double y;
+       int x;
+       int y;
        struct inst_info *inst;
        const struct pkg_info *pkg;
 
@@ -3119,7 +3520,7 @@ static struct packet *client_lb_key_up(pid_t pid, int handle, const struct packe
                goto out;
        }
 
-       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
        if (ret != 7) {
                ErrPrint("Parameter is not matched\n");
                ret = -EINVAL;
@@ -5264,6 +5665,22 @@ static struct method s_client_table[] = {
                .handler = client_lb_mouse_leave, /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
        },
        {
+               .cmd = "lb_mouse_set",
+               .handler = client_lb_mouse_set,
+       },
+       {
+               .cmd = "lb_mouse_unset",
+               .handler = client_lb_mouse_unset,
+       },
+       {
+               .cmd = "pd_mouse_set",
+               .handler = client_pd_mouse_set,
+       },
+       {
+               .cmd = "pd_mouse_unset",
+               .handler = client_pd_mouse_unset,
+       },
+       {
                .cmd = "change,visibility",
                .handler = client_change_visibility,
        },