diff options
author | Sung-jae Park <nicesj.park@samsung.com> | 2013-04-30 21:49:39 +0900 |
---|---|---|
committer | Sung-jae Park <nicesj.park@samsung.com> | 2013-04-30 21:49:39 +0900 |
commit | f20397df8ff2df632b8b3598e33c1e4db30412cc (patch) | |
tree | 49ee6cbe748c9e3113dd72e6558b544524cdfa24 | |
parent | 932ea53a6efa1ee11e27c87a9c95c04975d99cb0 (diff) | |
download | provider-f20397df8ff2df632b8b3598e33c1e4db30412cc.tar.gz provider-f20397df8ff2df632b8b3598e33c1e4db30412cc.tar.bz2 provider-f20397df8ff2df632b8b3598e33c1e4db30412cc.zip |
Apply various patches
Patch 3/3
Update License
Patch 2/3
Update accessibility event handler.
Patch 1/3
Change the accessibility event handling codes.
Now the accessibility events are also handles by provider_buffer event handler.
Every accessibility events will be feed via buffer_event_handler.
Change-Id: I685c795ef847c9a4611a3f000094b25e353efe1e
Change-Id: Ib46a40997c598232f0e56102f880b8161691e37c
-rw-r--r-- | LICENSE | 26 | ||||
-rw-r--r-- | include/debug.h | 2 | ||||
-rw-r--r-- | include/dlist.h | 2 | ||||
-rw-r--r-- | include/fb.h | 2 | ||||
-rw-r--r-- | include/provider.h | 41 | ||||
-rw-r--r-- | include/provider_buffer.h | 53 | ||||
-rw-r--r-- | include/provider_buffer_internal.h | 2 | ||||
-rw-r--r-- | include/util.h | 2 | ||||
-rw-r--r-- | packaging/libprovider.spec | 2 | ||||
-rw-r--r-- | src/dlist.c | 2 | ||||
-rw-r--r-- | src/fb.c | 2 | ||||
-rw-r--r-- | src/provider.c | 501 | ||||
-rw-r--r-- | src/provider_buffer.c | 803 | ||||
-rw-r--r-- | src/util.c | 2 |
14 files changed, 908 insertions, 534 deletions
@@ -1,6 +1,6 @@ Flora License -Version 1.0, April, 2013 +Version 1.1, April, 2013 http://floralicense.org/license/ @@ -119,17 +119,17 @@ Object form, provided that You meet the following conditions: Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only - and do not modify the License. - -You may add Your own attribution notices within Derivative Works -that You distribute, alongside or as an addendum to the NOTICE text -from the Work, provided that such additional attribution notices -cannot be construed as modifying the License. You may add Your own -copyright statement to Your modifications and may provide additional or -different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works -as a whole, provided Your use, reproduction, and distribution of -the Work otherwise complies with the conditions stated in this License. + and do not modify the License. You may add Your own attribution notices + within Derivative Works that You distribute, alongside or as an addendum + to the NOTICE text from the Work, provided that such additional attribution + notices cannot be construed as modifying the License. You may add Your own + copyright statement to Your modifications and may provide additional or + different license terms and conditions for use, reproduction, or + distribution of Your modifications, or for any such Derivative Works + as a whole, provided Your use, reproduction, and distribution of + the Work otherwise complies with the conditions stated in this License + and your own copyright statement or terms and conditions do not conflict + the conditions stated in the License including section 3. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work @@ -192,7 +192,7 @@ identification within third-party archives. Copyright [yyyy] [name of copyright owner] - Licensed under the Flora License, Version 1.0 (the "License"); + Licensed under the Flora License, Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/include/debug.h b/include/debug.h index 64b5ff0..dc79d19 100644 --- a/include/debug.h +++ b/include/debug.h @@ -1,7 +1,7 @@ /* * Copyright 2013 Samsung Electronics Co., Ltd * - * Licensed under the Flora License, Version 1.0 (the "License"); + * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * diff --git a/include/dlist.h b/include/dlist.h index 99e8443..cd1a421 100644 --- a/include/dlist.h +++ b/include/dlist.h @@ -1,7 +1,7 @@ /* * Copyright 2013 Samsung Electronics Co., Ltd * - * Licensed under the Flora License, Version 1.0 (the "License"); + * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * diff --git a/include/fb.h b/include/fb.h index d22fd90..adc3efa 100644 --- a/include/fb.h +++ b/include/fb.h @@ -1,7 +1,7 @@ /* * Copyright 2013 Samsung Electronics Co., Ltd * - * Licensed under the Flora License, Version 1.0 (the "License"); + * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * diff --git a/include/provider.h b/include/provider.h index aa0437e..4f6b378 100644 --- a/include/provider.h +++ b/include/provider.h @@ -1,7 +1,7 @@ /* * Copyright 2013 Samsung Electronics Co., Ltd * - * Licensed under the Flora License, Version 1.0 (the "License"); + * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * @@ -39,22 +39,6 @@ struct event_info { } part; }; -enum access_event { - ACCESS_HIGHLIGHT, - ACCESS_HIGHLIGHT_NEXT, - ACCESS_HIGHLIGHT_PREV, - ACCESS_ACTIVATE, - ACCESS_VALUE_CHANGE, - ACCESS_SCROLL, - ACCESS_UNHIGHLIGHT, -}; - -enum access_mouse_state { - ACCESS_MOUSE_DOWN = 0, - ACCESS_MOUSE_MOVE = 1, - ACCESS_MOUSE_UP = 2, -}; - struct event_arg { enum { EVENT_NEW, /*!< Master will send this to create a new livebox instance */ @@ -207,22 +191,6 @@ struct event_arg { } lb_resume; struct { - /*!< Accessibility */ - enum access_event event; - int x; - int y; - int mouse_state; - } lb_access; - - struct { - /*!< Accessibility */ - enum access_event event; - int x; - int y; - int mouse_state; - } pd_access; - - struct { int active_update; } update_mode; } info; @@ -261,13 +229,6 @@ struct event_handler { int (*pd_destroy)(struct event_arg *arg, void *data); int (*pd_move)(struct event_arg *arg, void *data); - /*! - * \note - * Accessibility functions - */ - int (*lb_access)(struct event_arg *arg, void *data); - int (*pd_access)(struct event_arg *arg, void *data); - int (*update_mode)(struct event_arg *arg, void *data); }; diff --git a/include/provider_buffer.h b/include/provider_buffer.h index 6b4a33c..8f76876 100644 --- a/include/provider_buffer.h +++ b/include/provider_buffer.h @@ -1,7 +1,7 @@ /* * Copyright 2013 Samsung Electronics Co., Ltd * - * Licensed under the Flora License, Version 1.0 (the "License"); + * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * @@ -44,6 +44,17 @@ enum buffer_event { BUFFER_EVENT_KEY_DOWN, /*!< */ BUFFER_EVENT_KEY_UP, /*!< */ + + BUFFER_EVENT_HIGHLIGHT, + BUFFER_EVENT_HIGHLIGHT_NEXT, + BUFFER_EVENT_HIGHLIGHT_PREV, + BUFFER_EVENT_ACTIVATE, + BUFFER_EVENT_ACTION_UP, + BUFFER_EVENT_ACTION_DOWN, + BUFFER_EVENT_SCROLL_UP, + BUFFER_EVENT_SCROLL_MOVE, + BUFFER_EVENT_SCROLL_DOWN, + BUFFER_EVENT_UNHIGHLIGHT, }; struct livebox_buffer; @@ -203,6 +214,46 @@ extern void *provider_buffer_user_data(struct livebox_buffer *handle); */ extern int provider_buffer_set_user_data(struct livebox_buffer *handle, void *data); +extern struct packet *provider_buffer_pd_access_action_up(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_pd_access_action_down(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_pd_access_scroll_down(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_pd_access_scroll_move(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_pd_access_scroll_up(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_pd_access_unhighlight(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_pd_access_hl(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_pd_access_hl_prev(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_pd_access_hl_next(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_pd_access_activate(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_lb_access_unhighlight(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_lb_access_hl(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_lb_access_hl_prev(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_lb_access_hl_next(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_lb_access_action_up(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_lb_access_action_down(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_lb_access_scroll_down(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_lb_access_scroll_move(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_lb_access_scroll_up(pid_t pid, int handle, const struct packet *packet); + +extern struct packet *provider_buffer_lb_access_activate(pid_t pid, int handle, const struct packet *packet); + #ifdef __cplusplus } #endif diff --git a/include/provider_buffer_internal.h b/include/provider_buffer_internal.h index a364485..920d0f1 100644 --- a/include/provider_buffer_internal.h +++ b/include/provider_buffer_internal.h @@ -1,7 +1,7 @@ /* * Copyright 2013 Samsung Electronics Co., Ltd * - * Licensed under the Flora License, Version 1.0 (the "License"); + * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * diff --git a/include/util.h b/include/util.h index 20a809e..d84474e 100644 --- a/include/util.h +++ b/include/util.h @@ -1,7 +1,7 @@ /* * Copyright 2013 Samsung Electronics Co., Ltd * - * Licensed under the Flora License, Version 1.0 (the "License"); + * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * diff --git a/packaging/libprovider.spec b/packaging/libprovider.spec index 0863c2a..2b96897 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.8.2 +Version: 0.9.0 Release: 1 Group: HomeTF/Livebox License: Flora License diff --git a/src/dlist.c b/src/dlist.c index cf2cb63..fa3082a 100644 --- a/src/dlist.c +++ b/src/dlist.c @@ -1,7 +1,7 @@ /* * Copyright 2013 Samsung Electronics Co., Ltd * - * Licensed under the Flora License, Version 1.0 (the "License"); + * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * @@ -1,7 +1,7 @@ /* * Copyright 2013 Samsung Electronics Co., Ltd * - * Licensed under the Flora License, Version 1.0 (the "License"); + * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * diff --git a/src/provider.c b/src/provider.c index 83e0f38..e85c0fc 100644 --- a/src/provider.c +++ b/src/provider.c @@ -1,7 +1,7 @@ /* * Copyright 2013 Samsung Electronics Co., Ltd * - * Licensed under the Flora License, Version 1.0 (the "License"); + * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * @@ -589,453 +589,6 @@ out: return NULL; } -struct packet *master_pd_access_value_change(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, ×tamp, &arg.info.pd_access.x, &arg.info.pd_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_PD_ACCESS; - arg.info.pd_access.event = ACCESS_VALUE_CHANGE; - if (s_info.table.pd_access) - (void)s_info.table.pd_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_pd_access_scroll_down(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, ×tamp, &arg.info.pd_access.x, &arg.info.pd_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_PD_ACCESS; - arg.info.pd_access.event = ACCESS_SCROLL; - arg.info.pd_access.mouse_state = ACCESS_MOUSE_DOWN; - if (s_info.table.pd_access) - (void)s_info.table.pd_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_pd_access_scroll_move(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, ×tamp, &arg.info.pd_access.x, &arg.info.pd_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_PD_ACCESS; - arg.info.pd_access.event = ACCESS_SCROLL; - arg.info.pd_access.mouse_state = ACCESS_MOUSE_MOVE; - if (s_info.table.pd_access) - (void)s_info.table.pd_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_pd_access_scroll_up(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, ×tamp, &arg.info.pd_access.x, &arg.info.pd_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_PD_ACCESS; - arg.info.pd_access.event = ACCESS_SCROLL; - arg.info.pd_access.mouse_state = ACCESS_MOUSE_UP; - if (s_info.table.pd_access) - (void)s_info.table.pd_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_pd_access_unhighlight(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, ×tamp, &arg.info.pd_access.x, &arg.info.pd_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_PD_ACCESS; - arg.info.pd_access.event = ACCESS_UNHIGHLIGHT; - if (s_info.table.pd_access) - (void)s_info.table.pd_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_pd_access_hl(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, - ×tamp, - &arg.info.pd_access.x, &arg.info.pd_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_PD_ACCESS; - arg.info.pd_access.event = ACCESS_HIGHLIGHT; - if (s_info.table.pd_access) - (void)s_info.table.pd_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_pd_access_hl_prev(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, - ×tamp, - &arg.info.pd_access.x, &arg.info.pd_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_PD_ACCESS; - arg.info.pd_access.event = ACCESS_HIGHLIGHT_PREV; - if (s_info.table.pd_access) - (void)s_info.table.pd_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_pd_access_hl_next(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, - ×tamp, - &arg.info.pd_access.x, &arg.info.pd_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_PD_ACCESS; - arg.info.pd_access.event = ACCESS_HIGHLIGHT_NEXT; - if (s_info.table.pd_access) - (void)s_info.table.pd_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_pd_access_activate(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, - ×tamp, - &arg.info.pd_access.x, &arg.info.pd_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_PD_ACCESS; - arg.info.pd_access.event = ACCESS_ACTIVATE; - if (s_info.table.pd_access) - (void)s_info.table.pd_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_lb_access_unhighlight(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, - ×tamp, - &arg.info.lb_access.x, &arg.info.lb_access.y); - - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_LB_ACCESS; - arg.info.lb_access.event = ACCESS_UNHIGHLIGHT; - if (s_info.table.lb_access) - (void)s_info.table.lb_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_lb_access_hl(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, - ×tamp, - &arg.info.lb_access.x, &arg.info.lb_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_LB_ACCESS; - arg.info.lb_access.event = ACCESS_HIGHLIGHT; - if (s_info.table.lb_access) - (void)s_info.table.lb_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_lb_access_hl_prev(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, - ×tamp, - &arg.info.lb_access.x, &arg.info.lb_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_LB_ACCESS; - arg.info.lb_access.event = ACCESS_HIGHLIGHT_PREV; - if (s_info.table.lb_access) - (void)s_info.table.lb_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_lb_access_hl_next(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, - ×tamp, - &arg.info.lb_access.x, &arg.info.lb_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_LB_ACCESS; - arg.info.lb_access.event = ACCESS_HIGHLIGHT_NEXT; - if (s_info.table.lb_access) - (void)s_info.table.lb_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_lb_access_value_change(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, - ×tamp, - &arg.info.lb_access.x, &arg.info.lb_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_LB_ACCESS; - arg.info.lb_access.event = ACCESS_VALUE_CHANGE; - if (s_info.table.lb_access) - (void)s_info.table.lb_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_lb_access_scroll_down(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, - ×tamp, - &arg.info.lb_access.x, &arg.info.lb_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_LB_ACCESS; - arg.info.lb_access.event = ACCESS_SCROLL; - arg.info.lb_access.mouse_state = ACCESS_MOUSE_DOWN; - if (s_info.table.lb_access) - (void)s_info.table.lb_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_lb_access_scroll_move(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, - ×tamp, - &arg.info.lb_access.x, &arg.info.lb_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_LB_ACCESS; - arg.info.lb_access.event = ACCESS_SCROLL; - arg.info.lb_access.mouse_state = ACCESS_MOUSE_MOVE; - if (s_info.table.lb_access) - (void)s_info.table.lb_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_lb_access_scroll_up(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, - ×tamp, - &arg.info.lb_access.x, &arg.info.lb_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_LB_ACCESS; - arg.info.lb_access.event = ACCESS_SCROLL; - arg.info.lb_access.mouse_state = ACCESS_MOUSE_UP; - if (s_info.table.lb_access) - (void)s_info.table.lb_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - -struct packet *master_lb_access_activate(pid_t pid, int handle, const struct packet *packet) -{ - struct event_arg arg; - double timestamp; - int ret; - - ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, - ×tamp, - &arg.info.lb_access.x, &arg.info.lb_access.y); - if (ret != 5) { - ErrPrint("Invalid packet\n"); - goto out; - } - - arg.type = EVENT_LB_ACCESS; - arg.info.lb_access.event = ACCESS_ACTIVATE; - if (s_info.table.lb_access) - (void)s_info.table.lb_access(&arg, s_info.data); - else - (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR); - -out: - return NULL; -} - static struct method s_table[] = { /*!< For the buffer type */ { @@ -1169,80 +722,88 @@ static struct method s_table[] = { { .cmd = "pd_access_hl", - .handler = master_pd_access_hl, + .handler = provider_buffer_pd_access_hl, }, { .cmd = "pd_access_hl_prev", - .handler = master_pd_access_hl_prev, + .handler = provider_buffer_pd_access_hl_prev, }, { .cmd = "pd_access_hl_next", - .handler = master_pd_access_hl_next, + .handler = provider_buffer_pd_access_hl_next, }, { .cmd = "pd_access_activate", - .handler = master_pd_access_activate, + .handler = provider_buffer_pd_access_activate, }, { - .cmd = "pd_access_value_change", - .handler = master_pd_access_value_change, + .cmd = "pd_access_action_up", + .handler = provider_buffer_pd_access_action_up, + }, + { + .cmd = "pd_access_action_down", + .handler = provider_buffer_pd_access_action_down, }, { .cmd = "pd_access_unhighlight", - .handler = master_pd_access_unhighlight, + .handler = provider_buffer_pd_access_unhighlight, }, { .cmd = "pd_access_scroll_down", - .handler = master_pd_access_scroll_down, + .handler = provider_buffer_pd_access_scroll_down, }, { .cmd = "pd_access_scroll_move", - .handler = master_pd_access_scroll_move, + .handler = provider_buffer_pd_access_scroll_move, }, { .cmd = "pd_access_scroll_up", - .handler = master_pd_access_scroll_up, + .handler = provider_buffer_pd_access_scroll_up, }, { .cmd = "lb_access_hl", - .handler = master_lb_access_hl, + .handler = provider_buffer_lb_access_hl, }, { .cmd = "lb_access_hl_prev", - .handler = master_lb_access_hl_prev, + .handler = provider_buffer_lb_access_hl_prev, }, { .cmd = "lb_access_hl_next", - .handler = master_lb_access_hl_next, + .handler = provider_buffer_lb_access_hl_next, }, { .cmd = "lb_access_activate", - .handler = master_lb_access_activate, + .handler = provider_buffer_lb_access_activate, }, { - .cmd = "lb_access_value_change", - .handler = master_lb_access_value_change, + .cmd = "lb_access_action_up", + .handler = provider_buffer_lb_access_action_up, }, { - .cmd = "update_mode", - .handler = master_update_mode, + .cmd = "lb_access_action_down", + .handler = provider_buffer_lb_access_action_down, }, { .cmd = "lb_access_unhighlight", - .handler = master_lb_access_unhighlight, + .handler = provider_buffer_lb_access_unhighlight, }, { .cmd = "lb_access_scroll_down", - .handler = master_lb_access_scroll_down, + .handler = provider_buffer_lb_access_scroll_down, }, { .cmd = "lb_access_scroll_move", - .handler = master_lb_access_scroll_move, + .handler = provider_buffer_lb_access_scroll_move, }, { .cmd = "lb_access_scroll_up", - .handler = master_lb_access_scroll_up, + .handler = provider_buffer_lb_access_scroll_up, + }, + { + .cmd = "update_mode", + .handler = master_update_mode, }, { diff --git a/src/provider_buffer.c b/src/provider_buffer.c index 2c08ae9..5bba320 100644 --- a/src/provider_buffer.c +++ b/src/provider_buffer.c @@ -1,7 +1,7 @@ /* * Copyright 2013 Samsung Electronics Co., Ltd * - * Licensed under the Flora License, Version 1.0 (the "License"); + * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * @@ -28,6 +28,7 @@ #include <dlog.h> #include <livebox-errno.h> +#include <livebox-service.h> /* LB_ACCESS_STATUS_ERROR */ #include "dlist.h" #include "util.h" @@ -992,4 +993,804 @@ out: return NULL; } +struct packet *provider_buffer_pd_access_action_up(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_PD, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_ACTION_UP, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_pd_access_action_down(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_PD, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_ACTION_DOWN, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_pd_access_scroll_down(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_PD, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_SCROLL_DOWN, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_pd_access_scroll_move(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_PD, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_SCROLL_MOVE, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_pd_access_scroll_up(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_PD, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_SCROLL_UP, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_pd_access_unhighlight(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_PD, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_UNHIGHLIGHT, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_pd_access_hl(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_PD, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_HIGHLIGHT, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_pd_access_hl_prev(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_PD, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_HIGHLIGHT_PREV, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_pd_access_hl_next(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_PD, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_HIGHLIGHT_NEXT, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_pd_access_activate(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_PD, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_ACTIVATE, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_lb_access_unhighlight(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_LB, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_UNHIGHLIGHT, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_lb_access_hl(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_LB, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_HIGHLIGHT, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_lb_access_hl_prev(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_LB, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_HIGHLIGHT_PREV, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_lb_access_hl_next(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_LB, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_HIGHLIGHT_NEXT, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_lb_access_action_up(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_LB, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_ACTION_UP, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_lb_access_action_down(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_LB, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_ACTION_DOWN, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_lb_access_scroll_down(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_LB, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_SCROLL_DOWN, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_lb_access_scroll_move(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_LB, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_SCROLL_MOVE, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_lb_access_scroll_up(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_LB, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_SCROLL_UP, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + +struct packet *provider_buffer_lb_access_activate(pid_t pid, int handle, const struct packet *packet) +{ + const char *pkgname; + const char *id; + double timestamp; + int ret; + int x; + int y; + struct livebox_buffer *info; + + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); + if (ret != 5) { + ErrPrint("Invalid packet\n"); + goto out; + } + + info = provider_buffer_find_buffer(TYPE_LB, pkgname, id); + if (!info) { + ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id); + goto out; + } + + 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); + + ret = info->handler(info, BUFFER_EVENT_ACTIVATE, timestamp, (double)x / (double)w, (double)y / (double)h, info->data); + if (ret < 0) + (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR); + else + (void)provider_send_access_status(pkgname, id, ret); + } + +out: + return NULL; +} + /* End of a file */ @@ -1,7 +1,7 @@ /* * Copyright 2013 Samsung Electronics Co., Ltd * - * Licensed under the Flora License, Version 1.0 (the "License"); + * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * |