2 * Copyright 2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
23 #include <Elementary.h>
28 #include <Ecore_Evas.h>
31 #include <efl_assist.h>
33 #include <system_settings.h>
38 #include <livebox-errno.h>
39 #include <livebox-service.h>
41 #include "script_port.h"
43 #define TEXT_CLASS "tizen"
44 #define DEFAULT_FONT_SIZE -100
46 #define PUBLIC __attribute__((visibility("default")))
48 void _elm_access_object_hilight(Evas_Object *obj);
84 Eina_List *access_chain;
103 Eina_List *handle_list;
112 static inline Evas_Object *find_edje(struct info *handle, const char *id)
116 struct obj_info *obj_info;
118 EINA_LIST_FOREACH(handle->obj_list, l, edje) {
119 obj_info = evas_object_data_get(edje, "obj_info");
121 ErrPrint("Object info is not valid\n");
131 } else if (!obj_info->id) {
135 if (!strcmp(obj_info->id, id)) {
140 DbgPrint("EDJE[%s] is not found\n", id);
144 PUBLIC const char *script_magic_id(void)
149 PUBLIC int script_update_color(void *h, Evas *e, const char *id, const char *part, const char *rgba)
151 struct info *handle = h;
153 int r[3], g[3], b[3], a[3];
156 edje = find_edje(handle, id);
158 return LB_STATUS_ERROR_NOT_EXIST;
161 ret = sscanf(rgba, "%d %d %d %d %d %d %d %d %d %d %d %d",
162 r, g, b, a, /* OBJECT */
163 r + 1, g + 1, b + 1, a + 1, /* OUTLINE */
164 r + 2, g + 2, b + 2, a + 2); /* SHADOW */
166 DbgPrint("id[%s] part[%s] rgba[%s]\n", id, part, rgba);
167 return LB_STATUS_ERROR_INVALID;
170 ret = edje_object_color_class_set(elm_layout_edje_get(edje), part,
171 r[0], g[0], b[0], a[0], /* OBJECT */
172 r[1], g[1], b[1], a[1], /* OUTLINE */
173 r[2], g[2], b[2], a[2]); /* SHADOW */
175 DbgPrint("EDJE[%s] color class is %s changed", id, ret == EINA_TRUE ? "successfully" : "not");
176 return LB_STATUS_SUCCESS;
179 static void activate_cb(void *data, Evas_Object *part_obj, Elm_Object_Item *item)
190 ao = evas_object_data_get(part_obj, "ao");
195 edje = evas_object_data_get(ao, "edje");
200 e = evas_object_evas_get(part_obj);
201 evas_object_geometry_get(part_obj, &x, &y, &w, &h);
205 #if defined(_USE_ECORE_TIME_GET)
206 timestamp = ecore_time_get();
209 if (gettimeofday(&tv, NULL) < 0) {
210 ErrPrint("Failed to get time\n");
213 timestamp = (double)tv.tv_sec + ((double)tv.tv_usec / 1000000.0f);
217 DbgPrint("Cursor is on %dx%d\n", x, y);
218 evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
219 evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, (timestamp + 0.01f) * 1000, NULL);
220 evas_event_feed_mouse_move(e, x, y, (timestamp + 0.02f) * 1000, NULL);
221 evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, (timestamp + 0.03f) * 1000, NULL);
224 static void access_del_cb(void *_info, Evas *e, Evas_Object *ao, void *event_info)
226 struct info *handle = _info;
227 Evas_Object *edje_part;
229 edje_part = evas_object_data_del(ao, "edje,part");
233 * (void)evas_object_data_del(ao, "edje");
234 * edje_part will delete the "ao" tag when it is deleted.
235 * (void)evas_object_data_del(edje_part, "ao");
238 handle->access_chain = eina_list_remove(handle->access_chain, edje_part);
239 DbgPrint("AO(%p) is removed from local access chain\n", ao);
242 static void update_focus_chain(struct info *handle, Evas_Object *ao)
244 const Eina_List *list;
246 list = elm_object_focus_custom_chain_get(handle->parent);
247 if (!eina_list_data_find(list, ao)) {
248 DbgPrint("Append again to the focus chain\n");
249 elm_object_focus_custom_chain_append(handle->parent, ao, NULL);
253 PUBLIC int script_update_text(void *h, Evas *e, const char *id, const char *part, const char *text)
255 struct obj_info *obj_info;
256 struct info *handle = h;
258 Evas_Object *edje_part;
260 edje = find_edje(handle, id);
262 ErrPrint("Failed to find EDJE\n");
263 return LB_STATUS_ERROR_NOT_EXIST;
266 obj_info = evas_object_data_get(edje, "obj_info");
268 ErrPrint("Object info is not available\n");
269 return LB_STATUS_ERROR_FAULT;
272 elm_object_part_text_set(edje, part, text ? text : "");
274 edje_part = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(edje), part);
279 ao = evas_object_data_get(edje_part, "ao");
281 ao = elm_access_object_register(edje_part, handle->parent);
283 ErrPrint("Unable to register an access object(%s)\n", part);
287 if (!handle->access_chain && s_info.access_on) {
288 _elm_access_object_hilight(edje);
291 handle->access_chain = eina_list_append(handle->access_chain, edje_part);
292 evas_object_data_set(edje_part, "ao", ao);
293 evas_object_data_set(ao, "edje", edje);
294 evas_object_data_set(ao, "edje,part", edje_part);
295 elm_access_activate_cb_set(ao, activate_cb, NULL);
296 elm_object_focus_custom_chain_append(handle->parent, ao, NULL);
297 evas_object_event_callback_add(ao, EVAS_CALLBACK_DEL, access_del_cb, handle);
299 DbgPrint("[%s] Register access info: (%s) to, %p\n", part, text, handle->parent);
302 if (!text || !strlen(text)) {
305 * Delete callback will be called
307 DbgPrint("[%s] Remove access object(%p)\n", part, ao);
308 elm_access_object_unregister(ao);
313 utf8 = elm_entry_markup_to_utf8(text);
314 if ((!utf8 || !strlen(utf8))) {
318 * Delete callback will be called
320 DbgPrint("[%s] Remove access object(%p)\n", part, ao);
321 elm_access_object_unregister(ao);
326 elm_access_info_set(ao, ELM_ACCESS_INFO, utf8);
329 update_focus_chain(handle, ao);
331 ErrPrint("Unable to get text part[%s]\n", part);
335 return LB_STATUS_SUCCESS;
338 static void parse_aspect(struct image_option *img_opt, const char *value, int len)
340 while (len > 0 && *value == ' ') {
349 img_opt->aspect = !strncasecmp(value, "true", 4);
350 DbgPrint("Parsed ASPECT: %d (%s)\n", img_opt->aspect, value);
353 static void parse_orient(struct image_option *img_opt, const char *value, int len)
355 while (len > 0 && *value == ' ') {
364 img_opt->orient = !strncasecmp(value, "true", 4);
365 DbgPrint("Parsed ORIENT: %d (%s)\n", img_opt->orient, value);
368 static void parse_size(struct image_option *img_opt, const char *value, int len)
374 while (len > 0 && *value == ' ') {
379 buf = strndup(value, len);
381 ErrPrint("Heap: %s\n", strerror(errno));
385 if (sscanf(buf, "%dx%d", &width, &height) == 2) {
386 img_opt->width = width;
387 img_opt->height = height;
388 DbgPrint("Parsed size : %dx%d (%s)\n", width, height, buf);
390 DbgPrint("Invalid size tag[%s]\n", buf);
396 static void parse_shadow(struct image_option *img_opt, const char *value, int len)
403 if (sscanf(value, "%d,%d,%d,%x", &angle, &offset, &softness, &color) != 4) {
404 ErrPrint("Invalid shadow [%s]\n", value);
406 img_opt->shadow.enabled = 1;
407 img_opt->shadow.angle = angle;
408 img_opt->shadow.offset = offset;
409 img_opt->shadow.softness = softness;
410 img_opt->shadow.color = color;
414 static void parse_fill(struct image_option *img_opt, const char *value, int len)
416 while (len > 0 && *value == ' ') {
421 if (!strncasecmp(value, "in-size", len)) {
422 img_opt->fill = FILL_IN_SIZE;
423 } else if (!strncasecmp(value, "over-size", len)) {
424 img_opt->fill = FILL_OVER_SIZE;
426 img_opt->fill = FILL_DISABLE;
429 DbgPrint("Parsed FILL: %d (%s)\n", img_opt->fill, value);
432 static inline void parse_image_option(const char *option, struct image_option *img_opt)
439 void (*handler)(struct image_option *img_opt, const char *value, int len);
442 .cmd = "aspect", /* Keep the aspect ratio */
443 .handler = parse_aspect,
446 .cmd = "orient", /* Keep the orientation value: for the rotated images */
447 .handler = parse_orient,
450 .cmd = "fill", /* Fill the image to its container */
451 .handler = parse_fill, /* Value: in-size, over-size, disable(default) */
455 .handler = parse_size,
459 .handler = parse_shadow,
473 if (!option || !*option) {
480 * GCC 4.7 warnings uninitialized idx and tag value.
481 * But it will be initialized by the state machine. :(
482 * Anyway, I just reset idx and tag for reducing the GCC4.7 complains.
489 for (ptr = option; state != STATE_END; ptr++) {
504 cmd = cmd_list[tag].cmd;
510 } else if (*ptr == '\0') {
515 if (cmd[idx] == '\0' && (*ptr == ' ' || *ptr == '\t' || *ptr == '=')) {
520 state = STATE_IGNORE;
523 } else if (*ptr == '\0') {
525 } else if (cmd[idx] == *ptr) {
531 if (tag == sizeof(cmd_list) / sizeof(cmd_list[0])) {
535 cmd = cmd_list[tag].cmd;
541 if (*ptr == ';' || *ptr == '\0') {
542 cmd_list[tag].handler(img_opt, value + 1, idx);
543 state = *ptr ? STATE_START : STATE_END;
551 } else if (*ptr == '\0') {
561 PUBLIC int script_update_access(void *_h, Evas *e, const char *id, const char *part, const char *text, const char *option)
563 struct info *handle = _h;
565 struct obj_info *obj_info;
566 Evas_Object *edje_part;
568 edje = find_edje(handle, id);
570 ErrPrint("No such object: %s\n", id);
571 return LB_STATUS_ERROR_NOT_EXIST;
574 obj_info = evas_object_data_get(edje, "obj_info");
576 ErrPrint("Object info is not available\n");
577 return LB_STATUS_ERROR_FAULT;
580 edje_part = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(edje), part);
584 ao = evas_object_data_get(edje_part, "ao");
586 if (text && strlen(text)) {
587 elm_access_info_set(ao, ELM_ACCESS_INFO, text);
588 DbgPrint("Access info is updated: %s [%s], %p\n", part, text, ao);
589 update_focus_chain(handle, ao);
593 * Delete clalback will be called
595 DbgPrint("[%s] Remove access object(%p)\n", part, ao);
596 elm_access_object_unregister(ao);
598 } else if (text && strlen(text)) {
599 ao = elm_access_object_register(edje_part, handle->parent);
601 ErrPrint("Unable to register an access object(%s)\n", part);
603 elm_access_info_set(ao, ELM_ACCESS_INFO, text);
605 if (!handle->access_chain && s_info.access_on) {
606 _elm_access_object_hilight(edje);
609 handle->access_chain = eina_list_append(handle->access_chain, edje_part);
610 evas_object_data_set(edje_part, "ao", ao);
611 evas_object_data_set(ao, "edje", edje);
612 evas_object_data_set(ao, "edje,part", edje_part);
613 elm_object_focus_custom_chain_append(handle->parent, ao, NULL);
614 elm_access_activate_cb_set(ao, activate_cb, NULL);
615 evas_object_event_callback_add(ao, EVAS_CALLBACK_DEL, access_del_cb, handle);
616 DbgPrint("[%s] Register access info: (%s) to, %p (%p)\n", part, text, handle->parent, ao);
620 ErrPrint("[%s] is not exists\n", part);
623 return LB_STATUS_SUCCESS;
626 PUBLIC int script_operate_access(void *_h, Evas *e, const char *id, const char *part, const char *operation, const char *option)
628 struct info *handle = _h;
630 struct obj_info *obj_info;
631 Elm_Access_Action_Info action_info;
634 if (!operation || !strlen(operation)) {
635 return LB_STATUS_ERROR_INVALID;
638 edje = find_edje(handle, id);
640 ErrPrint("No such object: %s\n", id);
641 return LB_STATUS_ERROR_NOT_EXIST;
644 obj_info = evas_object_data_get(edje, "obj_info");
646 ErrPrint("Object info is not available\n");
647 return LB_STATUS_ERROR_FAULT;
650 memset(&action_info, 0, sizeof(action_info));
652 /* OPERATION is defined in liblivebox package */
653 if (!strcasecmp(operation, "set,hl")) {
655 Evas_Object *edje_part;
661 edje_part = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(edje), part);
663 ErrPrint("Invalid part: %s\n", part);
667 evas_object_geometry_get(edje_part, &x, &y, &w, &h);
669 action_info.x = x + w / 2;
670 action_info.y = x + h / 2;
671 } else if (option && sscanf(option, "%dx%d", &action_info.x, &action_info.y) == 2) {
673 ErrPrint("Insufficient info for HL\n");
677 DbgPrint("TXxTY: %dx%d\n", action_info.x, action_info.y);
678 ret = elm_access_action(edje, ELM_ACCESS_ACTION_HIGHLIGHT, &action_info);
679 if (ret == EINA_FALSE) {
680 ErrPrint("Action error\n");
682 } else if (!strcasecmp(operation, "unset,hl")) {
683 ret = elm_access_action(edje, ELM_ACCESS_ACTION_UNHIGHLIGHT, &action_info);
684 if (ret == EINA_FALSE) {
685 ErrPrint("Action error\n");
687 } else if (!strcasecmp(operation, "next,hl")) {
688 action_info.highlight_cycle = (!!option) && (!!strcasecmp(option, "no,cycle"));
690 ret = elm_access_action(edje, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, &action_info);
691 if (ret == EINA_FALSE) {
692 ErrPrint("Action error\n");
694 } else if (!strcasecmp(operation, "prev,hl")) {
695 action_info.highlight_cycle = EINA_TRUE;
696 ret = elm_access_action(edje, ELM_ACCESS_ACTION_HIGHLIGHT_PREV, &action_info);
697 if (ret == EINA_FALSE) {
698 ErrPrint("Action error\n");
700 } else if (!strcasecmp(operation, "reset,focus")) {
701 DbgPrint("Reset Focus\n");
702 elm_object_focus_custom_chain_set(edje, NULL);
706 return LB_STATUS_SUCCESS;
709 static inline void apply_shadow_effect(struct image_option *img_opt, Evas_Object *img)
711 ea_effect_h *ea_effect;
713 if (!img_opt->shadow.enabled) {
717 ea_effect = ea_image_effect_create();
722 // -90, 2, 4, 0x99000000
723 ea_image_effect_add_outer_shadow(ea_effect, img_opt->shadow.angle, img_opt->shadow.offset, img_opt->shadow.softness, img_opt->shadow.color);
724 ea_object_image_effect_set(img, ea_effect);
726 ea_image_effect_destroy(ea_effect);
729 PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *part, const char *path, const char *option)
731 struct info *handle = _h;
736 struct obj_info *obj_info;
738 struct image_option img_opt = {
741 .fill = FILL_DISABLE,
749 edje = find_edje(handle, id);
751 ErrPrint("No such object: %s\n", id);
752 return LB_STATUS_ERROR_NOT_EXIST;
755 obj_info = evas_object_data_get(edje, "obj_info");
757 ErrPrint("Object info is not available\n");
758 return LB_STATUS_ERROR_FAULT;
761 img = elm_object_part_content_unset(edje, part);
766 EINA_LIST_FOREACH_SAFE(obj_info->children, l, n, child) {
767 if (child->obj != img) {
771 obj_info->children = eina_list_remove(obj_info->children, child);
777 DbgPrint("delete object %s %p\n", part, img);
778 evas_object_del(img);
781 if (!path || !strlen(path) || access(path, R_OK) != 0) {
782 DbgPrint("SKIP - Path: [%s]\n", path);
783 return LB_STATUS_SUCCESS;
786 child = malloc(sizeof(*child));
788 ErrPrint("Heap: %s\n", strerror(errno));
789 return LB_STATUS_ERROR_MEMORY;
792 child->part = strdup(part);
794 ErrPrint("Heap: %s\n", strerror(errno));
796 return LB_STATUS_ERROR_MEMORY;
799 img = evas_object_image_add(e);
801 ErrPrint("Failed to add an image object\n");
804 return LB_STATUS_ERROR_FAULT;
807 evas_object_image_preload(img, EINA_FALSE);
808 parse_image_option(option, &img_opt);
809 evas_object_image_load_orientation_set(img, img_opt.orient);
811 evas_object_image_file_set(img, path, NULL);
812 err = evas_object_image_load_error_get(img);
813 if (err != EVAS_LOAD_ERROR_NONE) {
814 ErrPrint("Load error: %s\n", evas_load_error_str(err));
815 evas_object_del(img);
818 return LB_STATUS_ERROR_IO;
821 apply_shadow_effect(&img_opt, img);
823 evas_object_image_size_get(img, &w, &h);
824 if (img_opt.aspect) {
825 if (img_opt.fill == FILL_OVER_SIZE) {
829 if (img_opt.width >= 0 && img_opt.height >= 0) {
830 part_w = img_opt.width * elm_config_scale_get();
831 part_h = img_opt.height * elm_config_scale_get();
835 edje_object_part_geometry_get(elm_layout_edje_get(edje), part, NULL, NULL, &part_w, &part_h);
837 DbgPrint("Original %dx%d (part: %dx%d)\n", w, h, part_w, part_h);
839 if (part_w > w || part_h > h) {
843 fw = (double)part_w / (double)w;
844 fh = (double)part_h / (double)h;
855 if (!part_w || !part_h || !w || !h) {
856 evas_object_del(img);
859 return LB_STATUS_ERROR_INVALID;
862 if (evas_object_image_region_support_get(img)) {
863 evas_object_image_load_region_set(img, (w - part_w) / 2, (h - part_h) / 2, part_w, part_h);
864 evas_object_image_load_size_set(img, part_w, part_h);
865 evas_object_image_filled_set(img, EINA_TRUE);
866 //evas_object_image_fill_set(img, 0, 0, part_w, part_h);
867 DbgPrint("Size: %dx%d (region: %dx%d - %dx%d)\n", w, h, (w - part_w) / 2, (h - part_h) / 2, part_w, part_h);
871 Evas_Object *src_img;
875 DbgPrint("Part loading is not supported\n");
876 ee = ecore_evas_buffer_new(part_w, part_h);
878 ErrPrint("Failed to create a EE\n");
879 evas_object_del(img);
882 return LB_STATUS_ERROR_FAULT;
885 ecore_evas_alpha_set(ee, EINA_TRUE);
887 e = ecore_evas_get(ee);
889 ErrPrint("Unable to get Evas\n");
892 evas_object_del(img);
895 return LB_STATUS_ERROR_FAULT;
898 src_img = evas_object_image_filled_add(e);
900 ErrPrint("Unable to add an image\n");
903 evas_object_del(img);
906 return LB_STATUS_ERROR_FAULT;
909 evas_object_image_alpha_set(src_img, EINA_TRUE);
910 evas_object_image_colorspace_set(src_img, EVAS_COLORSPACE_ARGB8888);
911 evas_object_image_smooth_scale_set(src_img, EINA_TRUE);
912 evas_object_image_load_orientation_set(src_img, img_opt.orient);
913 evas_object_image_file_set(src_img, path, NULL);
914 err = evas_object_image_load_error_get(src_img);
915 if (err != EVAS_LOAD_ERROR_NONE) {
916 ErrPrint("Load error: %s\n", evas_load_error_str(err));
917 evas_object_del(src_img);
920 evas_object_del(img);
923 return LB_STATUS_ERROR_IO;
925 evas_object_image_size_get(src_img, &rw, &rh);
926 evas_object_image_fill_set(src_img, 0, 0, rw, rh);
927 evas_object_resize(src_img, w, h);
928 evas_object_move(src_img, -(w - part_w) / 2, -(h - part_h) / 2);
929 evas_object_show(src_img);
931 data = ecore_evas_buffer_pixels_get(ee);
933 ErrPrint("Unable to get pixels\n");
934 evas_object_del(src_img);
937 evas_object_del(img);
940 return LB_STATUS_ERROR_IO;
943 e = evas_object_evas_get(img);
944 evas_object_del(img);
945 img = evas_object_image_filled_add(e);
947 evas_object_del(src_img);
952 return LB_STATUS_ERROR_MEMORY;
955 evas_object_image_colorspace_set(img, EVAS_COLORSPACE_ARGB8888);
956 evas_object_image_smooth_scale_set(img, EINA_TRUE);
957 evas_object_image_alpha_set(img, EINA_TRUE);
958 evas_object_image_data_set(img, NULL);
959 evas_object_image_size_set(img, part_w, part_h);
960 evas_object_resize(img, part_w, part_h);
961 evas_object_image_data_copy_set(img, (void *)data);
962 evas_object_image_fill_set(img, 0, 0, part_w, part_h);
963 evas_object_image_data_update_add(img, 0, 0, part_w, part_h);
965 evas_object_del(src_img);
968 apply_shadow_effect(&img_opt, img);
970 } else if (img_opt.fill == FILL_IN_SIZE) {
974 if (img_opt.width >= 0 && img_opt.height >= 0) {
975 part_w = img_opt.width * elm_config_scale_get();
976 part_h = img_opt.height * elm_config_scale_get();
980 edje_object_part_geometry_get(elm_layout_edje_get(edje), part, NULL, NULL, &part_w, &part_h);
982 DbgPrint("Original %dx%d (part: %dx%d)\n", w, h, part_w, part_h);
984 if (part_w > w || part_h > h) {
988 fw = (double)part_w / (double)w;
989 fh = (double)part_h / (double)h;
999 DbgPrint("Size: %dx%d\n", w, h);
1000 evas_object_image_fill_set(img, 0, 0, part_w, part_h);
1001 evas_object_size_hint_fill_set(img, EVAS_HINT_FILL, EVAS_HINT_FILL);
1002 evas_object_size_hint_weight_set(img, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1004 evas_object_image_fill_set(img, 0, 0, w, h);
1005 evas_object_size_hint_fill_set(img, EVAS_HINT_FILL, EVAS_HINT_FILL);
1006 evas_object_size_hint_aspect_set(img, EVAS_ASPECT_CONTROL_BOTH, w, h);
1009 if (img_opt.width >= 0 && img_opt.height >= 0) {
1012 DbgPrint("Using given image size: %dx%d\n", w, h);
1015 evas_object_image_fill_set(img, 0, 0, w, h);
1016 evas_object_size_hint_fill_set(img, EVAS_HINT_FILL, EVAS_HINT_FILL);
1017 evas_object_size_hint_weight_set(img, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1018 evas_object_image_filled_set(img, EINA_TRUE);
1024 * object will be shown by below statement automatically
1026 DbgPrint("%s part swallow image %p (%dx%d)\n", part, img, w, h);
1028 elm_object_part_content_set(edje, part, img);
1029 obj_info->children = eina_list_append(obj_info->children, child);
1033 * This object is not registered as an access object.
1034 * So the developer should add it to access list manually, using DESC_ACCESS block.
1036 return LB_STATUS_SUCCESS;
1039 static void script_signal_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
1041 struct info *handle = data;
1053 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1054 edje_object_part_geometry_get(elm_layout_edje_get(obj), source, &px, &py, &pw, &ph);
1058 sx = (double)px / (double)w;
1059 ex = (double)(px + pw) / (double)w;
1064 sy = (double)py / (double)h;
1065 ey = (double)(py + ph) / (double)h;
1068 script_signal_emit(handle->e, source, emission, sx, sy, ex, ey);
1071 static void edje_del_cb(void *_info, Evas *e, Evas_Object *obj, void *event_info)
1073 struct info *handle = _info;
1074 struct obj_info *obj_info;
1075 struct obj_info *parent_obj_info;
1076 struct child *child;
1078 handle->obj_list = eina_list_remove(handle->obj_list, obj);
1080 obj_info = evas_object_data_del(obj, "obj_info");
1082 ErrPrint("Object info is not valid\n");
1086 DbgPrint("delete object %s %p\n", obj_info->id, obj);
1087 parent_obj_info = evas_object_data_get(obj_info->parent, "obj_info");
1088 if (parent_obj_info) {
1092 EINA_LIST_FOREACH_SAFE(parent_obj_info->children, l, n, child) {
1093 if (child->obj != obj) {
1099 * If this code is executed,
1100 * The parent is not deleted by desc, this object is deleted by itself.
1101 * It is not possible, but we care it.
1103 DbgPrint("Parent's children is updated: %s\n", child->part);
1104 parent_obj_info->children = eina_list_remove(parent_obj_info->children, child);
1110 DbgPrint("Parent EDJE\n");
1113 elm_object_signal_callback_del(obj, "*", "*", script_signal_cb);
1115 EINA_LIST_FREE(obj_info->children, child) {
1116 DbgPrint("delete object %s %p\n", child->part, child->obj);
1118 evas_object_del(child->obj);
1128 static inline Evas_Object *get_highlighted_object(Evas_Object *obj)
1130 Evas_Object *o, *ho;
1132 o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp");
1137 ho = evas_object_data_get(o, "_elm_access_target");
1142 LB_ACCESS_HIGHLIGHT 0
1143 LB_ACCESS_HIGHLIGHT_NEXT 1
1144 LB_ACCESS_HIGHLIGHT_PREV 2
1145 LB_ACCESS_ACTIVATE 3
1149 PUBLIC int script_feed_event(void *h, Evas *e, int event_type, int x, int y, int down, unsigned int keycode, double timestamp)
1151 struct info *handle = h;
1153 struct obj_info *obj_info;
1154 int ret = LB_STATUS_SUCCESS;
1156 edje = find_edje(handle, NULL); /*!< Get the base layout */
1158 ErrPrint("Base layout is not exist\n");
1159 return LB_STATUS_ERROR_NOT_EXIST;
1162 obj_info = evas_object_data_get(edje, "obj_info");
1164 ErrPrint("Object info is not valid\n");
1165 return LB_STATUS_ERROR_INVALID;
1168 if (event_type & LB_SCRIPT_ACCESS_EVENT) {
1169 Elm_Access_Action_Info info;
1170 Elm_Access_Action_Type action;
1172 memset(&info, 0, sizeof(info));
1174 if ((event_type & LB_SCRIPT_ACCESS_HIGHLIGHT) == LB_SCRIPT_ACCESS_HIGHLIGHT) {
1175 action = ELM_ACCESS_ACTION_HIGHLIGHT;
1178 ret = elm_access_action(edje, action, &info);
1179 DbgPrint("ACCESS_HIGHLIGHT: %dx%d returns %d\n", x, y, ret);
1180 if (ret == EINA_TRUE) {
1181 if (!get_highlighted_object(edje)) {
1182 ErrPrint("Highlighted object is not found\n");
1183 ret = LB_ACCESS_STATUS_ERROR;
1185 DbgPrint("Highlighted object is found\n");
1186 ret = LB_ACCESS_STATUS_DONE;
1189 ErrPrint("Action error\n");
1190 ret = LB_ACCESS_STATUS_ERROR;
1192 } else if ((event_type & LB_SCRIPT_ACCESS_HIGHLIGHT_NEXT) == LB_SCRIPT_ACCESS_HIGHLIGHT_NEXT) {
1193 action = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
1194 info.highlight_cycle = EINA_FALSE;
1195 ret = elm_access_action(edje, action, &info);
1196 DbgPrint("ACCESS_HIGHLIGHT_NEXT, returns %d\n", ret);
1197 ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_LAST : LB_ACCESS_STATUS_DONE;
1198 } else if ((event_type & LB_SCRIPT_ACCESS_HIGHLIGHT_PREV) == LB_SCRIPT_ACCESS_HIGHLIGHT_PREV) {
1199 action = ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
1200 info.highlight_cycle = EINA_FALSE;
1201 ret = elm_access_action(edje, action, &info);
1202 DbgPrint("ACCESS_HIGHLIGHT_PREV, returns %d\n", ret);
1203 ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_FIRST : LB_ACCESS_STATUS_DONE;
1204 } else if ((event_type & LB_SCRIPT_ACCESS_ACTIVATE) == LB_SCRIPT_ACCESS_ACTIVATE) {
1205 action = ELM_ACCESS_ACTION_ACTIVATE;
1206 ret = elm_access_action(edje, action, &info);
1207 DbgPrint("ACCESS_ACTIVATE, returns %d\n", ret);
1208 ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
1209 } else if ((event_type & LB_SCRIPT_ACCESS_ACTION) == LB_SCRIPT_ACCESS_ACTION) {
1211 action = ELM_ACCESS_ACTION_UP;
1212 ret = elm_access_action(edje, action, &info);
1213 DbgPrint("ACCESS_ACTION(%d), returns %d\n", down, ret);
1214 ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
1215 } else if (down == 1) {
1216 action = ELM_ACCESS_ACTION_DOWN;
1217 ret = elm_access_action(edje, action, &info);
1218 DbgPrint("ACCESS_ACTION(%d), returns %d\n", down, ret);
1219 ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
1221 ErrPrint("Invalid access event\n");
1222 ret = LB_ACCESS_STATUS_ERROR;
1224 } else if ((event_type & LB_SCRIPT_ACCESS_SCROLL) == LB_SCRIPT_ACCESS_SCROLL) {
1225 action = ELM_ACCESS_ACTION_SCROLL;
1230 info.mouse_type = 0;
1231 ret = elm_access_action(edje, action, &info);
1232 DbgPrint("ACCESS_HIGHLIGHT_SCROLL, returns %d\n", ret);
1233 ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
1236 info.mouse_type = 1;
1237 ret = elm_access_action(edje, action, &info);
1238 DbgPrint("ACCESS_HIGHLIGHT_SCROLL, returns %d\n", ret);
1239 ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
1242 info.mouse_type = 2;
1243 ret = elm_access_action(edje, action, &info);
1244 DbgPrint("ACCESS_HIGHLIGHT_SCROLL, returns %d\n", ret);
1245 ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
1248 ret = LB_ACCESS_STATUS_ERROR;
1251 } else if ((event_type & LB_SCRIPT_ACCESS_UNHIGHLIGHT) == LB_SCRIPT_ACCESS_UNHIGHLIGHT) {
1252 action = ELM_ACCESS_ACTION_UNHIGHLIGHT;
1253 ret = elm_access_action(edje, action, &info);
1254 DbgPrint("ACCESS_UNHIGHLIGHT, returns %d\n", ret);
1255 ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
1257 DbgPrint("Invalid event\n");
1258 ret = LB_ACCESS_STATUS_ERROR;
1261 } else if (event_type & LB_SCRIPT_MOUSE_EVENT) {
1262 double cur_timestamp;
1264 #if defined(_USE_ECORE_TIME_GET)
1265 cur_timestamp = ecore_time_get();
1268 if (gettimeofday(&tv, NULL) < 0) {
1269 ErrPrint("Failed to get time\n");
1270 cur_timestamp = 0.0f;
1272 cur_timestamp = (double)tv.tv_sec + ((double)tv.tv_usec / 1000000.0f);
1275 if (cur_timestamp - timestamp > 0.1f && handle->is_mouse_down == 0) {
1276 DbgPrint("Discard lazy event : %lf\n", cur_timestamp - timestamp);
1277 return LB_STATUS_SUCCESS;
1280 switch (event_type) {
1281 case LB_SCRIPT_MOUSE_DOWN:
1282 if (handle->is_mouse_down == 0) {
1283 evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
1284 evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, (timestamp + 0.01f) * 1000, NULL);
1285 handle->is_mouse_down = 1;
1288 case LB_SCRIPT_MOUSE_MOVE:
1289 evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
1291 case LB_SCRIPT_MOUSE_UP:
1292 if (handle->is_mouse_down == 1) {
1293 evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
1294 evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, (timestamp + 0.01f) * 1000, NULL);
1295 handle->is_mouse_down = 0;
1298 case LB_SCRIPT_MOUSE_IN:
1299 evas_event_feed_mouse_in(e, timestamp * 1000, NULL);
1301 case LB_SCRIPT_MOUSE_OUT:
1302 evas_event_feed_mouse_out(e, timestamp * 1000, NULL);
1305 return LB_STATUS_ERROR_INVALID;
1307 } else if (event_type & LB_SCRIPT_KEY_EVENT) {
1308 const char *keyname = "";
1309 const char *key = "";
1310 const char *string = "";
1311 const char *compose = "";
1313 switch (event_type) {
1314 case LB_SCRIPT_KEY_DOWN:
1315 evas_event_feed_key_down(e, keyname, key, string, compose, timestamp * 1000, NULL);
1316 ret = LB_KEY_STATUS_DONE;
1319 * If the keyname == RIGHT, Need to check that
1320 * Does it reach to the last focusable object?
1324 * if (REACH to the LAST) {
1325 * ret = LB_KEY_STATUS_LAST;
1327 * ret = LB_KEY_STATUS_DONE;
1330 * if (REACH to the FIRST) {
1331 * ret = LB_KEY_STATUS_FIRST;
1333 * ret = LB_KEY_STATUS_DONE;
1337 case LB_SCRIPT_KEY_UP:
1338 evas_event_feed_key_up(e, keyname, key, string, compose, timestamp * 1000, NULL);
1339 ret = LB_KEY_STATUS_DONE;
1341 case LB_SCRIPT_KEY_FOCUS_IN:
1342 // evas_event_callback_call(e, EVAS_CALLBACK_CANVAS_FOCUS_IN, NULL);
1343 ret = LB_KEY_STATUS_DONE;
1345 case LB_SCRIPT_KEY_FOCUS_OUT:
1346 // evas_event_callback_call(e, EVAS_CALLBACK_CANVAS_FOCUS_OUT, NULL);
1347 ret = LB_KEY_STATUS_DONE;
1350 DbgPrint("Event is not implemented\n");
1351 ret = LB_KEY_STATUS_ERROR;
1360 PUBLIC int script_update_script(void *h, Evas *e, const char *src_id, const char *target_id, const char *part, const char *path, const char *group)
1362 struct info *handle = h;
1365 struct obj_info *obj_info;
1366 struct child *child;
1367 char _target_id[32];
1369 edje = find_edje(handle, src_id);
1371 ErrPrint("Edje is not exists (%s)\n", src_id);
1372 return LB_STATUS_ERROR_NOT_EXIST;
1375 obj_info = evas_object_data_get(edje, "obj_info");
1377 ErrPrint("Object info is not valid\n");
1378 return LB_STATUS_ERROR_INVALID;
1381 obj = elm_object_part_content_unset(edje, part);
1386 EINA_LIST_FOREACH_SAFE(obj_info->children, l, n, child) {
1387 if (child->obj != obj) {
1391 obj_info->children = eina_list_remove(obj_info->children, child);
1398 DbgPrint("delete object %s %p\n", part, obj);
1401 * This will call the edje_del_cb.
1402 * It will delete all access objects
1404 evas_object_del(obj);
1407 if (!path || !strlen(path) || access(path, R_OK) != 0) {
1408 DbgPrint("SKIP - Path: [%s]\n", path);
1409 return LB_STATUS_SUCCESS;
1413 if (find_edje(handle, part)) {
1417 #if defined(_USE_ECORE_TIME_GET)
1418 timestamp = ecore_time_get();
1421 if (gettimeofday(&tv, NULL) < 0) {
1422 static int local_idx = 0;
1423 timestamp = (double)(local_idx++);
1425 timestamp = (double)tv.tv_sec + ((double)tv.tv_usec / 1000000.0f);
1429 snprintf(_target_id, sizeof(_target_id), "%lf", timestamp);
1430 } while (find_edje(handle, _target_id));
1432 target_id = _target_id;
1437 DbgPrint("Anonymouse target id: %s\n", target_id);
1440 obj = elm_layout_add(edje);
1442 ErrPrint("Failed to add a new edje object\n");
1443 return LB_STATUS_ERROR_FAULT;
1446 edje_object_scale_set(elm_layout_edje_get(obj), elm_config_scale_get());
1448 if (!elm_layout_file_set(obj, path, group)) {
1450 err = edje_object_load_error_get(elm_layout_edje_get(obj));
1451 ErrPrint("Could not load %s from %s: %s\n", group, path, edje_load_error_str(err));
1452 evas_object_del(obj);
1453 return LB_STATUS_ERROR_IO;
1456 evas_object_show(obj);
1458 obj_info = calloc(1, sizeof(*obj_info));
1460 ErrPrint("Failed to add a obj_info\n");
1461 evas_object_del(obj);
1462 return LB_STATUS_ERROR_MEMORY;
1465 obj_info->id = strdup(target_id);
1466 if (!obj_info->id) {
1467 ErrPrint("Failed to add a obj_info\n");
1469 evas_object_del(obj);
1470 return LB_STATUS_ERROR_MEMORY;
1473 obj_info->parent = edje;
1475 child = malloc(sizeof(*child));
1477 ErrPrint("Error: %s\n", strerror(errno));
1480 evas_object_del(obj);
1481 return LB_STATUS_ERROR_MEMORY;
1484 child->part = strdup(part);
1486 ErrPrint("Error: %s\n", strerror(errno));
1490 evas_object_del(obj);
1491 return LB_STATUS_ERROR_MEMORY;
1496 evas_object_data_set(obj, "obj_info", obj_info);
1497 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, edje_del_cb, handle);
1498 elm_object_signal_callback_add(obj, "*", "*", script_signal_cb, handle);
1499 handle->obj_list = eina_list_append(handle->obj_list, obj);
1501 DbgPrint("%s part swallow edje %p\n", part, obj);
1502 elm_object_part_content_set(edje, part, obj);
1504 obj_info = evas_object_data_get(edje, "obj_info");
1505 obj_info->children = eina_list_append(obj_info->children, child);
1507 return LB_STATUS_SUCCESS;
1510 PUBLIC int script_update_signal(void *h, Evas *e, const char *id, const char *part, const char *signal)
1512 struct info *handle = h;
1515 edje = find_edje(handle, id);
1517 return LB_STATUS_ERROR_NOT_EXIST;
1520 elm_object_signal_emit(edje, signal, part);
1521 return LB_STATUS_SUCCESS;
1524 PUBLIC int script_update_drag(void *h, Evas *e, const char *id, const char *part, double x, double y)
1526 struct info *handle = h;
1529 edje = find_edje(handle, id);
1531 return LB_STATUS_ERROR_NOT_EXIST;
1534 edje_object_part_drag_value_set(elm_layout_edje_get(edje), part, x, y);
1535 return LB_STATUS_SUCCESS;
1538 PUBLIC int script_update_size(void *han, Evas *e, const char *id, int w, int h)
1540 struct info *handle = han;
1543 edje = find_edje(handle, id);
1545 return LB_STATUS_ERROR_NOT_EXIST;
1553 DbgPrint("Resize object to %dx%d\n", w, h);
1554 evas_object_resize(edje, w, h);
1555 return LB_STATUS_SUCCESS;
1558 PUBLIC int script_update_category(void *h, Evas *e, const char *id, const char *category)
1560 struct info *handle = h;
1562 if (handle->category) {
1563 free(handle->category);
1564 handle->category = NULL;
1568 return LB_STATUS_SUCCESS;
1571 handle->category = strdup(category);
1572 if (!handle->category) {
1573 ErrPrint("Error: %s\n", strerror(errno));
1574 return LB_STATUS_ERROR_MEMORY;
1577 return LB_STATUS_SUCCESS;
1580 PUBLIC void *script_create(const char *file, const char *group)
1582 struct info *handle;
1584 handle = calloc(1, sizeof(*handle));
1586 ErrPrint("Error: %s\n", strerror(errno));
1590 handle->file = strdup(file);
1591 if (!handle->file) {
1592 ErrPrint("Error: %s\n", strerror(errno));
1597 handle->group = strdup(group);
1598 if (!handle->group) {
1599 ErrPrint("Error: %s\n", strerror(errno));
1605 s_info.handle_list = eina_list_append(s_info.handle_list, handle);
1610 PUBLIC int script_destroy(void *_handle)
1612 struct info *handle;
1617 if (!eina_list_data_find(s_info.handle_list, handle)) {
1618 DbgPrint("Not found (already deleted?)\n");
1619 return LB_STATUS_ERROR_NOT_EXIST;
1622 s_info.handle_list = eina_list_remove(s_info.handle_list, handle);
1624 edje = eina_list_nth(handle->obj_list, 0);
1626 evas_object_del(edje);
1629 free(handle->category);
1631 free(handle->group);
1633 return LB_STATUS_SUCCESS;
1636 PUBLIC int script_load(void *_handle, Evas *e, int w, int h)
1638 struct info *handle;
1640 struct obj_info *obj_info;
1644 obj_info = calloc(1, sizeof(*obj_info));
1646 ErrPrint("Heap: %s\n", strerror(errno));
1647 return LB_STATUS_ERROR_MEMORY;
1650 obj_info->parent = evas_object_rectangle_add(e);
1651 if (!obj_info->parent) {
1652 ErrPrint("Unable to create a parent box\n");
1654 return LB_STATUS_ERROR_FAULT;
1657 edje = elm_layout_add(obj_info->parent);
1659 ErrPrint("Failed to create an edje object\n");
1660 evas_object_del(obj_info->parent);
1662 return LB_STATUS_ERROR_FAULT;
1665 edje_object_scale_set(elm_layout_edje_get(edje), elm_config_scale_get());
1667 if (!elm_layout_file_set(edje, handle->file, handle->group)) {
1670 err = edje_object_load_error_get(elm_layout_edje_get(edje));
1671 ErrPrint("Could not load %s from %s: %s\n", handle->group, handle->file, edje_load_error_str(err));
1672 evas_object_del(edje);
1673 evas_object_del(obj_info->parent);
1675 return LB_STATUS_ERROR_IO;
1681 handle->parent = edje;
1683 elm_object_signal_callback_add(edje, "*", "*", script_signal_cb, handle);
1684 evas_object_event_callback_add(edje, EVAS_CALLBACK_DEL, edje_del_cb, handle);
1685 evas_object_size_hint_weight_set(edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1686 evas_object_size_hint_fill_set(edje, EVAS_HINT_FILL, EVAS_HINT_FILL);
1687 evas_object_resize(edje, handle->w, handle->h);
1688 evas_object_show(edje);
1689 evas_object_data_set(edje, "obj_info", obj_info);
1691 handle->obj_list = eina_list_append(handle->obj_list, edje);
1692 return LB_STATUS_SUCCESS;
1695 PUBLIC int script_unload(void *_handle, Evas *e)
1697 struct info *handle;
1699 Evas_Object *parent = NULL;
1703 edje = eina_list_nth(handle->obj_list, 0);
1705 struct obj_info *obj_info;
1707 obj_info = evas_object_data_get(edje, "obj_info");
1709 parent = obj_info->parent;
1711 evas_object_del(edje);
1715 DbgPrint("Delete parent box\n");
1716 evas_object_del(parent);
1720 return LB_STATUS_SUCCESS;
1723 static void access_cb(keynode_t *node, void *user_data)
1728 if (vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &state) != 0) {
1729 ErrPrint("Idle lock state is not valid\n");
1730 state = 0; /* DISABLED */
1733 state = vconf_keynode_get_bool(node);
1736 DbgPrint("ELM CONFIG ACCESS: %d\n", state);
1737 elm_config_access_set(state);
1738 s_info.access_on = state;
1741 static void update_font_cb(void *data)
1743 elm_config_font_overlay_set(TEXT_CLASS, s_info.font_name, DEFAULT_FONT_SIZE);
1744 DbgPrint("Update text class %s (%s, %d)\n", TEXT_CLASS, s_info.font_name, DEFAULT_FONT_SIZE);
1747 static void font_changed_cb(keynode_t *node, void *user_data)
1753 if (s_info.font_name) {
1754 font_name = vconf_get_str("db/setting/accessibility/font_name");
1756 ErrPrint("Invalid font name (NULL)\n");
1760 if (!strcmp(s_info.font_name, font_name)) {
1761 DbgPrint("Font is not changed (Old: %s(%p) <> New: %s(%p))\n", s_info.font_name, s_info.font_name, font_name, font_name);
1766 DbgPrint("Release old font name: %s(%p)\n", s_info.font_name, s_info.font_name);
1767 free(s_info.font_name);
1772 * Get the first font name using system_settings API.
1775 ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, &font_name);
1776 if (ret != SYSTEM_SETTINGS_ERROR_NONE || !font_name) {
1777 ErrPrint("System setting get: %d, font_name[%p]\n", ret, font_name);
1782 s_info.font_name = font_name;
1783 DbgPrint("Font name is changed to %s(%p)\n", s_info.font_name, s_info.font_name);
1787 * Try to update all liveboxes
1789 update_font_cb(NULL);
1792 static inline int convert_font_size(int size)
1795 case SYSTEM_SETTINGS_FONT_SIZE_SMALL:
1798 case SYSTEM_SETTINGS_FONT_SIZE_NORMAL:
1801 case SYSTEM_SETTINGS_FONT_SIZE_LARGE:
1804 case SYSTEM_SETTINGS_FONT_SIZE_HUGE:
1807 case SYSTEM_SETTINGS_FONT_SIZE_GIANT:
1815 DbgPrint("Return size: %d\n", size);
1819 static void font_size_cb(system_settings_key_e key, void *user_data)
1823 if (system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &size) != SYSTEM_SETTINGS_ERROR_NONE) {
1827 size = convert_font_size(size);
1829 if (size == s_info.font_size) {
1830 DbgPrint("Font size is not changed\n");
1834 s_info.font_size = size;
1835 DbgPrint("Font size is changed to %d, but don't update the font info\n", size);
1838 PUBLIC int script_init(double scale)
1846 /* ecore is already initialized */
1848 elm_config_scale_set(scale);
1849 DbgPrint("Scale is updated: %lf\n", scale);
1851 ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, access_cb, NULL);
1852 DbgPrint("TTS changed: %d\n", ret);
1854 ret = vconf_notify_key_changed("db/setting/accessibility/font_name", font_changed_cb, NULL);
1855 DbgPrint("System font is changed: %d\n", ret);
1857 ret = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE, font_size_cb, NULL);
1858 DbgPrint("System font size is changed: %d\n", ret);
1860 access_cb(NULL, NULL);
1861 font_changed_cb(NULL, NULL);
1862 font_size_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE, NULL);
1863 return LB_STATUS_SUCCESS;
1866 PUBLIC int script_fini(void)
1871 struct info *handle;
1873 EINA_LIST_FOREACH_SAFE(s_info.handle_list, l, n, handle) {
1874 script_destroy(handle);
1877 ret = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE);
1878 DbgPrint("Unset font size change event callback: %d\n", ret);
1880 ret = vconf_ignore_key_changed("db/setting/accessibility/font_name", font_changed_cb);
1881 DbgPrint("Unset font name change event callback: %d\n", ret);
1883 ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, access_cb);
1884 DbgPrint("Unset tts: %d\n", ret);
1888 free(s_info.font_name);
1889 s_info.font_name = NULL;
1890 return LB_STATUS_SUCCESS;