summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-08-14 06:12:00 (GMT)
committerSung-jae Park <nicesj.park@samsung.com>2013-08-16 13:22:06 (GMT)
commitfbcc1e96bf03893a86a702df8cbc6a741a639645 (patch)
treec263bc74d62cbb278b685f7be3c4fb1acbed464a
parent07e1a4de0b701aa94a82f4876d2e69e096980c87 (diff)
downloaddata-provider-master-fbcc1e96bf03893a86a702df8cbc6a741a639645.zip
data-provider-master-fbcc1e96bf03893a86a702df8cbc6a741a639645.tar.gz
data-provider-master-fbcc1e96bf03893a86a702df8cbc6a741a639645.tar.bz2
Fix i586 build error
Change-Id: I010ec831337c2673aee84c6f09406b85015c75f9
-rw-r--r--include/event.h17
-rw-r--r--packaging/data-provider-master.spec2
-rw-r--r--src/event.c316
-rw-r--r--src/file_service.c1
-rw-r--r--src/main.c59
-rw-r--r--src/server.c42
-rw-r--r--src/service_common.c14
-rw-r--r--src/shortcut_service.c2
-rw-r--r--src/utility_service.c2
9 files changed, 346 insertions, 109 deletions
diff --git a/include/event.h b/include/event.h
index 3d095b2..5d554d0 100644
--- a/include/event.h
+++ b/include/event.h
@@ -18,18 +18,31 @@ struct event_data {
int x;
int y;
int device;
+ int slot;
+ struct {
+ int major;
+ int minor;
+ } touch;
+ struct {
+ int major;
+ int minor;
+ } width;
+ int distance; /* Hovering */
+ struct timeval tv;
};
enum event_state {
+ EVENT_STATE_DEACTIVATED,
EVENT_STATE_ACTIVATE,
EVENT_STATE_ACTIVATED,
- EVENT_STATE_DEACTIVATE
+ EVENT_STATE_DEACTIVATE,
+ EVENT_STATE_ERROR
};
extern int event_init(void);
extern int event_fini(void);
extern int event_activate(int x, int y, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data);
-extern int event_deactivate(void);
+extern int event_deactivate(int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data);
extern int event_is_activated(void);
/* End of a file */
diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec
index 686a902..b7728d6 100644
--- a/packaging/data-provider-master.spec
+++ b/packaging/data-provider-master.spec
@@ -1,6 +1,6 @@
Name: data-provider-master
Summary: Master service provider for liveboxes.
-Version: 0.25.5
+Version: 0.25.6
Release: 1
Group: HomeTF/Livebox
License: Flora License
diff --git a/src/event.c b/src/event.c
index 19d19a7..f891e35 100644
--- a/src/event.c
+++ b/src/event.c
@@ -38,6 +38,14 @@
#define EVENT_CH 'e'
+#if !defined(ABS_MT_TOOL_X)
+#define ABS_MT_TOOL_X 0x3c /* Center X tool position */
+#endif
+
+#if !defined(ABS_MT_TOOL_Y)
+#define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */
+#endif
+
int errno;
static struct info {
@@ -49,31 +57,39 @@ static struct info {
int tcb_pipe[PIPE_MAX];
Ecore_Fd_Handler *event_handler;
- int (*event_cb)(enum event_state state, struct event_data *event, void *data);
- void *cbdata;
-
- enum event_state event_state;
struct event_data event_data;
- int x;
- int y;
+ Eina_List *event_listener_list;
+ Eina_List *reactivate_list;
} s_info = {
.event_list = NULL,
.handle = -1,
.event_handler = NULL,
- .event_cb = NULL,
- .cbdata = NULL,
-
- .event_state = EVENT_STATE_DEACTIVATE,
-
.event_data = {
- .x = 0,
- .y = 0,
+ .x = -1,
+ .y = -1,
.device = -1,
+ .slot = -1,
},
+
+ .event_listener_list = NULL,
+ .reactivate_list = NULL,
};
+struct event_listener {
+ int (*event_cb)(enum event_state state, struct event_data *event, void *data);
+ void *cbdata;
+
+ enum event_state state;
+
+ struct timeval tv; /* Recording Activate / Deactivate time */
+ int x; /* RelX */
+ int y; /* RelY */
+};
+
+static int activate_thread(void);
+
HAPI int event_init(void)
{
int ret;
@@ -102,6 +118,10 @@ static inline int processing_input_event(struct input_event *event)
switch (event->type) {
case EV_SYN:
switch (event->code) {
+ break;
+ case SYN_CONFIG:
+ break;
+ case SYN_MT_REPORT:
case SYN_REPORT:
if (s_info.event_data.x < 0 || s_info.event_data.y < 0) {
/* Waiting full event packet */
@@ -110,7 +130,11 @@ static inline int processing_input_event(struct input_event *event)
item = malloc(sizeof(*item));
if (item) {
- char event_ch;
+ char event_ch = EVENT_CH;
+
+ if (gettimeofday(&s_info.event_data.tv, NULL) < 0) {
+ ErrPrint("gettimeofday: %s\n", strerror(errno));
+ }
memcpy(item, &s_info.event_data, sizeof(*item));
@@ -118,7 +142,6 @@ static inline int processing_input_event(struct input_event *event)
s_info.event_list = eina_list_append(s_info.event_list, item);
CRITICAL_SECTION_END(&s_info.event_list_lock);
- event_ch = EVENT_CH;
if (write(s_info.evt_pipe[PIPE_WRITE], &event_ch, sizeof(event_ch)) != sizeof(event_ch)) {
ErrPrint("Unable to send an event: %s\n", strerror(errno));
return LB_STATUS_ERROR_IO;
@@ -126,11 +149,14 @@ static inline int processing_input_event(struct input_event *event)
/* Take a breathe */
pthread_yield();
+ } else {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+
+ if (s_info.event_data.device < 0) {
+ s_info.event_data.x = -1;
+ s_info.event_data.y = -1;
}
- break;
- case SYN_CONFIG:
- break;
- case SYN_MT_REPORT:
break;
/*
case SYN_DROPPED:
@@ -149,25 +175,34 @@ static inline int processing_input_event(struct input_event *event)
case EV_ABS:
switch (event->code) {
case ABS_DISTANCE:
+ s_info.event_data.distance = event->value;
+ break;
+ case ABS_MT_TOOL_X:
+ case ABS_MT_TOOL_Y:
break;
case ABS_MT_POSITION_X:
- s_info.event_data.x = event->value - s_info.x;
+ s_info.event_data.x = event->value;
break;
case ABS_MT_POSITION_Y:
- s_info.event_data.y = event->value - s_info.y;
+ s_info.event_data.y = event->value;
break;
case ABS_MT_SLOT:
+ s_info.event_data.slot = event->value;
break;
case ABS_MT_TRACKING_ID:
s_info.event_data.device = event->value;
break;
case ABS_MT_TOUCH_MAJOR:
+ s_info.event_data.touch.major = event->value;
break;
case ABS_MT_TOUCH_MINOR:
+ s_info.event_data.touch.minor = event->value;
break;
case ABS_MT_WIDTH_MAJOR:
+ s_info.event_data.width.major = event->value;
break;
case ABS_MT_WIDTH_MINOR:
+ s_info.event_data.width.minor = event->value;
break;
default:
DbgPrint("EV_ABS, 0x%x\n", event->code);
@@ -264,11 +299,59 @@ static void *event_thread_main(void *data)
return (void *)ret;
}
+static inline void clear_all_listener_list(void)
+{
+ struct event_listener *listener;
+ enum event_state next_state;
+ Eina_List *l;
+ Eina_List *n;
+
+ s_info.event_handler = NULL;
+ CLOSE_PIPE(s_info.evt_pipe);
+
+ while (s_info.event_listener_list) {
+ EINA_LIST_FOREACH_SAFE(s_info.event_listener_list, l, n, listener) {
+ switch (listener->state) {
+ case EVENT_STATE_ACTIVATE:
+ next_state = EVENT_STATE_ACTIVATED;
+ break;
+ case EVENT_STATE_ACTIVATED:
+ next_state = EVENT_STATE_DEACTIVATE;
+ break;
+ case EVENT_STATE_DEACTIVATE:
+ 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);
+ free(listener);
+ continue;
+ }
+
+ if (listener->event_cb(listener->state, &s_info.event_data, listener->cbdata) < 0) {
+ if (eina_list_data_find(s_info.event_listener_list, listener)) {
+ s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
+ free(listener);
+ continue;
+ }
+ }
+
+ listener->state = next_state;
+ }
+ }
+}
+
static Eina_Bool event_read_cb(void *data, Ecore_Fd_Handler *handler)
{
int fd;
struct event_data *item;
char event_ch;
+ struct event_listener *listener;
+ Eina_List *l;
+ Eina_List *n;
+ enum event_state next_state;
+ enum event_state cur_state;
+ struct event_data modified_item;
fd = ecore_main_fd_handler_fd_get(handler);
if (fd < 0) {
@@ -290,37 +373,87 @@ static Eina_Bool event_read_cb(void *data, Ecore_Fd_Handler *handler)
}
CRITICAL_SECTION_END(&s_info.event_list_lock);
- if (item && s_info.event_cb) {
- switch (s_info.event_state) {
- case EVENT_STATE_DEACTIVATE:
- s_info.event_state = EVENT_STATE_ACTIVATE;
- break;
+ EINA_LIST_FOREACH_SAFE(s_info.event_listener_list, l, n, listener) {
+ switch (listener->state) {
case EVENT_STATE_ACTIVATE:
- s_info.event_state = EVENT_STATE_ACTIVATED;
+ if (timercmp(&listener->tv, &item->tv, >)) {
+ /* Ignore previous events before activating this listener */
+ continue;
+ }
+
+ next_state = EVENT_STATE_ACTIVATED;
+ cur_state = listener->state;
+ break;
+ case EVENT_STATE_DEACTIVATE:
+ if (timercmp(&listener->tv, &item->tv, >)) {
+ /* Consuming all events occurred while activating this listener */
+ cur_state = EVENT_STATE_ACTIVATED;
+ next_state = EVENT_STATE_ACTIVATED;
+ break;
+ }
+
+ cur_state = listener->state;
+ next_state = EVENT_STATE_DEACTIVATED;
break;
case EVENT_STATE_ACTIVATED:
- default:
+ cur_state = listener->state;
+ next_state = listener->state;
break;
+ case EVENT_STATE_DEACTIVATED:
+ default:
+ /* Remove this from the list */
+ /* Check the item again. the listener can be deleted from the callback */
+ if (eina_list_data_find(s_info.event_listener_list, listener)) {
+ s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
+ free(listener);
+ }
+
+ continue;
+ }
+
+ memcpy(&modified_item, item, sizeof(modified_item));
+ modified_item.x -= listener->x;
+ modified_item.y -= listener->y;
+
+ if (listener->event_cb(cur_state, &modified_item, listener->cbdata) < 0) {
+ if (eina_list_data_find(s_info.event_listener_list, listener)) {
+ s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
+ free(listener);
+ continue;
+ }
}
- s_info.event_cb(s_info.event_state, item, s_info.cbdata);
+
+ listener->state = next_state;
}
free(item);
+
+ if (s_info.handle < 0 && !s_info.event_list) {
+ /* This callback must has to clear all listeners in this case */
+ clear_all_listener_list();
+
+ EINA_LIST_FREE(s_info.reactivate_list, listener) {
+ s_info.event_listener_list = eina_list_append(s_info.event_listener_list, listener);
+ }
+
+ if (s_info.event_listener_list) {
+ if (activate_thread() < 0) {
+ EINA_LIST_FREE(s_info.event_listener_list, listener) {
+ (void)listener->event_cb(EVENT_STATE_ERROR, NULL, listener->cbdata);
+ }
+ }
+ }
+
+ return ECORE_CALLBACK_CANCEL;
+ }
+
return ECORE_CALLBACK_RENEW;
}
-/*!
- * x, y is the starting point.
- */
-HAPI int event_activate(int x, int y, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data)
+static int activate_thread(void)
{
int status;
- if (s_info.handle >= 0) {
- DbgPrint("Already activated\n");
- return LB_STATUS_SUCCESS;
- }
-
s_info.handle = open(INPUT_PATH, O_RDONLY);
if (s_info.handle < 0) {
ErrPrint("Unable to access the device: %s\n", strerror(errno));
@@ -384,27 +517,95 @@ HAPI int event_activate(int x, int y, int (*event_cb)(enum event_state state, st
return LB_STATUS_ERROR_FAULT;
}
- s_info.event_cb = event_cb;
- s_info.cbdata = data;
- s_info.x = x;
- s_info.y = y;
-
DbgPrint("Event handler activated\n");
return LB_STATUS_SUCCESS;
}
-HAPI int event_deactivate(void)
+/*!
+ * x, y is the starting point.
+ */
+HAPI int event_activate(int x, int y, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data)
+{
+ struct event_listener *listener;
+ int ret = LB_STATUS_SUCCESS;
+
+ listener = malloc(sizeof(*listener));
+ if (!listener) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return LB_STATUS_ERROR_MEMORY;
+ }
+
+ if (gettimeofday(&listener->tv, NULL) < 0) {
+ ErrPrint("gettimeofday: %s\n", strerror(errno));
+ free(listener);
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ listener->event_cb = event_cb;
+ listener->cbdata = data;
+ listener->state = EVENT_STATE_ACTIVATE;
+ listener->x = x;
+ listener->y = y;
+
+ if (s_info.handle < 0) {
+ /*!
+ * \note
+ * We don't need to lock to access event_list here.
+ * If the _sinfo.handle is greater than 0, the event_list will not be touched.
+ * But if the s_info.handle is less than 0, it means, there is not thread,
+ * so we can access the event_list without lock.
+ */
+ if (s_info.event_list) {
+ DbgPrint("Event thread is deactivating now. activating will be delayed\n");
+ s_info.reactivate_list = eina_list_append(s_info.reactivate_list, listener);
+ } else {
+ s_info.event_listener_list = eina_list_append(s_info.event_listener_list, listener);
+
+ if ((ret = activate_thread()) < 0) {
+ s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
+ free(listener);
+ }
+ }
+ } else {
+ s_info.event_listener_list = eina_list_append(s_info.event_listener_list, listener);
+ }
+
+ return ret;
+}
+
+HAPI int event_deactivate(int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data)
{
int status;
- struct event_data *event;
void *ret;
char event_ch = EVENT_CH;
+ struct event_listener *listener = NULL;
+ Eina_List *l;
+ int keep_thread = 0;
+
+ EINA_LIST_FOREACH(s_info.event_listener_list, l, listener) {
+ if (listener->event_cb == event_cb && listener->cbdata == data) {
+ listener->state = EVENT_STATE_DEACTIVATE;
+ }
+
+ keep_thread += (listener->state == EVENT_STATE_ACTIVATE || listener->state == EVENT_STATE_ACTIVATED);
+ }
+
+ if (!listener) {
+ ErrPrint("Listener is not registered\n");
+ return LB_STATUS_ERROR_NOT_EXIST;
+ }
if (s_info.handle < 0) {
ErrPrint("Event handler is not actiavated\n");
+ free(listener);
+ return LB_STATUS_SUCCESS;
+ }
+
+ if (keep_thread) {
return LB_STATUS_SUCCESS;
}
+ /* Terminating thread */
if (write(s_info.tcb_pipe[PIPE_WRITE], &event_ch, sizeof(event_ch)) != sizeof(event_ch)) {
ErrPrint("Unable to write tcb_pipe: %s\n", strerror(errno));
}
@@ -416,9 +617,6 @@ HAPI int event_deactivate(void)
DbgPrint("Thread returns: %d\n", (int)ret);
}
- ecore_main_fd_handler_del(s_info.event_handler);
- s_info.event_handler = NULL;
-
if (close(s_info.handle) < 0) {
ErrPrint("Unable to release the fd: %s\n", strerror(errno));
}
@@ -427,26 +625,10 @@ HAPI int event_deactivate(void)
DbgPrint("Event handler deactivated\n");
CLOSE_PIPE(s_info.tcb_pipe);
- CLOSE_PIPE(s_info.evt_pipe);
- EINA_LIST_FREE(s_info.event_list, event) {
- if (s_info.event_cb) {
- if (s_info.event_state == EVENT_STATE_DEACTIVATE) {
- s_info.event_state = EVENT_STATE_ACTIVATE;
- } else if (s_info.event_state == EVENT_STATE_ACTIVATE) {
- s_info.event_state = EVENT_STATE_ACTIVATED;
- }
- s_info.event_cb(s_info.event_state, event, s_info.cbdata);
- }
- free(event);
- }
-
- if (s_info.event_state != EVENT_STATE_DEACTIVATE) {
- s_info.event_state = EVENT_STATE_DEACTIVATE;
-
- if (s_info.event_cb) {
- s_info.event_cb(s_info.event_state, &s_info.event_data, s_info.cbdata);
- }
+ if (!eina_list_count(s_info.event_list)) {
+ ecore_main_fd_handler_del(s_info.event_handler);
+ clear_all_listener_list();
}
s_info.event_data.x = -1;
diff --git a/src/file_service.c b/src/file_service.c
index 69ea1c4..b866120 100644
--- a/src/file_service.c
+++ b/src/file_service.c
@@ -39,7 +39,6 @@
#include "buffer_handler.h"
#define FILE_SERVICE_ADDR "remote://:8209"
-#define FILE_PUSH_ADDR "remote://:8210"
#define PUSH_EXIT 'e'
#define PUSH_ITEM 'i'
diff --git a/src/main.c b/src/main.c
index 4aae8be..78450ad 100644
--- a/src/main.c
+++ b/src/main.c
@@ -62,6 +62,59 @@
FILE *__file_log_fp;
#endif
+static int input_event_cb(enum event_state state, struct event_data *event, void *data)
+{
+ static int valid = 0;
+ static int pid = -1;
+
+ if (event->device > 0) {
+ if (event->x > 30) {
+ valid = 2;
+ } else if (valid == 0) {
+ valid = 1;
+ }
+ }
+
+ if (state == EVENT_STATE_DEACTIVATE || event->device == -1) {
+ bundle *param;
+
+ if (valid == 1) {
+ param = bundle_create();
+ if (param) {
+ char coord[16];
+ snprintf(coord, sizeof(coord), "%dx%d", event->x, event->y);
+ bundle_add(param, "coordinate", coord);
+ }
+
+ pid = aul_launch_app("com.samsung.assistant-menu", param);
+ DbgPrint("Launch Pie Menu: %d\n", pid);
+
+ if (param) {
+ bundle_free(param);
+ }
+ } else if (valid == 2) {
+ int ret;
+ char pkgname[256];
+ ret = aul_app_get_appid_bypid(pid, pkgname, sizeof(pkgname) - 1);
+ if (ret == 0) {
+ if (!strcmp(pkgname, "com.samsung.assistant-menu")) {
+ param = bundle_create();
+ if (param) {
+ bundle_add(param, "request", "terminate");
+ pid = aul_launch_app("com.samsung.assistant-menu", param);
+ bundle_free(param);
+ DbgPrint("Request is sent: %d\n", pid);
+ }
+ }
+ }
+ }
+
+ valid = 0;
+ }
+
+ return 0;
+}
+
static inline int app_create(void)
{
int ret;
@@ -129,6 +182,9 @@ static inline int app_create(void)
file_service_init();
+ ret = event_activate(0, 0, input_event_cb, NULL);
+ DbgPrint("event activate: %d\n", ret);
+
return 0;
}
@@ -136,6 +192,9 @@ static inline int app_terminate(void)
{
int ret;
+ ret = event_deactivate(input_event_cb, NULL);
+ DbgPrint("Deactivate event: %d\n", ret);
+
ret = file_service_fini();
DbgPrint("Finalize the file service: %d\n", ret);
diff --git a/src/server.c b/src/server.c
index 617498d..e81e8bf 100644
--- a/src/server.c
+++ b/src/server.c
@@ -1457,7 +1457,7 @@ out:
static int inst_del_cb(struct inst_info *inst, void *data)
{
- (void)event_deactivate();
+ (void)event_deactivate(data, inst);
return -1; /* Delete this callback */
}
@@ -1493,26 +1493,14 @@ static struct packet *client_lb_mouse_set(pid_t pid, int handle, const struct pa
}
if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
- if (event_is_activated()) {
- if (event_deactivate() == 0) {
- instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb);
- }
- }
-
ret = event_activate(x, y, event_lb_route_cb, inst);
if (ret == 0) {
- instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, NULL);
+ instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, event_lb_route_cb);
}
} else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
- if (event_is_activated()) {
- if (event_deactivate() == 0) {
- instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb);
- }
- }
-
ret = event_activate(x, y, event_lb_consume_cb, inst);
if (ret == 0) {
- instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, NULL);
+ instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, event_lb_consume_cb);
}
} else {
ErrPrint("Unsupported package\n");
@@ -1554,12 +1542,12 @@ static struct packet *client_lb_mouse_unset(pid_t pid, int handle, const struct
}
if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
- ret = event_deactivate();
+ ret = event_deactivate(event_lb_route_cb, inst);
if (ret == 0) {
instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb);
}
} else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
- ret = event_deactivate();
+ ret = event_deactivate(event_lb_consume_cb, inst);
if (ret == 0) {
instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb);
}
@@ -1603,26 +1591,14 @@ static struct packet *client_pd_mouse_set(pid_t pid, int handle, const struct pa
}
if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
- if (event_is_activated()) {
- if (event_deactivate() == 0) {
- instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb);
- }
- }
-
ret = event_activate(x, y, event_pd_route_cb, inst);
if (ret == 0) {
- instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, NULL);
+ instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, event_pd_route_cb);
}
} else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
- if (event_is_activated()) {
- if (event_deactivate() == 0) {
- instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb);
- }
- }
-
ret = event_activate(x, y, event_pd_consume_cb, inst);
if (ret == 0) {
- instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, NULL);
+ instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, event_pd_consume_cb);
}
} else {
ErrPrint("Unsupported package\n");
@@ -1665,12 +1641,12 @@ static struct packet *client_pd_mouse_unset(pid_t pid, int handle, const struct
}
if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
- ret = event_deactivate();
+ ret = event_deactivate(event_pd_route_cb, inst);
if (ret == 0) {
instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb);
}
} else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
- ret = event_deactivate();
+ ret = event_deactivate(event_pd_consume_cb, inst);
if (ret == 0) {
instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb);
}
diff --git a/src/service_common.c b/src/service_common.c
index 13cf05e..0396191 100644
--- a/src/service_common.c
+++ b/src/service_common.c
@@ -708,8 +708,17 @@ HAPI struct service_context *service_common_create(const char *addr, int (*servi
return NULL;
}
- if (unlink(addr) < 0) {
- ErrPrint("[%s] - %s\n", addr, strerror(errno));
+ if (strncmp(addr, COM_CORE_REMOTE_SCHEME, strlen(COM_CORE_REMOTE_SCHEME))) {
+ int offset = 0;
+
+ offset = strlen(COM_CORE_LOCAL_SCHEME);
+ if (strncmp(addr, COM_CORE_LOCAL_SCHEME, offset)) {
+ offset = 0;
+ }
+
+ if (unlink(addr + offset) < 0) {
+ ErrPrint("[%s] - %s\n", addr, strerror(errno));
+ }
}
svc_ctx = calloc(1, sizeof(*svc_ctx));
@@ -779,7 +788,6 @@ HAPI struct service_context *service_common_create(const char *addr, int (*servi
* \note
* To give a chance to run for server thread.
*/
- DbgPrint("Yield\n");
pthread_yield();
return svc_ctx;
diff --git a/src/shortcut_service.c b/src/shortcut_service.c
index 620798e..d043f9c 100644
--- a/src/shortcut_service.c
+++ b/src/shortcut_service.c
@@ -90,7 +90,7 @@ static inline struct tcb *get_reply_context(double seq)
return tcb;
}
-static inline void send_reply_packet(struct tcb *tcb, struct packet *packet, int ret)
+static void send_reply_packet(struct tcb *tcb, struct packet *packet, int ret)
{
struct packet *reply_packet;
diff --git a/src/utility_service.c b/src/utility_service.c
index c21f7cd..d64b40d 100644
--- a/src/utility_service.c
+++ b/src/utility_service.c
@@ -74,7 +74,7 @@ struct context {
static int lazy_launcher_cb(struct service_context *svc_ctx, void *data);
-static inline int put_reply_tcb(struct tcb *tcb, double seq)
+static int put_reply_tcb(struct tcb *tcb, double seq)
{
struct context *ctx;