Sync with the latest tizen 2.x 93/47293/2
authorSung-jae Park <nicesj.park@samsung.com>
Wed, 2 Sep 2015 04:44:16 +0000 (13:44 +0900)
committerSung-jae Park <nicesj@nicesj.com>
Wed, 2 Sep 2015 13:58:05 +0000 (06:58 -0700)
Change-Id: I7116caeb40d00d6a4307aea96b76df77c8106bfc

22 files changed:
data/CMakeLists.txt
include/dead_monitor.h
include/debug.h
include/event.h
include/script_handler.h
include/util.h
packaging/data-provider-master.spec
pkgmgr_widget/common/src/common.c
src/buffer_handler.c
src/buffer_handler_wayland.c
src/critical_log.c
src/dead_monitor.c
src/event.c
src/main.c
src/monitor.c
src/package.c
src/script_handler.c
src/server.c
src/slave_life.c
src/util.c
src/utility_service.c
widget-mgr/src/widget-mgr.c

index aa56f64..e56be3e 100644 (file)
@@ -1,16 +1,13 @@
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.service DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.path DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.service DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
 IF (LIVEBOX)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/dump_widget.sh DESTINATION /opt/etc/dump.d/module.d/ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
 ENDIF (LIVEBOX)
-
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.target DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-client.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-provider.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-fd.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-service.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-badge.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-notification.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-shortcut.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-utility.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.target DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-client.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-provider.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-fd.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-service.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-badge.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-notification.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-shortcut.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-utility.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
index 52ebbe4..35ce0f1 100644 (file)
@@ -17,6 +17,6 @@
 extern int dead_init(void);
 extern int dead_fini(void);
 extern int dead_callback_add(int handle, void (*dead_cb)(int handle, void *data), void *data);
-extern void *dead_callback_del(int handle, void (*dead_cb)(int handle, void *data));
+extern void *dead_callback_del(int handle, void (*dead_cb)(int handle, void *data), void *data);
 
 /* End of a file */
index cbf1ea0..717fb49 100644 (file)
@@ -20,9 +20,9 @@
 #define WarnPrint(format, arg...)      SECURE_LOGW(format, ##arg)
 #else
 extern FILE *__file_log_fp;
-#define DbgPrint(format, arg...) do { fprintf(__file_log_fp, "[LOG] [\e[32m%s/%s\e[0m:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0)
-#define ErrPrint(format, arg...) do { fprintf(__file_log_fp, "[ERR] [\e[32m%s/%s\e[0m:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0)
-#define WarnPrint(format, arg...) do { fprintf(__file_log_fp, "[WRN] [\e[32m%s/%s\e[0m:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0)
+#define DbgPrint(format, arg...) do { fprintf(__file_log_fp, "[LOG] [\e[32m%s/%s\e[0m:%d] " format, widget_util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0)
+#define ErrPrint(format, arg...) do { fprintf(__file_log_fp, "[ERR] [\e[32m%s/%s\e[0m:%d] " format, widget_util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0)
+#define WarnPrint(format, arg...) do { fprintf(__file_log_fp, "[WRN] [\e[32m%s/%s\e[0m:%d] " format, widget_util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0)
 #endif
 
 // DbgPrint("FREE\n");
index 64acb5b..8943ab1 100644 (file)
@@ -56,14 +56,14 @@ 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, 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_activate(int device, 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 device, 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);
 
 extern int event_deactivate_thread(enum event_handler_activate_type activate_type);
 extern int event_activate_thread(enum event_handler_activate_type activate_type);
 
-extern void event_set_mouse_xy(int x, int y, double ratio_w, double ratio_h, double timestamp);
+extern void event_set_mouse_xy(int device, int x, int y, double ratio_w, double ratio_h, double timestamp);
 
 /* End of a file */
index 5e84f2b..933c557 100644 (file)
@@ -30,7 +30,7 @@ extern int script_fini(void);
 
 extern int script_signal_emit(void *buffer_handle, const char *part, const char *signal, double sx, double sy, double ex, double ey);
 
-extern int script_handler_update_pointer(struct script_info *inst, int x, int y, int down);
+extern int script_handler_update_pointer(struct script_info *info, int device, int x, int y, int down);
 extern int script_handler_update_keycode(struct script_info *info, unsigned int keycode);
 extern int script_handler_resize(struct script_info *info, int w, int h);
 extern const char *script_handler_buffer_id(struct script_info *info);
index 3aa09d2..91ee9fc 100644 (file)
@@ -20,7 +20,6 @@ extern int util_check_ext(const char *filename, const char *check_ptr);
 extern int util_unlink(const char *filename);
 extern int util_unlink_files(const char *folder);
 extern char *util_slavename(void);
-extern const char *util_basename(const char *name);
 extern unsigned long long util_free_space(const char *path);
 extern void *util_timer_add(double interval, Eina_Bool (*cb)(void *data), void *data);
 extern void util_timer_interval_set(void *timer, double interval);
index 00cfe04..9eb52c4 100644 (file)
@@ -2,7 +2,7 @@
 
 Name: data-provider-master
 Summary: Master service provider for widgetes
-Version: 1.1.10
+Version: 1.2.0
 Release: 1
 Group: Applications/Core Applications
 License: Flora-1.1
@@ -112,23 +112,13 @@ CFLAGS="${CFLAGS} -Wall -Winline -Werror" LDFLAGS="${LDFLAGS}" make %{?jobs:-j%j
 rm -rf %{buildroot}
 %make_install
 mkdir -p %{buildroot}/%{_datarootdir}/license
-mkdir -p %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants
-ln -sf ../%{name}.service %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}.service
-ln -sf ../%{name}.path %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}.path
-ln -sf ../%{name}.target %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}.target
-ln -sf ../%{name}-client.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-client.socket
-ln -sf ../%{name}-provider.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-provider.socket
-ln -sf ../%{name}-service.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-service.socket
-ln -sf ../%{name}-badge.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-badge.socket
-ln -sf ../%{name}-notification.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-notification.socket
-ln -sf ../%{name}-shortcut.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-shortcut.socket
-ln -sf ../%{name}-utility.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-utility.socket
-ln -sf ../%{name}-fd.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-fd.socket
-
+mkdir -p %{buildroot}%{_prefix}/lib/systemd/system/multi-user.target.wants
+ln -sf ../%{name}.service %{buildroot}%{_prefix}/lib/systemd/system/multi-user.target.wants/%{name}.service
 mkdir -p %{buildroot}/opt/usr/share/live_magazine
 mkdir -p %{buildroot}/opt/usr/share/live_magazine/log
 mkdir -p %{buildroot}/opt/usr/share/live_magazine/reader
 mkdir -p %{buildroot}/opt/usr/share/live_magazine/always
+mkdir -p %{buildroot}/opt/usr/share/live_magazine/widget.lck
 mkdir -p %{buildroot}/opt/usr/devel/usr/bin
 mkdir -p %{buildroot}/usr/dbspace
 
@@ -178,51 +168,49 @@ chown ${APP_UID}:${APP_GID} /opt/usr/share/live_magazine
 # System tool(widget-mgr) should be able to access this folder.
 # So give the "rx" permission to the other group. (750 -> 755)
 chmod 755 /opt/usr/share/live_magazine
+
 chown ${APP_UID}:${APP_GID} /opt/usr/share/live_magazine/log
 chmod 750 /opt/usr/share/live_magazine/log
+
 chown ${APP_UID}:${APP_GID} /opt/usr/share/live_magazine/reader
 chmod 750 /opt/usr/share/live_magazine/reader
+
 chown ${APP_UID}:${APP_GID} /opt/usr/share/live_magazine/always
 chmod 750 /opt/usr/share/live_magazine/always
 
+chown ${SYSTEM}:${APP_GID} /opt/usr/share/live_magazine/widget.lck
+chmod 770 /opt/usr/share/live_magazine/widget.lck
+mv /opt/usr/share/live_magazine/widget.lck /opt/usr/share/live_magazine/.widget.lck
+
+chown ${SYSTEM}:${APP_GID} %{_prefix}/dbspace/.widget.db
+chmod 644 %{_prefix}/dbspace/.widget.db
+chown ${SYSTEM}:${APP_GID} /opt/dbspace/.widget.db-journal
+chmod 644 %{_prefix}/dbspace/.widget.db-journal
+
 # SYSTEM_UID?
 chown ${APP_UID}:${APP_GID} /usr/dbspace/.widget.db
 chmod 640 /usr/dbspace/.widget.db
 chown ${APP_UID}:${APP_GID} /usr/dbspace/.widget.db-journal
 chmod 640 /usr/dbspace/.widget.db-journal
 
-vconftool set -t bool "memory/%{name}/started" 0 -i -u ${APP_UID} -f -s system::vconf_system
-vconftool set -t int "memory/private/%{name}/restart_count" 0 -i -u ${APP_UID} -f -s %{name}
-vconftool set -t string "db/%{name}/serveraddr" "/opt/usr/share/live_magazine/.client.socket" -i -u ${APP_UID} -f -s system::vconf_system
-
 echo "Successfully installed. Please start a daemon again manually"
 
 %files -n %{name}
 %manifest %{name}.manifest
