summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-03-19 10:27:55 +0000
committerSung-jae Park <nicesj.park@samsung.com>2013-03-19 10:27:55 +0000
commitcad147280c73d923e12d24ac890710e6a9b608cf (patch)
tree38bbaa01fe294a8b48945f81eaf24821ba468c16
parentb581c8e8c13b4bf3216f9b763d82b53b5045b1a7 (diff)
downloadprovider-cad147280c73d923e12d24ac890710e6a9b608cf.tar.gz
provider-cad147280c73d923e12d24ac890710e6a9b608cf.tar.bz2
provider-cad147280c73d923e12d24ac890710e6a9b608cf.zip
Replace float value with integer value.
Reduce the cost of IPC. Change-Id: Ie92037b02247c542fb848ea4e466b2b83ac1ab2b
-rw-r--r--packaging/libprovider.spec2
-rw-r--r--src/provider_buffer.c281
2 files changed, 184 insertions, 99 deletions
diff --git a/packaging/libprovider.spec b/packaging/libprovider.spec
index 81db16e..2c743ad 100644
--- a/packaging/libprovider.spec
+++ b/packaging/libprovider.spec
@@ -1,6 +1,6 @@
Name: libprovider
Summary: Library for developing the livebox service provider.
-Version: 0.5.18
+Version: 0.6.0
Release: 1
Group: framework/livebox
License: Flora License
diff --git a/src/provider_buffer.c b/src/provider_buffer.c
index 94e0d34..dd5a8dc 100644
--- a/src/provider_buffer.c
+++ b/src/provider_buffer.c
@@ -490,14 +490,12 @@ struct packet *provider_buffer_lb_key_down(pid_t pid, int handle, const struct p
{
const char *pkgname;
const char *id;
- int w;
- int h;
- double x;
- double y;
+ int x;
+ int y;
double timestamp;
struct livebox_buffer *info;
- if (packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y) != 7) {
+ if (packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y) != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
@@ -508,8 +506,17 @@ struct packet *provider_buffer_lb_key_down(pid_t pid, int handle, const struct p
goto out;
}
- if (info->handler)
- (void)info->handler(info, BUFFER_EVENT_KEY_DOWN, timestamp, x, y, info->data);
+ if (info->handler) {
+ int w;
+ int h;
+
+ if (provider_buffer_get_size(info, &w, &h, NULL) < 0) {
+ ErrPrint("Failed to get buffer size [%s:%s]\n", pkgname, id);
+ goto out;
+ }
+
+ (void)info->handler(info, BUFFER_EVENT_KEY_DOWN, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+ }
out:
return NULL;
@@ -519,14 +526,12 @@ struct packet *provider_buffer_lb_key_up(pid_t pid, int handle, const struct pac
{
const char *pkgname;
const char *id;
- int w;
- int h;
- double x;
- double y;
+ int x;
+ int y;
double timestamp;
struct livebox_buffer *info;
- if (packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y) != 7) {
+ if (packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y) != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
@@ -537,8 +542,17 @@ struct packet *provider_buffer_lb_key_up(pid_t pid, int handle, const struct pac
goto out;
}
- if (info->handler)
- (void)info->handler(info, BUFFER_EVENT_KEY_UP, timestamp, x, y, info->data);
+ if (info->handler) {
+ int w;
+ int h;
+
+ if (provider_buffer_get_size(info, &w, &h, NULL) < 0) {
+ ErrPrint("Failed to get buffer size [%s:%s]\n", pkgname, id);
+ goto out;
+ }
+
+ (void)info->handler(info, BUFFER_EVENT_KEY_UP, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+ }
out:
return NULL;
@@ -548,14 +562,12 @@ struct packet *provider_buffer_lb_mouse_enter(pid_t pid, int handle, const struc
{
const char *pkgname;
const char *id;
- int w;
- int h;
- double x;
- double y;
+ int x;
+ int y;
double timestamp;
struct livebox_buffer *info;
- if (packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y) != 7) {
+ if (packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y) != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
@@ -566,8 +578,16 @@ struct packet *provider_buffer_lb_mouse_enter(pid_t pid, int handle, const struc
goto out;
}
- if (info->handler)
- (void)info->handler(info, BUFFER_EVENT_ENTER, timestamp, x, y, info->data);
+ if (info->handler) {
+ int w;
+ int h;
+ if (provider_buffer_get_size(info, &w, &h, NULL) < 0) {
+ ErrPrint("Failed to get buffer size [%s:%s]\n", pkgname, id);
+ goto out;
+ }
+
+ (void)info->handler(info, BUFFER_EVENT_ENTER, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+ }
out:
return NULL;
@@ -577,14 +597,12 @@ struct packet *provider_buffer_lb_mouse_leave(pid_t pid, int handle, const struc
{
const char *pkgname;
const char *id;
- int w;
- int h;
- double x;
- double y;
+ int x;
+ int y;
double timestamp;
struct livebox_buffer *info;
- if (packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y) != 7) {
+ if (packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y) != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
@@ -595,8 +613,16 @@ struct packet *provider_buffer_lb_mouse_leave(pid_t pid, int handle, const struc
goto out;
}
- if (info->handler)
- (void)info->handler(info, BUFFER_EVENT_LEAVE, timestamp, x, y, info->data);
+ if (info->handler) {
+ int w;
+ int h;
+ if (provider_buffer_get_size(info, &w, &h, NULL) < 0) {
+ ErrPrint("Failed to get buffer size [%s:%s]\n", pkgname, id);
+ goto out;
+ }
+
+ (void)info->handler(info, BUFFER_EVENT_LEAVE, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+ }
out:
return NULL;
@@ -606,14 +632,12 @@ struct packet *provider_buffer_lb_mouse_down(pid_t pid, int handle, const struct
{
const char *pkgname;
const char *id;
- int w;
- int h;
- double x;
- double y;
+ int x;
+ int y;
double timestamp;
struct livebox_buffer *info;
- if (packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y) != 7) {
+ if (packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y) != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
@@ -624,8 +648,16 @@ struct packet *provider_buffer_lb_mouse_down(pid_t pid, int handle, const struct
goto out;
}
- if (info->handler)
- (void)info->handler(info, BUFFER_EVENT_DOWN, timestamp, x, y, info->data);
+ if (info->handler) {
+ int w;
+ int h;
+ if (provider_buffer_get_size(info, &w, &h, NULL) < 0) {
+ ErrPrint("Failed to get buffer size [%s:%s]\n", pkgname, id);
+ goto out;
+ }
+
+ (void)info->handler(info, BUFFER_EVENT_DOWN, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+ }
out:
return NULL;
@@ -635,14 +667,12 @@ struct packet *provider_buffer_lb_mouse_up(pid_t pid, int handle, const struct p
{
const char *pkgname;
const char *id;
- int w;
- int h;
- double x;
- double y;
+ int x;
+ int y;
double timestamp;
struct livebox_buffer *info;
- if (packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y) != 7) {
+ if (packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y) != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
@@ -653,8 +683,16 @@ struct packet *provider_buffer_lb_mouse_up(pid_t pid, int handle, const struct p
goto out;
}
- if (info->handler)
- (void)info->handler(info, BUFFER_EVENT_UP, timestamp, x, y, info->data);
+ if (info->handler) {
+ int w;
+ int h;
+ if (provider_buffer_get_size(info, &w, &h, NULL) < 0) {
+ ErrPrint("Failed to get buffer size [%s:%s]\n", pkgname, id);
+ goto out;
+ }
+
+ (void)info->handler(info, BUFFER_EVENT_UP, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+ }
out:
return NULL;
@@ -664,14 +702,12 @@ struct packet *provider_buffer_lb_mouse_move(pid_t pid, int handle, const struct
{
const char *pkgname;
const char *id;
- int w;
- int h;
- double x;
- double y;
+ int x;
+ int y;
double timestamp;
struct livebox_buffer *info;
- if (packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y) != 7) {
+ if (packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y) != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
@@ -682,8 +718,15 @@ struct packet *provider_buffer_lb_mouse_move(pid_t pid, int handle, const struct
goto out;
}
- if (info->handler)
- (void)info->handler(info, BUFFER_EVENT_MOVE, timestamp, x, y, info->data);
+ if (info->handler) {
+ int w;
+ int h;
+ if (provider_buffer_get_size(info, &w, &h, NULL) < 0) {
+ ErrPrint("Failed to get buffer size [%s:%s]\n", pkgname, id);
+ goto out;
+ }
+ (void)info->handler(info, BUFFER_EVENT_MOVE, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+ }
out:
return NULL;
@@ -693,14 +736,12 @@ struct packet *provider_buffer_pd_key_down(pid_t pid, int handle, const struct p
{
const char *pkgname;
const char *id;
- int w;
- int h;
- double x;
- double y;
+ int x;
+ int y;
double timestamp;
struct livebox_buffer *info;
- if (packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y) != 7) {
+ if (packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y) != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
@@ -711,8 +752,16 @@ struct packet *provider_buffer_pd_key_down(pid_t pid, int handle, const struct p
goto out;
}
- if (info->handler)
- (void)info->handler(info, BUFFER_EVENT_KEY_DOWN, timestamp, x, y, info->data);
+ if (info->handler) {
+ int w;
+ int h;
+ if (provider_buffer_get_size(info, &w, &h, NULL) < 0) {
+ ErrPrint("Failed to get buffer size [%s:%s]\n", pkgname, id);
+ goto out;
+ }
+
+ (void)info->handler(info, BUFFER_EVENT_KEY_DOWN, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+ }
out:
return NULL;
@@ -722,14 +771,12 @@ struct packet *provider_buffer_pd_key_up(pid_t pid, int handle, const struct pac
{
const char *pkgname;
const char *id;
- int w;
- int h;
- double x;
- double y;
+ int x;
+ int y;
double timestamp;
struct livebox_buffer *info;
- if (packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y) != 7) {
+ if (packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y) != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
@@ -740,8 +787,16 @@ struct packet *provider_buffer_pd_key_up(pid_t pid, int handle, const struct pac
goto out;
}
- if (info->handler)
- (void)info->handler(info, BUFFER_EVENT_KEY_UP, timestamp, x, y, info->data);
+ if (info->handler) {
+ int w;
+ int h;
+ if (provider_buffer_get_size(info, &w, &h, NULL) < 0) {
+ ErrPrint("Failed to get buffer size [%s:%s]\n", pkgname, id);
+ goto out;
+ }
+
+ (void)info->handler(info, BUFFER_EVENT_KEY_UP, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+ }
out:
return NULL;
@@ -751,14 +806,12 @@ struct packet *provider_buffer_pd_mouse_enter(pid_t pid, int handle, const struc
{
const char *pkgname;
const char *id;
- int w;
- int h;
- double x;
- double y;
+ int x;
+ int y;
double timestamp;
struct livebox_buffer *info;
- if (packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y) != 7) {
+ if (packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y) != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
@@ -769,8 +822,16 @@ struct packet *provider_buffer_pd_mouse_enter(pid_t pid, int handle, const struc
goto out;
}
- if (info->handler)
- (void)info->handler(info, BUFFER_EVENT_ENTER, timestamp, x, y, info->data);
+ if (info->handler) {
+ int w;
+ int h;
+ if (provider_buffer_get_size(info, &w, &h, NULL) < 0) {
+ ErrPrint("Failed to get buffer size [%s:%s]\n", pkgname, id);
+ goto out;
+ }
+
+ (void)info->handler(info, BUFFER_EVENT_ENTER, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+ }
out:
return NULL;
@@ -780,14 +841,12 @@ struct packet *provider_buffer_pd_mouse_leave(pid_t pid, int handle, const struc
{
const char *pkgname;
const char *id;
- int w;
- int h;
- double x;
- double y;
+ int x;
+ int y;
double timestamp;
struct livebox_buffer *info;
- if (packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y) != 7) {
+ if (packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y) != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
@@ -798,8 +857,16 @@ struct packet *provider_buffer_pd_mouse_leave(pid_t pid, int handle, const struc
goto out;
}
- if (info->handler)
- (void)info->handler(info, BUFFER_EVENT_LEAVE, timestamp, x, y, info->data);
+ if (info->handler) {
+ int w;
+ int h;
+ if (provider_buffer_get_size(info, &w, &h, NULL) < 0) {
+ ErrPrint("Failed to get buffer size [%s:%s]\n", pkgname, id);
+ goto out;
+ }
+
+ (void)info->handler(info, BUFFER_EVENT_LEAVE, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+ }
out:
return NULL;
@@ -809,14 +876,12 @@ struct packet *provider_buffer_pd_mouse_down(pid_t pid, int handle, const struct
{
const char *pkgname;
const char *id;
- int w;
- int h;
- double x;
- double y;
+ int x;
+ int y;
double timestamp;
struct livebox_buffer *info;
- if (packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y) != 7) {
+ if (packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y) != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
@@ -827,8 +892,16 @@ struct packet *provider_buffer_pd_mouse_down(pid_t pid, int handle, const struct
goto out;
}
- if (info->handler)
- (void)info->handler(info, BUFFER_EVENT_DOWN, timestamp, x, y, info->data);
+ if (info->handler) {
+ int w;
+ int h;
+ if (provider_buffer_get_size(info, &w, &h, NULL) < 0) {
+ ErrPrint("Failed to get buffer size [%s:%s]\n", pkgname, id);
+ goto out;
+ }
+
+ (void)info->handler(info, BUFFER_EVENT_DOWN, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+ }
out:
return NULL;
@@ -838,14 +911,12 @@ struct packet *provider_buffer_pd_mouse_up(pid_t pid, int handle, const struct p
{
const char *pkgname;
const char *id;
- int w;
- int h;
- double x;
- double y;
+ int x;
+ int y;
double timestamp;
struct livebox_buffer *info;
- if (packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y) != 7) {
+ if (packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y) != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
@@ -856,8 +927,16 @@ struct packet *provider_buffer_pd_mouse_up(pid_t pid, int handle, const struct p
goto out;
}
- if (info->handler)
- (void)info->handler(info, BUFFER_EVENT_UP, timestamp, x, y, info->data);
+ if (info->handler) {
+ int w;
+ int h;
+ if (provider_buffer_get_size(info, &w, &h, NULL) < 0) {
+ ErrPrint("Failed to get buffer size [%s:%s]\n", pkgname, id);
+ goto out;
+ }
+
+ (void)info->handler(info, BUFFER_EVENT_UP, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+ }
out:
return NULL;
@@ -867,14 +946,12 @@ struct packet *provider_buffer_pd_mouse_move(pid_t pid, int handle, const struct
{
const char *pkgname;
const char *id;
- int w;
- int h;
- double x;
- double y;
+ int x;
+ int y;
double timestamp;
struct livebox_buffer *info;
- if (packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y) != 7) {
+ if (packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y) != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
@@ -885,8 +962,16 @@ struct packet *provider_buffer_pd_mouse_move(pid_t pid, int handle, const struct
goto out;
}
- if (info->handler)
- (void)info->handler(info, BUFFER_EVENT_MOVE, timestamp, x, y, info->data);
+ if (info->handler) {
+ int w;
+ int h;
+ if (provider_buffer_get_size(info, &w, &h, NULL) < 0) {
+ ErrPrint("Failed to get buffer size [%s:%s]\n", pkgname, id);
+ goto out;
+ }
+
+ (void)info->handler(info, BUFFER_EVENT_MOVE, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+ }
out:
return NULL;