Update script init ABI.
authorSung-jae Park <nicesj.park@samsung.com>
Wed, 18 Sep 2013 13:12:13 +0000 (22:12 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Wed, 18 Sep 2013 13:12:13 +0000 (22:12 +0900)
Get the scale factor from the master via init interface.

Change-Id: I27b34e512b427dc0829732e1b37f0724c8efb710

include/script_port.h
packaging/liblivebox-edje.spec
src/script_port.c

index 221b020..25a7a5a 100644 (file)
@@ -51,7 +51,7 @@ extern int script_unload(void *handle, Evas *e);
 */
 extern int script_feed_event(void *h, Evas *e, int event_type, int x, int y, int down, double timestamp);
 
-extern int script_init(void);
+extern int script_init(double scale);
 extern int script_fini(void);
 
 extern const char *script_magic_id(void);
index fb61e73..bd8034a 100644 (file)
@@ -1,6 +1,6 @@
 Name: liblivebox-edje
 Summary: EDJE Script loader for the data provider master
-Version: 0.5.15
+Version: 0.5.16
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
index 8ef1205..8336da2 100644 (file)
@@ -41,7 +41,6 @@
 
 #define TEXT_CLASS     "tizen"
 #define DEFAULT_FONT_SIZE      -100
-#define BASE_WIDTH     720.0f
 
 #define PUBLIC __attribute__((visibility("default")))
 
@@ -94,14 +93,6 @@ static struct {
        .handle_list = NULL,
 };
 
-static inline double scale_get(void)
-{
-       int width;
-       int height;
-       ecore_x_window_size_get(0, &width, &height);
-       return (double)width / BASE_WIDTH;
-}
-
 static inline Evas_Object *find_edje(struct info *handle, const char *id)
 {
        Eina_List *l;
@@ -669,8 +660,8 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
                        Evas_Coord part_h;
 
                        if (img_opt.width >= 0 && img_opt.height >= 0) {
-                               part_w = img_opt.width * scale_get();
-                               part_h = img_opt.height * scale_get();
+                               part_w = img_opt.width * elm_config_scale_get();
+                               part_h = img_opt.height * elm_config_scale_get();
                        } else {
                                part_w = 0;
                                part_h = 0;
@@ -812,8 +803,8 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
                        Evas_Coord part_h;
 
                        if (img_opt.width >= 0 && img_opt.height >= 0) {
-                               part_w = img_opt.width * scale_get();
-                               part_h = img_opt.height * scale_get();
+                               part_w = img_opt.width * elm_config_scale_get();
+                               part_h = img_opt.height * elm_config_scale_get();
                        } else {
                                part_w = 0;
                                part_h = 0;
@@ -1200,6 +1191,8 @@ PUBLIC int script_update_script(void *h, Evas *e, const char *src_id, const char
                return LB_STATUS_ERROR_FAULT;
        }
 
+       edje_object_scale_set(elm_layout_edje_get(obj), elm_config_scale_get());
+
        if (!elm_layout_file_set(obj, path, group)) {
                int err;
                err = edje_object_load_error_get(elm_layout_edje_get(obj));
@@ -1416,6 +1409,8 @@ PUBLIC int script_load(void *_handle, Evas *e, int w, int h)
                return LB_STATUS_ERROR_FAULT;
        }
 
+       edje_object_scale_set(elm_layout_edje_get(edje), elm_config_scale_get());
+
        if (!elm_layout_file_set(edje, handle->file, handle->group)) {
                int err;
 
@@ -1583,7 +1578,7 @@ static void font_size_cb(system_settings_key_e key, void *user_data)
        DbgPrint("Font size is changed to %d, but don't update the font info\n", size);
 }
 
-PUBLIC int script_init(void)
+PUBLIC int script_init(double scale)
 {
        int ret;
        char *argv[] = {
@@ -1593,7 +1588,8 @@ PUBLIC int script_init(void)
 
        /* ecore is already initialized */
        elm_init(1, argv);
-       elm_config_scale_set(scale_get());
+       elm_config_scale_set(scale);
+       DbgPrint("Scale is updated: %lf\n", scale);
 
        ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, access_cb, NULL);
        DbgPrint("TTS changed: %d\n", ret);