-%defattr(-,root,root,-)
-%caps(cap_chown,cap_dac_override,cap_dac_read_search,cap_sys_admin,cap_sys_nice,cap_mac_override,cap_mac_admin+ep) %{_bindir}/%{name}
-%{_prefix}/lib/systemd/user/%{name}.target
-%{_prefix}/lib/systemd/user/%{name}-client.socket
-%{_prefix}/lib/systemd/user/%{name}-provider.socket
-%{_prefix}/lib/systemd/user/%{name}-service.socket
-%{_prefix}/lib/systemd/user/%{name}-badge.socket
-%{_prefix}/lib/systemd/user/%{name}-notification.socket
-%{_prefix}/lib/systemd/user/%{name}-shortcut.socket
-%{_prefix}/lib/systemd/user/%{name}-utility.socket
-%{_prefix}/lib/systemd/user/%{name}-fd.socket
-%{_prefix}/lib/systemd/user/%{name}.service
-%{_prefix}/lib/systemd/user/%{name}.path
-%{_prefix}/lib/systemd/user/default.target.wants/%{name}.target
-%{_prefix}/lib/systemd/user/default.target.wants/%{name}-client.socket
-%{_prefix}/lib/systemd/user/default.target.wants/%{name}-provider.socket
-%{_prefix}/lib/systemd/user/default.target.wants/%{name}-service.socket
-%{_prefix}/lib/systemd/user/default.target.wants/%{name}-badge.socket
-%{_prefix}/lib/systemd/user/default.target.wants/%{name}-notification.socket
-%{_prefix}/lib/systemd/user/default.target.wants/%{name}-shortcut.socket
-%{_prefix}/lib/systemd/user/default.target.wants/%{name}-utility.socket
-%{_prefix}/lib/systemd/user/default.target.wants/%{name}-fd.socket
-%{_prefix}/lib/systemd/user/default.target.wants/%{name}.service
-%{_prefix}/lib/systemd/user/default.target.wants/%{name}.path
+%defattr(-,system,system,-)
+#%caps(cap_chown,cap_dac_override,cap_dac_read_search,cap_sys_admin,cap_sys_nice+ep) %{_prefix}/bin/%{name}
+%{_prefix}/lib/systemd/system/multi-user.target.wants/%{name}.service
+%{_prefix}/lib/systemd/system/%{name}.service
+%{_prefix}/lib/systemd/system/%{name}.target
+%{_prefix}/bin
+#%{_libdir}/systemd/system/%{name}-client.socket
+#%{_libdir}/systemd/system/%{name}-provider.socket
+#%{_libdir}/systemd/system/%{name}-service.socket
+#%{_libdir}/systemd/system/%{name}-badge.socket
+#%{_libdir}/systemd/system/%{name}-notification.socket
+#%{_libdir}/systemd/system/%{name}-shortcut.socket
+#%{_libdir}/systemd/system/%{name}-utility.socket
+#%{_libdir}/systemd/system/%{name}-fd.socket
 %{_datarootdir}/license/*
 %if 0%{?tizen_build_binary_release_type_eng}
 /opt/usr/devel/usr/bin/*
@@ -230,8 +218,8 @@ echo "Successfully installed. Please start a daemon again manually"
 %{_prefix}/etc/package-manager/parserlib/*
 %{_datarootdir}/%{name}/*
 /opt/etc/dump.d/module.d/dump_widget.sh
-%defattr(-,owner,users,-)
+#%defattr(-,owner,users,-)
 /opt/usr/share/live_magazine/*
-/usr/dbspace/.widget.db*
+%{_prefix}/dbspace/.widget.db*
 
 # End of a file
index 9f3d19e..37aa3bc 100644 (file)
@@ -44,6 +44,9 @@
 
 #define CUR_VER 5
 #define DEFAULT_CATEGORY       "http://tizen.org/category/default"
+#define SCHEME_HTTP    "http://"
+#define SCHEME_HTTPS   "https://"
+#define SCHEME_FILE    "file://"
 
 #if !defined(WIDGET_COUNT_OF_SIZE_TYPE)
 #define WIDGET_COUNT_OF_SIZE_TYPE 13
@@ -223,6 +226,23 @@ static struct {
        .handle = NULL,
 };
 
+static int is_scheme(const char *path)
+{
+       if (!strncasecmp(path, SCHEME_HTTP, strlen(SCHEME_HTTP))) {
+               return 1;
+       }
+
+       if (!strncasecmp(path, SCHEME_HTTPS, strlen(SCHEME_HTTPS))) {
+               return 1;
+       }
+
+       if (!strncasecmp(path, SCHEME_FILE, strlen(SCHEME_FILE))) {
+               return 1;
+       }
+
+       return 0;
+}
+
 static inline int next_state(int from, char ch)
 {
        switch (ch) {
@@ -2617,7 +2637,9 @@ static void update_box(struct widget *widget, xmlNodePtr node)
                        if (!src) {
                                ErrPrint("strdup: %d\n", errno);
                        } else {
-                               abspath((char *)widget->widget_src, (char *)src);
+                               if (!is_scheme((char *)widget->widget_src)) {
+                                       abspath((char *)widget->widget_src, (char *)src);
+                               }
                                xmlFree(widget->widget_src);
                                widget->widget_src = src;
                        }
@@ -2835,7 +2857,9 @@ static void update_glance_bar(struct widget *widget, xmlNodePtr node)
                        if (!src) {
                                ErrPrint("strdup: %d\n", errno);
                        } else {
-                               abspath((char *)widget->gbar_src, (char *)src);
+                               if (!is_scheme((char *)widget->widget_src)) {
+                                       abspath((char *)widget->gbar_src, (char *)src);
+                               }
                                xmlFree(widget->gbar_src);
                                widget->gbar_src = src;
                        }
@@ -3053,15 +3077,16 @@ static int has_meta_tag(const char *appid, const char *meta_tag)
                return 0;
        }
 
-/**
- * Not supported from tizen 3.0 yet
- *
+       /**
+        * @todo
+        * Need to find a replacement of this API
+        *
        ret = pkgmgrinfo_appinfo_get_metadata_value(handle, meta_tag, &value);
        if (ret != PMINFO_R_OK) {
                pkgmgrinfo_appinfo_destroy_appinfo(handle);
                return 0;
        }
-*/
+       */
 
        ret = value && value[0] != '\0';
 
@@ -3178,8 +3203,8 @@ int db_install_widget(xmlNodePtr node, const char *appid)
                xmlFree(tmp);
        }
 
-       if (xmlHasProp(node, (const xmlChar *)"direct_input")) {
-               tmp = xmlGetProp(node, (const xmlChar *)"direct_input");
+       if (xmlHasProp(node, (const xmlChar *)"direct-input")) {
+               tmp = xmlGetProp(node, (const xmlChar *)"direct-input");
                widget->direct_input = tmp && !xmlStrcasecmp(tmp, (const xmlChar *)"true");
                xmlFree(tmp);
        }
@@ -3453,6 +3478,13 @@ int db_install_watchapp(xmlNodePtr node, const char *appid)
        widget->default_need_frame = 0;
        widget->size_list = WIDGET_SIZE_TYPE_2x2;
 
+       /**
+        * @note
+        * In case of the watch,
+        * It only can be created one instance at a time.
+        */
+       widget->count = 1;
+
        if (xmlHasProp(node, (const xmlChar *)"exec")) {
                widget->libexec = xmlGetProp(node, (const xmlChar *)"exec");
                if (!widget->libexec) {
index c8a9a8e..b1065a1 100644 (file)
@@ -75,6 +75,7 @@ struct gem_data {
        Pixmap pixmap;
        void *data; /* Gem layer */
        int refcnt;
+       widget_resource_lock_t resource_lock;
 
        void *compensate_data; /* Check the pitch value, copy this to data */
 };
@@ -167,6 +168,13 @@ static inline widget_fb_t create_pixmap(struct buffer_info *info)
                ErrPrint("Unable to clear the pixmap\n");
        }
 
+       if (WIDGET_CONF_ENABLE_RESOURCE_LOCK) {
+               gem->resource_lock = widget_service_create_resource_lock(gem->pixmap, WIDGET_LOCK_WRITE);
+               if (!gem->resource_lock) {
+                       ErrPrint("Failed to create a resource lock: %u\n", gem->pixmap);
+               }
+       }
+
        return buffer;
 }
 
@@ -342,6 +350,15 @@ static inline int destroy_pixmap(widget_fb_t buffer)
 
                DbgPrint("pixmap %lu\n", gem->pixmap);
                XFreePixmap(disp, gem->pixmap);
+
+               if (WIDGET_CONF_ENABLE_RESOURCE_LOCK) {
+                       if (gem->resource_lock) {
+                               if (widget_service_destroy_resource_lock(gem->resource_lock, 1) != WIDGET_ERROR_NONE) {
+                                       ErrPrint("Failed to destroy resource lock\n");
+                               }
+                               gem->resource_lock = NULL;
+                       }
+               }
        }
 
        buffer->state = WIDGET_FB_STATE_DESTROYED;
