summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-02-23 09:18:51 (GMT)
committerSung-jae Park <nicesj.park@samsung.com>2013-02-23 09:18:51 (GMT)
commit51b09a723272f59c4ed4243ad10e6b43faa90da9 (patch)
tree5b87c92473400eaf0b5685cdf27cc4ae9ef3e5f9
parent026c7987d8324df6e8e69cf81241ed00cad47339 (diff)
downloaddata-provider-master-51b09a723272f59c4ed4243ad10e6b43faa90da9.zip
data-provider-master-51b09a723272f59c4ed4243ad10e6b43faa90da9.tar.gz
data-provider-master-51b09a723272f59c4ed4243ad10e6b43faa90da9.tar.bz2
Update resize event send function
Change-Id: Ic32ca986584c64e8db094cf7183e363f22971cb8
-rw-r--r--include/conf.h6
-rw-r--r--include/instance.h4
-rw-r--r--packaging/org.tizen.data-provider-master.spec2
-rw-r--r--src/conf.c7
-rw-r--r--src/instance.c31
-rw-r--r--src/script_handler.c17
-rw-r--r--src/server.c31
7 files changed, 71 insertions, 27 deletions
diff --git a/include/conf.h b/include/conf.h
index 714cf0c..c748a26 100644
--- a/include/conf.h
+++ b/include/conf.h
@@ -82,6 +82,9 @@ struct conf {
int overwrite_content;
int com_core_thread;
int use_xmonitor;
+
+ double scale_width_factor;
+ double scale_height_factor;
};
extern struct conf g_conf;
@@ -94,6 +97,9 @@ extern int conf_loader(void);
#define CR 13
#define LF 10
+#define SCALE_WIDTH_FACTOR g_conf.scale_width_factor
+#define SCALE_HEIGHT_FACTOR g_conf.scale_height_factor
+
#define USE_SW_BACKEND g_conf.use_sw_backend
#define PROVIDER_METHOD g_conf.provider_method
#define DEBUG_MODE g_conf.debug_mode
diff --git a/include/instance.h b/include/instance.h
index 016d704..69b6d55 100644
--- a/include/instance.h
+++ b/include/instance.h
@@ -113,6 +113,9 @@ enum livebox_visible_state { /*!< Must be sync'd with livebox-viewer */
LB_VISIBLE_ERROR = 0xFFFFFFFF, /* To enlarge the size of this enumeration type */
};
+#define IS_PD 1
+#define IS_LB 0
+
struct inst_info;
struct pkg_info;
struct script_handle;
@@ -184,6 +187,7 @@ extern const enum instance_state const instance_state(const struct inst_info *in
*/
extern int instance_unicast_created_event(struct inst_info *inst, struct client_node *client);
extern int instance_unicast_deleted_event(struct inst_info *inst, struct client_node *client);
+extern void instance_send_resized_event(struct inst_info *inst, int is_pd, int w, int h, int status);
extern int instance_create_lb_buffer(struct inst_info *inst);
extern int instance_create_pd_buffer(struct inst_info *inst);
diff --git a/packaging/org.tizen.data-provider-master.spec b/packaging/org.tizen.data-provider-master.spec
index ff61a2d..cf75499 100644
--- a/packaging/org.tizen.data-provider-master.spec
+++ b/packaging/org.tizen.data-provider-master.spec
@@ -1,6 +1,6 @@
Name: org.tizen.data-provider-master
Summary: Master service provider for liveboxes.
-Version: 0.16.11
+Version: 0.16.13
Release: 1
Group: framework/livebox
License: Flora License
diff --git a/src/conf.c b/src/conf.c
index c8667f9..aab6a7a 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -81,12 +81,17 @@ HAPI struct conf g_conf = {
.debug_mode = 0,
.overwrite_content = 0,
.com_core_thread = 1,
- .use_xmonitor = 1,
+ .use_xmonitor = 0,
+
+ .scale_width_factor = 1.0f,
+ .scale_height_factor = 1.0f,
};
static void conf_update_size(void)
{
ecore_x_window_size_get(0, &g_conf.width, &g_conf.height);
+ g_conf.scale_width_factor = (double)g_conf.width / (double)BASE_W;
+ g_conf.scale_height_factor = (double)g_conf.height / (double)BASE_H;
}
static void use_xmonitor(char *buffer)
diff --git a/src/instance.c b/src/instance.c
index f3a2e64..feb3abc 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -247,7 +247,7 @@ static inline int instance_recover_visible_state(struct inst_info *inst)
return ret;
}
-static inline void send_size_changed_event(struct inst_info *inst, int is_pd, int w, int h, int status)
+HAPI void instance_send_resized_event(struct inst_info *inst, int is_pd, int w, int h, int status)
{
struct packet *packet;
const char *pkgname;
@@ -256,6 +256,8 @@ static inline void send_size_changed_event(struct inst_info *inst, int is_pd, in
pkgname = package_name(inst->info);
id = inst->id;
+ DbgPrint("Size is changed to %dx%d (%s) %s\n", w, h, id, is_pd ? "pd" : "lb");
+
packet = packet_create_noack("size_changed", "ssiiii", pkgname, id, is_pd, w, h, status);
if (packet)
CLIENT_SEND_EVENT(inst, packet);
@@ -320,9 +322,11 @@ HAPI int instance_unicast_created_event(struct inst_info *inst, struct client_no
static int update_client_list(struct client_node *client, void *data)
{
struct inst_info *inst = data;
+
if (!instance_has_client(inst, client)) {
instance_add_client(inst, client);
}
+
return 0;
}
@@ -1515,24 +1519,12 @@ HAPI void instance_set_lb_info(struct inst_info *inst, int w, int h, double prio
if (priority >= 0.0f && priority <= 1.0f)
inst->lb.priority = priority;
- if (inst->state == INST_ACTIVATED && (inst->lb.width != w || inst->lb.height != h)) {
- /*!
- */
- send_size_changed_event(inst, 0, w, h, 0);
- }
-
inst->lb.width = w;
inst->lb.height = h;
}
HAPI void instance_set_pd_info(struct inst_info *inst, int w, int h)
{
- if (inst->state == INST_ACTIVATED && (inst->pd.width != w || inst->pd.height != h)) {
- /*!
- */
- send_size_changed_event(inst, 1, w, h, 0);
- }
-
inst->pd.width = w;
inst->pd.height = h;
}
@@ -1713,6 +1705,8 @@ static void resize_cb(struct slave_node *slave, const struct packet *packet, voi
int ret;
if (!packet) {
+ ErrPrint("Invalid packet\n");
+ instance_send_resized_event(cbdata->inst, IS_LB, cbdata->inst->lb.width, cbdata->inst->lb.height, -EFAULT);
instance_unref(cbdata->inst);
DbgFree(cbdata);
return;
@@ -1720,17 +1714,22 @@ static void resize_cb(struct slave_node *slave, const struct packet *packet, voi
if (packet_get(packet, "i", &ret) != 1) {
ErrPrint("Invalid parameter\n");
+ instance_send_resized_event(cbdata->inst, IS_LB, cbdata->inst->lb.width, cbdata->inst->lb.height, -EINVAL);
instance_unref(cbdata->inst);
DbgFree(cbdata);
return;
}
if (ret == 0) {
- cbdata->inst->lb.width = cbdata->w;
- cbdata->inst->lb.height = cbdata->h;
+ /*!
+ * \note
+ * else waiting the first update with new size
+ */
+ } else {
+ DbgPrint("Livebox rejects the new size: %dx%d (%d)\n", cbdata->w, cbdata->h, ret);
+ instance_send_resized_event(cbdata->inst, IS_LB, cbdata->inst->lb.width, cbdata->inst->lb.height, ret);
}
- send_size_changed_event(cbdata->inst, 0, cbdata->w, cbdata->h, ret);
instance_unref(cbdata->inst);
DbgFree(cbdata);
}
diff --git a/src/script_handler.c b/src/script_handler.c
index 6e74ae0..9c49c3f 100644
--- a/src/script_handler.c
+++ b/src/script_handler.c
@@ -641,10 +641,23 @@ static int update_info(struct inst_info *inst, struct block *block, int is_pd)
}
if (!block->id) {
- if (is_pd)
+ int resized;
+
+ if (is_pd) {
+ resized = (instance_pd_width(inst) != w) || (instance_pd_height(inst) != h);
instance_set_pd_info(inst, w, h);
- else
+ } else {
+ /*!
+ * \note
+ * LB Size is already scaled by livebox-service.
+ * Each livebox uses the LB_SIZE_TYPE_XXX for its size.
+ */
+ resized = (instance_lb_width(inst) != w) || (instance_lb_height(inst) != h);
instance_set_lb_info(inst, w, h, NO_CHANGE, CONTENT_NO_CHANGE, TITLE_NO_CHANGE);
+ }
+
+ if (resized)
+ instance_send_resized_event(inst, is_pd, w, h, 0);
script_handler_resize(info, w, h);
} else {
diff --git a/src/server.c b/src/server.c
index 9d641b4..b48b580 100644
--- a/src/server.c
+++ b/src/server.c
@@ -4138,13 +4138,13 @@ static struct packet *slave_faulted(pid_t pid, int handle, const struct packet *
inst = package_find_instance_by_id(pkgname, id);
if (!inst) {
- DbgPrint("There is no such instance: %s\n", id);
+ DbgPrint("There is a no such instance(%s)\n", id);
ret = -ENOENT;
} else if (instance_state(inst) == INST_DESTROYED) {
- ErrPrint("Instance is already destroyed (%s)\n", id);
+ ErrPrint("Instance(%s) is already destroyed\n", id);
ret = -EINVAL;
} else {
- DbgPrint("Destroy instance (%s)\n", id);
+ DbgPrint("Destroy instance(%s)\n", id);
ret = instance_destroy(inst);
}
@@ -4253,7 +4253,9 @@ static struct packet *slave_updated(pid_t pid, int handle, const struct packet *
ret = -EINVAL;
} else {
char *filename;
+ int resized;
+ resized = (instance_lb_width(inst) != w) || (instance_lb_height(inst) != h);
instance_set_lb_info(inst, w, h, priority, content_info, title);
switch (package_lb_type(instance_package(inst))) {
@@ -4271,14 +4273,13 @@ static struct packet *slave_updated(pid_t pid, int handle, const struct packet *
}
break;
case LB_TYPE_BUFFER:
- instance_lb_updated_by_instance(inst);
- ret = 0;
- break;
default:
/*!
* \check
* text format (inst)
*/
+ if (resized)
+ instance_send_resized_event(inst, IS_LB, w, h, 0);
instance_lb_updated_by_instance(inst);
ret = 0;
break;
@@ -4463,8 +4464,12 @@ static struct packet *slave_acquire_buffer(pid_t pid, int handle, const struct p
ret = buffer_handler_load(info);
if (ret == 0) {
+ int resized;
+ resized = (instance_lb_width(inst) != w) || (instance_lb_height(inst) != h);
instance_set_lb_info(inst, w, h, -1.0f, NULL, NULL);
id = buffer_handler_id(info);
+ if (resized)
+ instance_send_resized_event(inst, IS_LB, w, h, 0);
DbgPrint("Buffer handler ID: %s\n", id);
} else {
DbgPrint("Failed to load a buffer(%d)\n", ret);
@@ -4497,8 +4502,12 @@ static struct packet *slave_acquire_buffer(pid_t pid, int handle, const struct p
ret = buffer_handler_load(info);
if (ret == 0) {
+ int resized;
+ resized = (instance_pd_width(inst) != w) || (instance_pd_height(inst) != h);
instance_set_pd_info(inst, w, h);
id = buffer_handler_id(info);
+ if (resized)
+ instance_send_resized_event(inst, IS_PD, w, h, 0);
DbgPrint("Buffer handler ID: %s\n", id);
} else {
DbgPrint("Failed to load a buffer (%d)\n", ret);
@@ -4594,8 +4603,13 @@ static struct packet *slave_resize_buffer(pid_t pid, int handle, const struct pa
* id is resued for newly assigned ID
*/
if (!ret) {
+ int resized;
+
id = buffer_handler_id(info);
+ resized = (instance_lb_width(inst) != w) || (instance_lb_height(inst) != h);
instance_set_lb_info(inst, w, h, -1.0f, NULL, NULL);
+ if (resized)
+ instance_send_resized_event(inst, IS_LB, w, h, 0);
}
}
}
@@ -4611,9 +4625,12 @@ static struct packet *slave_resize_buffer(pid_t pid, int handle, const struct pa
* id is resued for newly assigned ID
*/
if (!ret) {
+ int resized;
id = buffer_handler_id(info);
- DbgPrint("Set PD Info: %dx%d\n", w, h);
+ resized = (instance_pd_width(inst) != w) || (instance_pd_height(inst) != h);
instance_set_pd_info(inst, w, h);
+ if (resized)
+ instance_send_resized_event(inst, IS_PD, w, h, 0);
}
}
}