@@ -353,10 +370,6 @@ static inline int destroy_gem(widget_fb_t buffer)
 {
        struct gem_data *gem;
 
-       if (!buffer) {
-               return WIDGET_ERROR_INVALID_PARAMETER;
-       }
-
        /*!
         * Forcely release the acquire_buffer.
         */
@@ -703,12 +716,12 @@ EAPI int buffer_handler_unload(struct buffer_info *info)
 
        switch (info->type) {
        case WIDGET_FB_TYPE_FILE:
-               widget_service_destroy_lock(info->lock_info);
+               widget_service_destroy_lock(info->lock_info, 1);
                info->lock_info = NULL;
                ret = unload_file_buffer(info);
                break;
        case WIDGET_FB_TYPE_SHM:
-               widget_service_destroy_lock(info->lock_info);
+               widget_service_destroy_lock(info->lock_info, 1);
                info->lock_info = NULL;
                ret = unload_shm_buffer(info);
                break;
index 8fe6a74..a8dcb99 100644 (file)
@@ -565,12 +565,12 @@ EAPI int buffer_handler_unload(struct buffer_info *info)
 
        switch (info->type) {
        case WIDGET_FB_TYPE_FILE:
-               widget_service_destroy_lock(info->lock_info);
+               widget_service_destroy_lock(info->lock_info, 1);
                info->lock_info = NULL;
                ret = unload_file_buffer(info);
                break;
        case WIDGET_FB_TYPE_SHM:
-               widget_service_destroy_lock(info->lock_info);
+               widget_service_destroy_lock(info->lock_info, 1);
                info->lock_info = NULL;
                ret = unload_shm_buffer(info);
                break;
@@ -1072,7 +1072,7 @@ static inline widget_fb_t raw_open_file(const char *filename)
        buffer->state = WIDGET_FB_STATE_CREATED;
        buffer->type = WIDGET_FB_TYPE_FILE;
        buffer->refcnt = 0;
-       buffer->info = (void *)((unsigned long)off);
+       buffer->info = (void *)off;
 
        ret = read(fd, buffer->data, off);
        if (ret < 0) {
index fce937f..703be15 100644 (file)
@@ -30,6 +30,7 @@
 #if defined(HAVE_LIVEBOX)
 #include <widget_errno.h>
 #include <widget_conf.h>
+#include <widget_util.h>
 #else
 #include "lite-errno.h"
 #endif
@@ -101,7 +102,7 @@ HAPI int critical_log(const char *func, int line, const char *fmt, ...)
 
        CRITICAL_SECTION_BEGIN(&s_info.cri_lock);
 
-       fprintf(s_info.fp, "%lf [%s:%d] ", util_timestamp(), util_basename((char *)func), line);
+       fprintf(s_info.fp, "%lf [%s:%d] ", util_timestamp(), widget_util_basename((char *)func), line);
 
        va_start(ap, fmt);
        ret = vfprintf(s_info.fp, fmt, ap);
index ad6b2e7..009dd23 100644 (file)
@@ -38,6 +38,7 @@
 
 struct cb_item {
        int handle;
+       int disconnected;
        void (*dead_cb)(int handle, void *data);
        void *data;
 };
@@ -58,9 +59,17 @@ static int evt_cb(int handle, void *data)
        Eina_List *n;
 
        EINA_LIST_FOREACH_SAFE(s_info.cb_list, l, n, dead_item) {
+               /**
+                * If the callback is called already,
+                * Do not call it again.
+                * Using "disconnected" varaible, prevent from duplicated callback call.
+                */
                if (dead_item->handle == handle) {
-                       dead_item->dead_cb(dead_item->handle, dead_item->data);
-                       break;
+                       if (dead_item->disconnected == 0) {
+                               dead_item->dead_cb(dead_item->handle, dead_item->data);
+                               dead_item->disconnected = 1;
+                               break;
+                       }
                }
        }
 
@@ -148,7 +157,7 @@ HAPI int dead_callback_add(int handle, void (*dead_cb)(int handle, void *data),
        Eina_List *l;
 
        EINA_LIST_FOREACH(s_info.cb_list, l, item) {
-               if (item->handle == handle) {
+               if (item->handle == handle && item->disconnected == 0) {
                        return WIDGET_ERROR_ALREADY_EXIST;
                }
        }
@@ -161,19 +170,26 @@ HAPI int dead_callback_add(int handle, void (*dead_cb)(int handle, void *data),
        item->handle = handle;
        item->dead_cb = dead_cb;
        item->data = data;
+       /**
+        * Handle can be reallocated if the first connection is disconnected,
+        * The kernel can resue the last handle (index) for newly comming connection.
+        * So we have to check the callback data using disconnected field.
+        * If the connection is disconnected first, we have to toggle this to true.
+        */
+       item->disconnected = 0;
 
        s_info.cb_list = eina_list_append(s_info.cb_list, item);
        return 0;
 }
 
-HAPI void *dead_callback_del(int handle, void (*dead_cb)(int handle, void *data))
+HAPI void *dead_callback_del(int handle, void (*dead_cb)(int handle, void *data), void *data)
 {
        struct cb_item *item;
        Eina_List *l;
        Eina_List *n;
 
        EINA_LIST_FOREACH_SAFE(s_info.cb_list, l, n, item) {
-               if (item->handle == handle && item->dead_cb == dead_cb) {
+               if (item->handle == handle && item->dead_cb == dead_cb && item->data == data) {
                        void *cbdata;
 
                        s_info.cb_list = eina_list_remove(s_info.cb_list, item);
index 4930cea..d95707d 100644 (file)
@@ -83,7 +83,7 @@ static struct info {
                .x = -1,
                .y = -1,
                .device = -1,
-               .slot = -1,
+               .slot = 0,
                .keycode = 0,
        },
 
@@ -91,7 +91,7 @@ static struct info {
                .x = -1,
                .y = -1,
                .device = -1,
-               .slot = -1,
+               .slot = 0,
                .keycode = 0,
        },
 
@@ -112,6 +112,9 @@ struct event_listener {
        int y; /* RelY */
        double ratio_w;
        double ratio_h;
+       int slot;
+
+       int unset_done;
 };
 
 static int event_control_fini(void);
@@ -179,6 +182,20 @@ static int push_event_item(void)
        return WIDGET_ERROR_NONE;
 }
 
+static struct event_data *pop_event_item(void)
+{
+       struct event_data *item;
+
+       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);
+       }
+       CRITICAL_SECTION_END(&s_info.event_list_lock);
+
+       return item;
+}
+
 static double current_time_get(void)
 {
        double ret;
@@ -498,6 +515,7 @@ static void *event_thread_main(void *data)
 
        s_info.event_data.x = -1;
        s_info.event_data.y = -1;
+       s_info.event_data.slot = 0;
 
        while (1) {
                FD_ZERO(&set);
@@ -590,12 +608,70 @@ static int invoke_event_cb(struct event_listener *listener, struct event_data *i
        return 0;
 }
 
-static inline void clear_all_listener_list(void)
+static inline void clear_listener(struct event_listener *listener)
 {
-       struct event_listener *listener;
        enum event_state next_state;
        struct event_data event_data;
        struct event_data *p_event_data;
+
+       /**
+        * @note
+        * terminate this listener. with keep its event state (DOWN -> MOVE -> UP)
+        */
+       while (listener) {
+               DbgPrint("listener[%p] prev[%x] state[%x]\n", listener, listener->prev_state, listener->state);
+
+               switch (listener->state) {
+               case EVENT_STATE_ACTIVATE:
+                       p_event_data = &s_info.event_data;
+                       next_state = EVENT_STATE_ACTIVATED;
+                       break;
+               case EVENT_STATE_ACTIVATED:
+                       p_event_data = &s_info.event_data;
+                       next_state = EVENT_STATE_DEACTIVATE;
+                       break;
+               case EVENT_STATE_DEACTIVATE:
+                       memcpy(&event_data, &s_info.event_data, sizeof(event_data));
+                       p_event_data = &event_data;
+
+                       if (listener->prev_state == EVENT_STATE_ACTIVATE) {
+                               /* There is no move event. we have to emulate it */
+                               DbgPrint ("Let's emulate move event (%dx%d)\n", p_event_data->x, p_event_data->y);
+                               listener->state = EVENT_STATE_ACTIVATE;
+                               next_state = EVENT_STATE_ACTIVATED;
+                       } else {
+                               next_state = EVENT_STATE_DEACTIVATED;
+                       }
+                       break;
+               case EVENT_STATE_DEACTIVATED:
+               default:
+                       s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
+                       DbgFree(listener);
+                       listener = NULL;
+                       continue;
+               }
+
+               p_event_data->slot = listener->slot;
+               if (invoke_event_cb(listener, p_event_data)) {
+                       /**
+                        * @note
+                        * listener is deleted.
+                        */
+                       listener = NULL;
+                       continue;
+               }
+
+               /*!
+                * Changing state of listener will affect to the event collecting thread.
+                */
+               listener->prev_state = listener->state;
+               listener->state = next_state;
+       }
+}
+
+static inline void clear_all_listener_list(void)
+{
+       struct event_listener *listener;
        Eina_List *l;
        Eina_List *n;
 
@@ -606,50 +682,8 @@ static inline void clear_all_listener_list(void)
                DbgPrint("Use skipped event: %dx%d\n", s_info.skipped_event_data.x, s_info.skipped_event_data.y);
        }
 
-       while (s_info.event_listener_list) {
-               EINA_LIST_FOREACH_SAFE(s_info.event_listener_list, l, n, listener) {
-
-                       DbgPrint("listener[%p] prev[%x] state[%x]\n", listener, listener->prev_state, listener->state);
-
-                       switch (listener->state) {
-                       case EVENT_STATE_ACTIVATE:
-                               p_event_data = &s_info.event_data;
-                               next_state = EVENT_STATE_ACTIVATED;
-                               break;
-                       case EVENT_STATE_ACTIVATED:
-                               p_event_data = &s_info.event_data;
-                               next_state = EVENT_STATE_DEACTIVATE;
-                               break;
-                       case EVENT_STATE_DEACTIVATE:
-                               memcpy(&event_data, &s_info.event_data, sizeof(event_data));
-                               p_event_data = &event_data;
-
-                               if (listener->prev_state == EVENT_STATE_ACTIVATE) {
-                                       /* There is no move event. we have to emulate it */
-                                       DbgPrint ("Let's emulate move event (%dx%d)\n", p_event_data->x, p_event_data->y);
-                                       listener->state = EVENT_STATE_ACTIVATE;
-                                       next_state = EVENT_STATE_ACTIVATED;
-                               } else {
-                                       next_state = EVENT_STATE_DEACTIVATED;
-                               }
-                               break;
-                       case EVENT_STATE_DEACTIVATED:
-                       default:
-                               s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
-                               DbgFree(listener);
-                               continue;
-                       }
-
-                       if (invoke_event_cb(listener, p_event_data)) {
-                               continue;
-                       }
-
-                       /*!
-                        * Changing state of listener will affect to the event collecting thread.
-                        */
-                       listener->prev_state = listener->state;
-                       listener->state = next_state;
-               }
+       EINA_LIST_FOREACH_SAFE(s_info.event_listener_list, l, n, listener) {
+               clear_listener(listener);
        }
 }
 
@@ -719,19 +753,21 @@ static Eina_Bool event_read_cb(void *data, Ecore_Fd_Handler *handler)
                }
        }
 
-       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);
-       }
-       CRITICAL_SECTION_END(&s_info.event_list_lock);
-
+       item = pop_event_item();
        if (!item) {
                ErrPrint("There is no remained event\n");
                return ECORE_CALLBACK_RENEW;
        }
 
        EINA_LIST_FOREACH_SAFE(s_info.event_listener_list, l, n, listener) {
+               if (item->slot != listener->slot) {
+                       continue;
+               }
+
+               if (item->device == -1) {
+                       DbgPrint("Touch released (%d) listener state(%x)\n", item->slot, listener->state);
+               }
+
                switch (listener->state) {
                case EVENT_STATE_ACTIVATE:
                        if (compare_timestamp(listener, item) > 0) {
@@ -743,6 +779,23 @@ static Eina_Bool event_read_cb(void *data, Ecore_Fd_Handler *handler)
                        break;
                case EVENT_STATE_DEACTIVATE:
                        if (compare_timestamp(listener, item) < 0) {
+                               if (listener->unset_done == 1) {
+                                       /**
+                                        * @note
+                                        * in case of the multi=touch,
+                                        * The thread will not be terminated soon.
+                                        * in this case, we should send UP event and destroy listener properly.
+                                        */
+                                       clear_listener(listener);
+                                       /**
+                                        * @note
+                                        * Listener will be deleted.
+                                        * But event_item which is related with this listener can be remained.
+                                        * And it will be deleted soon.
+                                        */
+                                       continue;
+                               }
+
                                /* Consuming all events occurred while activating this listener */
                                state = listener->prev_state;
                                listener->prev_state = listener->state;
@@ -759,12 +812,16 @@ static Eina_Bool event_read_cb(void *data, Ecore_Fd_Handler *handler)
                                }
 
                                if (invoke_event_cb(listener, item) == 1) {
-                                       /* listener is deleted */
+                                       /**
+                                        * @note
+                                        * listener is deleted
+                                        */
                                        continue;
                                }
 
                                if (listener->state == EVENT_STATE_ACTIVATE) {
                                        /**
+                                        * @note
                                         * We are already jumped into the DEACTIVATE state
                                         * But the state is ACTIVATE, it means, we forcely chnaged it from LINE 747
                                         * We successfully sent the DOWN event.
@@ -782,7 +839,10 @@ static Eina_Bool event_read_cb(void *data, Ecore_Fd_Handler *handler)
                                memcpy(&s_info.skipped_event_data, item, sizeof(s_info.skipped_event_data));
                        }
 
-                       /* Do not terminate this listener, until this mets EVENT_EXIT */
+                       /**
+                        * @note
+                        * Do not terminate this listener, until this mets EVENT_EXIT
+                        */
                        continue;
                case EVENT_STATE_ACTIVATED:
                        if (compare_timestamp(listener, item) > 0) {
@@ -805,6 +865,10 @@ static Eina_Bool event_read_cb(void *data, Ecore_Fd_Handler *handler)
                }
 
                if (invoke_event_cb(listener, item) == 1) {
+                       /**
+                        * @note
+                        * listener is deleted.
+                        */
                        continue;
                }
 
@@ -963,14 +1027,14 @@ 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, double ratio_w, double ratio_h, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data)
+HAPI int event_activate(int slot, 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;
        Eina_List *l;
 
        EINA_LIST_FOREACH(s_info.event_listener_list, l, listener) {
-               if (listener->event_cb == event_cb && listener->cbdata == data) {
+               if (listener->event_cb == event_cb && listener->cbdata == data && listener->slot == slot) {
                        ErrPrint("Already registered\n");
                        return WIDGET_ERROR_ALREADY_EXIST;
                }
@@ -993,6 +1057,8 @@ HAPI int event_activate(int x, int y, double ratio_w, double ratio_h, int (*even
        listener->y = y;
        listener->ratio_w = ratio_w;
        listener->ratio_h = ratio_h;
+       listener->slot = slot;
+       listener->unset_done = 0;
 
        if (s_info.event_handler_activated == EVENT_HANDLER_DEACTIVATED) {
                /*!
@@ -1027,7 +1093,7 @@ HAPI int event_input_fd(void)
        return s_info.handle;
 }
 
-HAPI int event_deactivate(int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data)
+HAPI int event_deactivate(int slot, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data)
 {
        struct event_listener *listener = NULL;
        struct event_listener *item;
@@ -1035,7 +1101,7 @@ HAPI int event_deactivate(int (*event_cb)(enum event_state state, struct event_d
        int keep_thread = 0;
 
        EINA_LIST_FOREACH(s_info.event_listener_list, l, item) {
-               if (item->event_cb == event_cb && item->cbdata == data) {
+               if (item->event_cb == event_cb && item->cbdata == data && (slot < 0 || item->slot == slot)) {
                        switch (item->state) {
                        case EVENT_STATE_ACTIVATE:
                        case EVENT_STATE_ACTIVATED:
@@ -1066,6 +1132,14 @@ HAPI int event_deactivate(int (*event_cb)(enum event_state state, struct event_d
 
        if (keep_thread) {
                DbgPrint("Keep thread\n");
+               listener->unset_done = 1;
+
+               /**
+                * @note
+                * This will invoke the event_read_cb callback with fake event data.
+                * At that time we should terminate this listener.
+                */
+               push_event_item();
                return WIDGET_ERROR_NONE;
        }
 
@@ -1102,7 +1176,7 @@ HAPI int event_is_activated(void)
        return s_info.handle >= 0;
 }
 
-HAPI void event_set_mouse_xy(int x, int y, double ratio_w, double ratio_h, double timestamp)
+HAPI void event_set_mouse_xy(int slot, int x, int y, double ratio_w, double ratio_h, double timestamp)
 {
        s_info.event_data.x = x;
        s_info.event_data.y = y;
@@ -1110,6 +1184,7 @@ HAPI void event_set_mouse_xy(int x, int y, double ratio_w, double ratio_h, doubl
        s_info.event_data.ratio_h = ratio_h;
        s_info.event_data.tv = timestamp;
        s_info.event_data.source = INPUT_EVENT_SOURCE_VIEWER;
+       s_info.event_data.slot = slot;
        /**
         * Don't touch the timestamp_updated variable.
         * if we toggle it, the input thread will not be terminated correctly. SEE LINE: 537
index b7e5047..7a390fe 100644 (file)
@@ -40,6 +40,7 @@
 #include <widget_service.h>
 #include <widget_service_internal.h>
 #include <widget_conf.h>
+#include <widget_util.h>
 #include <widget_abi.h>
 
 #include <com-core_packet.h>
@@ -76,6 +77,8 @@
 FILE *__file_log_fp;
 #endif
 
+#define WIDGET_STATIC_LOCK_PATH "/opt/usr/share/live_magazine/.widget.lck"
+
 static inline int app_create(void)
 {
        int ret;
@@ -397,6 +400,7 @@ int main(int argc, char *argv[])
                (void)util_unlink_files(WIDGET_CONF_READER_PATH);
                (void)util_unlink_files(WIDGET_CONF_IMAGE_PATH);
                (void)util_unlink_files(WIDGET_CONF_LOG_PATH);
+               (void)util_unlink_files(WIDGET_STATIC_LOCK_PATH);
        }
 
        util_setup_log_disk();
@@ -405,7 +409,7 @@ int main(int argc, char *argv[])
         * How could we care this return values?
         * Is there any way to print something on the screen?
         */
-       ret = critical_log_init(util_basename(argv[0]));
+       ret = critical_log_init(widget_util_basename(argv[0]));
        if (ret < 0) {
                ErrPrint("Failed to init the critical log\n");
        }
index 6ce128d..a444914 100644 (file)
@@ -111,7 +111,7 @@ HAPI int monitor_destroy_client(struct monitor_client *monitor)
        }
 
        if (cnt == 0) {
-               dead_callback_del(handle, monitor_disconnected_cb);
+               dead_callback_del(handle, monitor_disconnected_cb, NULL);
                ErrPrint("Registered monitor object is not valid\n");
        }
 
index 998c311..e064d22 100644 (file)
@@ -1773,15 +1773,16 @@ HAPI char *package_meta_tag(const char *appid, const char *meta_tag)
                return NULL;
        }
 
-/**
- * This is not supported from Tizen 3.0 yet.
- *
+       /**
+        * @TODO
+        * Need to find replacement of this API
+        *
        status = pkgmgrinfo_appinfo_get_metadata_value(handle, meta_tag, &value);
        if (status != PMINFO_R_OK) {
                pkgmgrinfo_appinfo_destroy_appinfo(handle);
                return NULL;
        }
-*/
+       */
 
        if (value && value[0] != '\0') {
                ret = strdup(value);
index 4aec836..aa82041 100644 (file)
@@ -158,6 +158,7 @@ struct script_info {
        int x;
        int y;
        int down;
+       int device;
 
        unsigned int keycode;
 
@@ -1058,7 +1059,7 @@ HAPI int script_fini(void)
        return 0;
 }
 
-HAPI int script_handler_update_pointer(struct script_info *info, int x, int y, int down)
+HAPI int script_handler_update_pointer(struct script_info *info, int device, int x, int y, int down)
 {
        if (!info) {
                return WIDGET_ERROR_NONE;
@@ -1066,6 +1067,7 @@ HAPI int script_handler_update_pointer(struct script_info *info, int x, int y, i
 
        info->x = x;
        info->y = y;
+       info->device = device;
 
        if (down == 0) {
                info->down = 0;
@@ -1096,6 +1098,10 @@ HAPI int script_handler_feed_event(struct script_info *info, int event, double t
                return WIDGET_ERROR_INVALID_PARAMETER;
        }
 
+       /**
+        * @todo
+        * Feeds device info to the script loader.
+        */
        ret = info->port->feed_event(info->port_data, event, info->x, info->y, info->down, info->keycode, timestamp);
        return ret;
 }
index 6047a78..b8916e6 100644 (file)
@@ -204,15 +204,21 @@ static char *is_valid_slave(pid_t pid, const char *abi, const char *provider_pkg
                return converted_provider_pkgname;
        }
 
+       if (!provider_pkgname) {
+               DbgPrint("provider_pkgname is NULL (%s)\n", pid_pkgname);
+               return NULL;
+       }
+
        if (!strcmp(abi_pkgname, pid_pkgname)) {
                /*!
                 * This request is comes from predefined service provider.
                 * In this case, we should believe its request.
                 */
+               DbgPrint("Provider pkgname[%s]\n", provider_pkgname);
                return strdup(provider_pkgname);
        } else if (WIDGET_CONF_DEBUG_MODE || g_conf.debug_mode) {
                DbgPrint("Debug mode is enabled, use the %s as a widget_id\n", provider_pkgname);
-               return provider_pkgname ? strdup(provider_pkgname) : NULL;
+               return strdup(provider_pkgname);
        }
 
        /*!
@@ -627,7 +633,7 @@ static int key_event_widget_route_cb(enum event_state state, struct event_data *
                return WIDGET_ERROR_INVALID_PARAMETER;
        }
 
-       packet = packet_create_noack((const char *)&cmd, "ssdi", package_name(pkg), instance_id(inst), event_info->tv, event_info->keycode);
+       packet = packet_create_noack((const char *)&cmd, "ssdii", package_name(pkg), instance_id(inst), event_info->tv, event_info->keycode, event_info->slot);
        if (!packet) {
                return WIDGET_ERROR_FAULT;
        }
@@ -672,7 +678,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, "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);
+       packet = packet_create_noack((const char *)&cmd, "ssdiiiddi", 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, event_info->slot);
        if (!packet) {
                return WIDGET_ERROR_FAULT;
        }
@@ -746,15 +752,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->ratio_w, event_info->y * event_info->ratio_h, 1);
+               script_handler_update_pointer(script, event_info->slot, 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->ratio_w, event_info->y * event_info->ratio_h, -1);
+               script_handler_update_pointer(script, event_info->slot, 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->ratio_w, event_info->y * event_info->ratio_h, 0);
+               script_handler_update_pointer(script, event_info->slot, 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:
@@ -846,7 +852,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, "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);
+       packet = packet_create_noack((const char *)&cmd, "ssdiiiddi", 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, event_info->slot);
        if (!packet) {
                return WIDGET_ERROR_FAULT;
        }
@@ -921,15 +927,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->ratio_w, event_info->y * event_info->ratio_h, 1);
+               script_handler_update_pointer(script, event_info->slot, 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->ratio_w, event_info->y * event_info->ratio_h, -1);
+               script_handler_update_pointer(script, event_info->slot, 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->ratio_w, event_info->y * event_info->ratio_h, 0);
+               script_handler_update_pointer(script, event_info->slot, 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:
@@ -1642,6 +1648,7 @@ static struct packet *client_gbar_mouse_enter(pid_t pid, int handle, const struc
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -1650,8 +1657,8 @@ static struct packet *client_gbar_mouse_enter(pid_t pid, int handle, const struc
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Invalid parameter\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -1673,7 +1680,7 @@ static struct packet *client_gbar_mouse_enter(pid_t pid, int handle, const struc
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_IN, timestamp);
                ret = 0;
        } else {
@@ -1700,6 +1707,7 @@ static struct packet *client_gbar_mouse_leave(pid_t pid, int handle, const struc
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -1708,8 +1716,8 @@ static struct packet *client_gbar_mouse_leave(pid_t pid, int handle, const struc
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -1731,7 +1739,7 @@ static struct packet *client_gbar_mouse_leave(pid_t pid, int handle, const struc
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OUT, timestamp);
                ret = 0;
        } else {
@@ -1758,6 +1766,7 @@ static struct packet *client_gbar_mouse_down(pid_t pid, int handle, const struct
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -1766,8 +1775,8 @@ static struct packet *client_gbar_mouse_down(pid_t pid, int handle, const struct
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -1789,7 +1798,7 @@ static struct packet *client_gbar_mouse_down(pid_t pid, int handle, const struct
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, 1);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, 1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_DOWN, timestamp);
                ret = 0;
        } else {
@@ -1816,6 +1825,7 @@ static struct packet *client_gbar_mouse_up(pid_t pid, int handle, const struct p
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -1824,8 +1834,8 @@ static struct packet *client_gbar_mouse_up(pid_t pid, int handle, const struct p
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -1847,7 +1857,7 @@ static struct packet *client_gbar_mouse_up(pid_t pid, int handle, const struct p
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, 0);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, 0);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_UP, timestamp);
                ret = 0;
        } else {
@@ -1874,6 +1884,7 @@ static struct packet *client_gbar_mouse_move(pid_t pid, int handle, const struct
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -1882,8 +1893,8 @@ static struct packet *client_gbar_mouse_move(pid_t pid, int handle, const struct
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -1905,7 +1916,7 @@ static struct packet *client_gbar_mouse_move(pid_t pid, int handle, const struct
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_MOVE, timestamp);
                ret = 0;
        } else {
@@ -1932,6 +1943,7 @@ static struct packet *client_widget_mouse_move(pid_t pid, int handle, const stru
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -1940,8 +1952,8 @@ static struct packet *client_widget_mouse_move(pid_t pid, int handle, const stru
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -1963,7 +1975,7 @@ static struct packet *client_widget_mouse_move(pid_t pid, int handle, const stru
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_MOVE, timestamp);
                ret = 0;
        } else {
@@ -1985,7 +1997,7 @@ static int inst_del_cb(struct inst_info *inst, void *data)
         * It will calls event callbacks.
         * And the event callbacks will try to access the "inst"
         */
-       (void)event_deactivate(data, inst);
+       (void)event_deactivate(-1, data, inst);
 
        /* Reset callback data to prevent accessing inst from event callback */
        ret = event_reset_cbdata(data, inst, NULL);
@@ -2009,6 +2021,7 @@ static struct packet *client_gbar_key_set(pid_t pid, int handle, const struct pa
        struct inst_info *inst;
        const struct pkg_info *pkg;
        struct packet *result;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2017,8 +2030,8 @@ static struct packet *client_gbar_key_set(pid_t pid, int handle, const struct pa
                goto out;
        }
 
-       ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
-       if (ret != 4) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &keycode, &device);
+       if (ret != 5) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2030,7 +2043,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, 1.0f, 1.0f, key_event_gbar_route_cb, inst);
+               ret = event_activate(device, 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);
@@ -2040,7 +2053,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, 1.0f, 1.0f, key_event_gbar_consume_cb, inst);
+               ret = event_activate(device, 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);
@@ -2074,6 +2087,7 @@ static struct packet *client_gbar_key_unset(pid_t pid, int handle, const struct
        struct inst_info *inst;
        const struct pkg_info *pkg;
        struct packet *result;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2082,8 +2096,8 @@ static struct packet *client_gbar_key_unset(pid_t pid, int handle, const struct
                goto out;
        }
 
-       ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
-       if (ret != 4) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &keycode, &device);
+       if (ret != 5) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2095,7 +2109,7 @@ static struct packet *client_gbar_key_unset(pid_t pid, int handle, const struct
        }
 
        if (package_widget_type(pkg) == WIDGET_TYPE_BUFFER) {
-               ret = event_deactivate(key_event_gbar_route_cb, inst);
+               ret = event_deactivate(device, key_event_gbar_route_cb, inst);
                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_OFF);
                }
@@ -2106,7 +2120,7 @@ static struct packet *client_gbar_key_unset(pid_t pid, int handle, const struct
                 }
                 */
        } else if (package_widget_type(pkg) == WIDGET_TYPE_SCRIPT) {
-               ret = event_deactivate(key_event_gbar_consume_cb, inst);
+               ret = event_deactivate(device, key_event_gbar_consume_cb, inst);
                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_OFF);
                }
@@ -2141,6 +2155,7 @@ static struct packet *client_widget_key_set(pid_t pid, int handle, const struct
        struct inst_info *inst;
        const struct pkg_info *pkg;
        struct packet *result;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2149,8 +2164,8 @@ static struct packet *client_widget_key_set(pid_t pid, int handle, const struct
                goto out;
        }
 
-       ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
-       if (ret != 4) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &keycode, &device);
+       if (ret != 5) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2162,7 +2177,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, 1.0f, 1.0f, key_event_widget_route_cb, inst);
+               ret = event_activate(device, 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);
@@ -2172,7 +2187,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, 1.0f, 1.0f, key_event_widget_consume_cb, inst);
+               ret = event_activate(device, 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);
@@ -2206,6 +2221,7 @@ static struct packet *client_widget_key_unset(pid_t pid, int handle, const struc
        struct inst_info *inst;
        const struct pkg_info *pkg;
        struct packet *result;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2214,8 +2230,8 @@ static struct packet *client_widget_key_unset(pid_t pid, int handle, const struc
                goto out;
        }
 
-       ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
-       if (ret != 4) {
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &keycode, &device);
+       if (ret != 5) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2227,7 +2243,7 @@ static struct packet *client_widget_key_unset(pid_t pid, int handle, const struc
        }
 
        if (package_widget_type(pkg) == WIDGET_TYPE_BUFFER) {
-               ret = event_deactivate(key_event_widget_route_cb, inst);
+               ret = event_deactivate(device, key_event_widget_route_cb, inst);
                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_OFF);
                }
@@ -2238,7 +2254,7 @@ static struct packet *client_widget_key_unset(pid_t pid, int handle, const struc
                 }
                 */
        } else if (package_widget_type(pkg) == WIDGET_TYPE_SCRIPT) {
-               ret = event_deactivate(key_event_widget_consume_cb, inst);
+               ret = event_deactivate(device, key_event_widget_consume_cb, inst);
                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_OFF);
                }
@@ -2276,6 +2292,7 @@ static struct packet *client_widget_mouse_set(pid_t pid, int handle, const struc
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2284,8 +2301,8 @@ static struct packet *client_widget_mouse_set(pid_t pid, int handle, const struc
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2298,7 +2315,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, ratio_w, ratio_h, mouse_event_widget_route_cb, inst);
+                       ret = event_activate(device, 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);
@@ -2321,7 +2338,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, ratio_w, ratio_h, mouse_event_widget_consume_cb, inst);
+               ret = event_activate(device, 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);
@@ -2352,6 +2369,7 @@ static struct packet *client_widget_mouse_unset(pid_t pid, int handle, const str
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2360,8 +2378,8 @@ static struct packet *client_widget_mouse_unset(pid_t pid, int handle, const str
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2375,9 +2393,9 @@ 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, ratio_w, ratio_h, timestamp);
+                       event_set_mouse_xy(device, x, y, ratio_w, ratio_h, timestamp);
 
-                       ret = event_deactivate(mouse_event_widget_route_cb, inst);
+                       ret = event_deactivate(device, mouse_event_widget_route_cb, inst);
                        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_OFF);
                        }
@@ -2402,9 +2420,9 @@ 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, ratio_w, ratio_h, timestamp);
+               event_set_mouse_xy(device, x, y, ratio_w, ratio_h, timestamp);
 
-               ret = event_deactivate(mouse_event_widget_consume_cb, inst);
+               ret = event_deactivate(device, mouse_event_widget_consume_cb, inst);
                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_OFF);
                }
@@ -2436,6 +2454,7 @@ static struct packet *client_gbar_mouse_set(pid_t pid, int handle, const struct
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2444,8 +2463,8 @@ static struct packet *client_gbar_mouse_set(pid_t pid, int handle, const struct
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2458,7 +2477,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, ratio_w, ratio_h, mouse_event_gbar_route_cb, inst);
+                       ret = event_activate(device, 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);
@@ -2481,7 +2500,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, ratio_w, ratio_h, mouse_event_gbar_consume_cb, inst);
+               ret = event_activate(device, 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);
@@ -2513,6 +2532,7 @@ static struct packet *client_widget_mouse_on_scroll(pid_t pid, int handle, const
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2521,8 +2541,8 @@ static struct packet *client_widget_mouse_on_scroll(pid_t pid, int handle, const
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2544,7 +2564,7 @@ static struct packet *client_widget_mouse_on_scroll(pid_t pid, int handle, const
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_ON_SCROLL, timestamp);
                ret = 0;
        } else {
@@ -2571,6 +2591,7 @@ static struct packet *client_widget_mouse_off_scroll(pid_t pid, int handle, cons
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2579,8 +2600,8 @@ static struct packet *client_widget_mouse_off_scroll(pid_t pid, int handle, cons
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2602,7 +2623,7 @@ static struct packet *client_widget_mouse_off_scroll(pid_t pid, int handle, cons
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OFF_SCROLL, timestamp);
                ret = 0;
        } else {
@@ -2629,6 +2650,7 @@ static struct packet *client_widget_mouse_on_hold(pid_t pid, int handle, const s
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2637,8 +2659,8 @@ static struct packet *client_widget_mouse_on_hold(pid_t pid, int handle, const s
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2660,7 +2682,7 @@ static struct packet *client_widget_mouse_on_hold(pid_t pid, int handle, const s
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_ON_HOLD, timestamp);
                ret = 0;
        } else {
@@ -2687,6 +2709,7 @@ static struct packet *client_widget_mouse_off_hold(pid_t pid, int handle, const
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2695,8 +2718,8 @@ static struct packet *client_widget_mouse_off_hold(pid_t pid, int handle, const
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2718,7 +2741,7 @@ static struct packet *client_widget_mouse_off_hold(pid_t pid, int handle, const
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OFF_HOLD, timestamp);
                ret = 0;
        } else {
@@ -2745,6 +2768,7 @@ static struct packet *client_gbar_mouse_on_scroll(pid_t pid, int handle, const s
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2753,8 +2777,8 @@ static struct packet *client_gbar_mouse_on_scroll(pid_t pid, int handle, const s
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2776,7 +2800,7 @@ static struct packet *client_gbar_mouse_on_scroll(pid_t pid, int handle, const s
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_ON_SCROLL, timestamp);
                ret = 0;
        } else {
@@ -2803,6 +2827,7 @@ static struct packet *client_gbar_mouse_off_scroll(pid_t pid, int handle, const
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2811,8 +2836,8 @@ static struct packet *client_gbar_mouse_off_scroll(pid_t pid, int handle, const
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2834,7 +2859,7 @@ static struct packet *client_gbar_mouse_off_scroll(pid_t pid, int handle, const
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OFF_SCROLL, timestamp);
                ret = 0;
        } else {
@@ -2861,6 +2886,7 @@ static struct packet *client_gbar_mouse_on_hold(pid_t pid, int handle, const str
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2869,8 +2895,8 @@ static struct packet *client_gbar_mouse_on_hold(pid_t pid, int handle, const str
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2892,7 +2918,7 @@ static struct packet *client_gbar_mouse_on_hold(pid_t pid, int handle, const str
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_ON_HOLD, timestamp);
                ret = 0;
        } else {
@@ -2919,6 +2945,7 @@ static struct packet *client_gbar_mouse_off_hold(pid_t pid, int handle, const st
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2927,8 +2954,8 @@ static struct packet *client_gbar_mouse_off_hold(pid_t pid, int handle, const st
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -2950,7 +2977,7 @@ static struct packet *client_gbar_mouse_off_hold(pid_t pid, int handle, const st
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OFF_HOLD, timestamp);
                ret = 0;
        } else {
@@ -2977,6 +3004,7 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -2985,8 +3013,8 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -3000,9 +3028,9 @@ 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, ratio_w, ratio_h, timestamp);
+                       event_set_mouse_xy(device, x, y, ratio_w, ratio_h, timestamp);
 
-                       ret = event_deactivate(mouse_event_gbar_route_cb, inst);
+                       ret = event_deactivate(device, mouse_event_gbar_route_cb, inst);
                        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_OFF);
                        }
@@ -3027,9 +3055,9 @@ 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, ratio_w, ratio_h, timestamp);
+               event_set_mouse_xy(device, x, y, ratio_w, ratio_h, timestamp);
 
-               ret = event_deactivate(mouse_event_gbar_consume_cb, inst);
+               ret = event_deactivate(device, mouse_event_gbar_consume_cb, inst);
                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_OFF);
                }
@@ -3061,6 +3089,7 @@ static struct packet *client_widget_mouse_enter(pid_t pid, int handle, const str
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -3069,8 +3098,8 @@ static struct packet *client_widget_mouse_enter(pid_t pid, int handle, const str
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -3092,7 +3121,7 @@ static struct packet *client_widget_mouse_enter(pid_t pid, int handle, const str
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_IN, timestamp);
                ret = 0;
        } else {
@@ -3119,6 +3148,7 @@ static struct packet *client_widget_mouse_leave(pid_t pid, int handle, const str
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -3127,8 +3157,8 @@ static struct packet *client_widget_mouse_leave(pid_t pid, int handle, const str
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -3150,7 +3180,7 @@ static struct packet *client_widget_mouse_leave(pid_t pid, int handle, const str
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OUT, timestamp);
                ret = 0;
        } else {
@@ -3177,6 +3207,7 @@ static struct packet *client_widget_mouse_down(pid_t pid, int handle, const stru
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -3185,8 +3216,8 @@ static struct packet *client_widget_mouse_down(pid_t pid, int handle, const stru
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -3208,7 +3239,7 @@ static struct packet *client_widget_mouse_down(pid_t pid, int handle, const stru
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, 1);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, 1);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_DOWN, timestamp);
                ret = 0;
        } else {
@@ -3235,6 +3266,7 @@ static struct packet *client_widget_mouse_up(pid_t pid, int handle, const struct
        int source;
        double ratio_w;
        double ratio_h;
+       int device;
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
@@ -3243,8 +3275,8 @@ static struct packet *client_widget_mouse_up(pid_t pid, int handle, const struct
                goto out;
        }
 
-       ret = packet_get(packet, "ssdiiidd", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h);
-       if (ret != 8) {
+       ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, &timestamp, &x, &y, &source, &ratio_w, &ratio_h, &device);
+       if (ret != 9) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -3266,7 +3298,7 @@ static struct packet *client_widget_mouse_up(pid_t pid, int handle, const struct
                        goto out;
                }
 
-               script_handler_update_pointer(script, x * ratio_w, y * ratio_h, 0);
+               script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, 0);
                script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_UP, timestamp);
                ret = 0;
        } else {
@@ -3321,7 +3353,7 @@ static struct packet *client_gbar_access_action(pid_t pid, int handle, const str
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_ACTION, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -3382,7 +3414,7 @@ static struct packet *client_gbar_access_scroll(pid_t pid, int handle, const str
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_SCROLL, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -3443,7 +3475,7 @@ static struct packet *client_gbar_access_value_change(pid_t pid, int handle, con
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_VALUE_CHANGE, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -3504,7 +3536,7 @@ static struct packet *client_gbar_access_mouse(pid_t pid, int handle, const stru
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_MOUSE, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -3565,7 +3597,7 @@ static struct packet *client_gbar_access_back(pid_t pid, int handle, const struc
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_BACK, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -3626,7 +3658,7 @@ static struct packet *client_gbar_access_over(pid_t pid, int handle, const struc
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_OVER, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -3687,7 +3719,7 @@ static struct packet *client_gbar_access_read(pid_t pid, int handle, const struc
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_READ, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -3751,7 +3783,7 @@ static struct packet *client_gbar_access_enable(pid_t pid, int handle, const str
 
                type = (event.type == 0) ? WIDGET_SCRIPT_ACCESS_DISABLE : WIDGET_SCRIPT_ACCESS_ENABLE;
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, type, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -3831,7 +3863,7 @@ static struct packet *client_gbar_access_hl(pid_t pid, int handle, const struct
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, type, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -3892,7 +3924,7 @@ static struct packet *client_gbar_access_activate(pid_t pid, int handle, const s
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_ACTIVATE, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -4319,7 +4351,7 @@ static struct packet *client_widget_access_hl(pid_t pid, int handle, const struc
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, type, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -4386,7 +4418,7 @@ static struct packet *client_widget_access_action(pid_t pid, int handle, const s
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_ACTION, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -4453,7 +4485,7 @@ static struct packet *client_widget_access_scroll(pid_t pid, int handle, const s
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_SCROLL, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -4520,7 +4552,7 @@ static struct packet *client_widget_access_value_change(pid_t pid, int handle, c
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_VALUE_CHANGE, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -4587,7 +4619,7 @@ static struct packet *client_widget_access_mouse(pid_t pid, int handle, const st
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_MOUSE, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -4654,7 +4686,7 @@ static struct packet *client_widget_access_back(pid_t pid, int handle, const str
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_BACK, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -4721,7 +4753,7 @@ static struct packet *client_widget_access_over(pid_t pid, int handle, const str
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_OVER, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -4788,7 +4820,7 @@ static struct packet *client_widget_access_read(pid_t pid, int handle, const str
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_READ, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -4858,7 +4890,7 @@ static struct packet *client_widget_access_enable(pid_t pid, int handle, const s
 
                type = (event.type == 0) ? WIDGET_SCRIPT_ACCESS_DISABLE : WIDGET_SCRIPT_ACCESS_ENABLE;
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, type, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -4920,7 +4952,7 @@ static struct packet *client_widget_access_activate(pid_t pid, int handle, const
                        goto out;
                }
 
-               script_handler_update_pointer(script, event.x, event.y, event.type);
+               script_handler_update_pointer(script, 0, event.x, event.y, event.type);
                ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_ACTIVATE, timestamp);
                if (ret >= 0) {
                        ret = send_delayed_access_status(inst, ret);
@@ -5719,7 +5751,7 @@ static struct packet *client_gbar_move(pid_t pid, int handle, const struct packe
                instance_slave_set_gbar_pos(inst, x, y);
                ix = x * instance_gbar_width(inst);
                iy = y * instance_gbar_height(inst);
-               script_handler_update_pointer(instance_gbar_script(inst), ix, iy, 0);
+               script_handler_update_pointer(instance_gbar_script(inst), 0, ix, iy, 0);
                ret = instance_signal_emit(inst, "pd,move", instance_id(inst), 0.0, 0.0, 0.0, 0.0, x, y, 0);
        } else {
                ErrPrint("Invalid GBAR type\n");
@@ -5930,7 +5962,7 @@ static struct packet *client_create_gbar(pid_t pid, int handle, const struct pac
                ix = x * instance_gbar_width(inst);
                iy = y * instance_gbar_height(inst);
 
-               script_handler_update_pointer(instance_gbar_script(inst), ix, iy, 0);
+               script_handler_update_pointer(instance_gbar_script(inst), 0, ix, iy, 0);
 
                ret = instance_slave_open_gbar(inst, client);
                if (ret == (int)WIDGET_ERROR_NONE) {
@@ -8310,7 +8342,7 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe
 
                        handle = item->handle;
 
-                       if (dead_callback_del(handle, delete_ctx_cb) != item) {
+                       if (dead_callback_del(handle, delete_ctx_cb, item) != item) {
                                ErrPrint("Dead callback is not valid\n");
                        }
 
@@ -8528,9 +8560,10 @@ static struct packet *service_get_content(pid_t pid, int handle, const struct pa
                return NULL;
        }
 
-       if (is_valid_service_requestor(pid, widget_id)) {
+       if (is_valid_service_requestor(pid, widget_id) == 0) {
                ErrPrint("Invalid service requestor: %d %s\n", pid, widget_id);
-               return NULL;
+               result = packet_create_reply(packet, "is", WIDGET_ERROR_PERMISSION_DENIED, "?");
+               return result;
        }
 
        inst = package_find_instance_by_id(widget_id, inst_id);
@@ -8560,7 +8593,8 @@ static struct packet *service_get_inst_list(pid_t pid, int handle, const struct
 
        if (is_valid_service_requestor(pid, widget_id) == 0) {
                ErrPrint("Invalid requestor: %d %s\n", pid, widget_id);
-               return NULL;
+               result = packet_create_reply(packet, "iis", WIDGET_ERROR_PERMISSION_DENIED, 0, NULL);
+               return result;
        }
 
        pkg = package_find(widget_id);
@@ -9138,6 +9172,57 @@ out:
 
 static struct packet *widget_mgr_slave_ctrl(pid_t pid, int handle, const struct packet *packet)
 {
+       char *pkgname;
+       char *id;
+       int cmd;
+       int value;
+       int packet_cmd;
+       struct widget_mgr *mgr;
+       struct inst_info *inst;
+       struct pkg_info *info;
+       struct packet *ctrl_packet;
+
+       if (packet_get(packet, "ssii", &pkgname, &id, &cmd, &value) != 4) {
+               ErrPrint("Invalid argument\n");
+               goto out;
+       }
+
+       mgr = widget_mgr_find_by_pid(pid);
+       if (!mgr) {
+               ErrPrint("Invalid request\n");
+               goto out;
+       }
+
+       switch (cmd) {
+       case WIDGET_CTRL_MODE_DUMP_FRAME:
+               inst = package_find_instance_by_id(pkgname, id);
+               if (!inst) {
+                       ErrPrint("Instance not found: %s\n", id);
+                       goto out;
+               }
+
+               info = instance_package(inst);
+               if (!info) {
+                       ErrPrint("Unable to get pkginfo\n");
+                       goto out;
+               }
+
+               packet_cmd = CMD_CTRL_MODE;
+               ctrl_packet = packet_create_noack((const char *)&packet_cmd, "ssii", pkgname, id, cmd, value);
+               if (ctrl_packet) {
+                       if (slave_rpc_request_only(package_slave(info), package_name(info), ctrl_packet, 0) < 0) {
+                               ErrPrint("Failed to send request\n");
+                       }
+               }
+
+               DbgPrint("Dump frames: %d\n", value);
+               break;
+       default:
+               ErrPrint("Unknown command\n");
+               break;
+       }
+
+out:
        return NULL;
 }
 
index e400bd6..9284afa 100644 (file)
@@ -235,7 +235,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 (!slave->extra_bundle_data && ((!no_timer && !slave->secured) || slave_is_app(slave)) && WIDGET_CONF_SLAVE_TERMINATE_TIME > 0.0f) {
+       } else if (!slave->extra_bundle_data && ((!no_timer && !slave->secured) || slave_is_app(slave)) && (!slave_is_watch(slave) && WIDGET_CONF_SLAVE_TERMINATE_TIME > 0.0f)) {
                DbgPrint("Fire the terminate timer: %d (%d)\n", slave->pid, slave_is_app(slave));
                slave->terminate_timer = ecore_timer_add(WIDGET_CONF_SLAVE_TERMINATE_TIME, terminate_timer_cb, slave);
                if (!slave->terminate_timer) {
@@ -260,9 +260,14 @@ static struct slave_node *slave_deactivate(struct slave_node *slave, int no_time
                        }
                }
        } else {
-               /*!
-                * \todo
+               /**
+                * @todo
                 * check the return value of the aul_terminate_pid
+                *
+                * @note
+                * In case of the watch,
+                * There is no waiting timer for termination.
+                * Because the watch application cannot be re-used for new instance.
                 */
                slave->state = SLAVE_REQUEST_TO_TERMINATE;
 
@@ -786,7 +791,7 @@ static Eina_Bool relaunch_timer_cb(void *data)
                        bundle_free(param);
 
                        switch (slave->pid) {
-//                     case AUL_R_EHIDDENFORGUEST:     /**< App hidden for guest mode */
+                       case AUL_R_EHIDDENFORGUEST:     /**< App hidden for guest mode */
                        case AUL_R_ENOLAUNCHPAD:        /**< no launchpad */
                        case AUL_R_EILLACC:             /**< Illegal Access */
                        case AUL_R_EINVAL:              /**< Invalid argument */
@@ -806,7 +811,7 @@ static Eina_Bool relaunch_timer_cb(void *data)
                        case AUL_R_ECOMM:               /**< Comunication Error */
                        case AUL_R_ETERMINATING:        /**< application terminating */
                        case AUL_R_ECANCELED:           /**< Operation canceled */
-//                     case AUL_R_EREJECTED:
+                       case AUL_R_EREJECTED:
                                slave->relaunch_count--;
 
                                CRITICAL_LOG("Try relaunch again %s (%d), %d\n", slave_name(slave), slave->pid, slave->relaunch_count);
@@ -895,7 +900,7 @@ HAPI int slave_activate(struct slave_node *slave)
                bundle_free(param);
 
                switch (slave->pid) {
-//             case AUL_R_EHIDDENFORGUEST:     /**< App hidden for guest mode */
+               case AUL_R_EHIDDENFORGUEST:     /**< App hidden for guest mode */
                case AUL_R_ENOLAUNCHPAD:        /**< no launchpad */
                case AUL_R_EILLACC:             /**< Illegal Access */
                case AUL_R_EINVAL:              /**< Invalid argument */
@@ -909,7 +914,7 @@ HAPI int slave_activate(struct slave_node *slave)
                case AUL_R_ETERMINATING:        /**< application terminating */
                case AUL_R_ECANCELED:           /**< Operation canceled */
                case AUL_R_ETIMEOUT:            /**< Timeout */
-//             case AUL_R_EREJECTED:
+               case AUL_R_EREJECTED:
                        CRITICAL_LOG("Try relaunch this soon %s (%d)\n", slave_name(slave), slave->pid);
                        slave->relaunch_timer = ecore_timer_add(WIDGET_CONF_SLAVE_RELAUNCH_TIME, relaunch_timer_cb, slave);
                        if (!slave->relaunch_timer) {
index 49960cc..66211b8 100644 (file)
@@ -133,19 +133,6 @@ HAPI char *util_slavename(void)
        return strdup(slavename);
 }
 
-HAPI const char *util_basename(const char *name)
-{
-       int length;
-       length = name ? strlen(name) : 0;
-       if (!length) {
-               return ".";
-       }
-
-       while (--length > 0 && name[length] != '/');
-
-       return length <= 0 ? name : (name + length + (name[length] == '/'));
-}
-
 /*!
  * Return size of stroage in Bytes unit.
  */
@@ -316,14 +303,12 @@ HAPI void util_setup_log_disk(void)
                        ErrPrint("chown: %d\n", errno);
                }
 
-               if (!!DATA_SHARE_LABEL) {
-                       ret = smack_setlabel(WIDGET_CONF_LOG_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS);
-                       if (ret != 0) {
-                               ErrPrint("Failed to set SMACK for %s (%d)\n", WIDGET_CONF_LOG_PATH, ret);
-                       } else {
-                               ret = smack_setlabel(WIDGET_CONF_LOG_PATH, "1", SMACK_LABEL_TRANSMUTE);
-                               DbgPrint("[%s] is successfully created (t: %d)\n", WIDGET_CONF_LOG_PATH, ret);
-                       }
+               ret = smack_setlabel(WIDGET_CONF_LOG_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS);
+               if (ret != 0) {
+                       ErrPrint("Failed to set SMACK for %s (%d)\n", WIDGET_CONF_LOG_PATH, ret);
+               } else {
+                       ret = smack_setlabel(WIDGET_CONF_LOG_PATH, "1", SMACK_LABEL_TRANSMUTE);
+                       DbgPrint("[%s] is successfully created (t: %d)\n", WIDGET_CONF_LOG_PATH, ret);
                }
        }
 }
index f66053c..e893eab 100644 (file)
@@ -220,7 +220,7 @@ static int launch_svc(struct service_context *svc_ctx)
 
        pid = aul_launch_app(SVC_PKG, NULL);
        switch (pid) {
-//     case AUL_R_EHIDDENFORGUEST:     /**< App hidden for guest mode */
+       case AUL_R_EHIDDENFORGUEST:     /**< App hidden for guest mode */
        case AUL_R_ENOLAUNCHPAD:        /**< no launchpad */
        case AUL_R_EILLACC:             /**< Illegal Access */
        case AUL_R_EINVAL:              /**< Invalid argument */
index 948b861..5168ccc 100644 (file)
@@ -1136,6 +1136,63 @@ static void do_get_list(const char *cmd)
        }
 }
 
+static int do_frame_dump(const char *cmd)
+{
+       struct instance *info;
+       struct packet *packet;
+       struct node *parent;
+       char widget_id[256];
+       int value;
+       int ret;
+
+       cmd = trim_cmd(cmd + strlen("frame_dump"));
+       if (!*cmd) {
+               return -EINVAL;
+       }
+
+       if (s_info.cmd != NOP) {
+               printf("Waiting the server response\n");
+               return -EBUSY;
+       }
+
+       if (sscanf(cmd, "%[^ ] %d", widget_id, &value) != 2) {
+               printf("Error[%s]\n", cmd);
+               return -EINVAL;
+       }
+
+       s_info.targetdir = update_target_dir(widget_id);
+       if (!s_info.targetdir) {
+               printf("%s is not exists\n", cmd);
+               return -ENOENT;
+       }
+
+       if (!(node_mode(s_info.targetdir) & NODE_WRITE)) {
+               printf("Access denied %s\n", cmd);
+               return -EACCES;
+       }
+
+       parent = node_parent(s_info.targetdir);
+       if (!parent) {
+               printf("Invalid folder: %s\n", cmd);
+               return -EFAULT;
+       }
+
+       info = node_data(s_info.targetdir);
+       printf("WidgetId: %s\n", info->id);
+       packet = packet_create_noack("slave_ctrl", "ssii", node_name(parent), info->id, WIDGET_CTRL_MODE_DUMP_FRAME, !!value);
+       ret = com_core_packet_send_only(s_info.fd, packet);
+       packet_destroy(packet);
+       if (ret < 0) {
+               printf("Failed to send a packet: %d\n", ret);
+               return ret;
+       }
+
+       printf("Dump frame %s (%s)\n", cmd, node_name(parent));
+       s_info.age++;
+
+       return 0;
+}
+
 static void do_get_content(const char *cmd)
 {
        char widget_id[256];
@@ -1438,6 +1495,8 @@ static void do_command(const char *cmd)
                        do_get_content(cmd);
                } else if (!strncasecmp(cmd, "get_list", strlen("get_list"))) {
                        do_get_list(cmd);
+               } else if (!strncasecmp(cmd, "frame_dump", strlen("frame_dump"))) {
+                       do_frame_dump(cmd);
                } else {
                        help();
                }