427bbb4ce0572922cca750c14e78e7bab96a8635
[framework/uifw/elementary.git] / src / lib / elm_main.c
1 #ifdef HAVE_CONFIG_H
2 # include "elementary_config.h"
3 #endif
4
5 #ifdef HAVE_FORK
6 #include <dlfcn.h> /* dlopen,dlclose,etc */
7 #endif
8
9 #ifdef HAVE_CRT_EXTERNS_H
10 # include <crt_externs.h>
11 #endif
12
13 #ifdef HAVE_EVIL
14 # include <Evil.h>
15 #endif
16
17 #include <Elementary.h>
18 #include "elm_priv.h"
19
20 #define SEMI_BROKEN_QUICKLAUNCH 1
21
22 static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV };
23 EAPI Elm_Version *elm_version = &_version;
24
25 Eina_Bool
26 _elm_dangerous_call_check(const char *call)
27 {
28    char buf[256];
29    const char *eval;
30
31    snprintf(buf, sizeof(buf), "%i.%i.%i.%i", VMAJ, VMIN, VMIC, VREV);
32    eval = getenv("ELM_NO_FINGER_WAGGLING");
33    if ((eval) && (!strcmp(eval, buf)))
34      return 0;
35    printf("ELEMENTARY FINGER WAGGLE!!!!!!!!!!\n"
36           "\n"
37           "  %s() used.\n"
38           "PLEASE see the API documentation for this function. This call\n"
39           "should almost never be used. Only in very special cases.\n"
40           "\n"
41           "To remove this warning please set the environment variable:\n"
42           "  ELM_NO_FINGER_WAGGLING\n"
43           "To the value of the Elementary version + revision number. e.g.:\n"
44           "  1.2.5.40295\n"
45           "\n"
46           ,
47           call);
48    return 1;
49 }
50
51 static Eina_Bool _elm_signal_exit(void *data,
52                                   int   ev_type,
53                                   void *ev);
54
55 static Eina_Prefix *pfx = NULL;
56 char *_elm_appname = NULL;
57 const char *_elm_data_dir = NULL;
58 const char *_elm_lib_dir = NULL;
59 int _elm_log_dom = -1;
60
61 EAPI int ELM_EVENT_POLICY_CHANGED = 0;
62
63 static int _elm_init_count = 0;
64 static int _elm_sub_init_count = 0;
65 static int _elm_ql_init_count = 0;
66 static int _elm_policies[ELM_POLICY_LAST];
67 static Ecore_Event_Handler *_elm_exit_handler = NULL;
68 static Eina_Bool quicklaunch_on = 0;
69
70 static Eina_Bool
71 _elm_signal_exit(void *data  __UNUSED__,
72                  int ev_type __UNUSED__,
73                  void *ev    __UNUSED__)
74 {
75    elm_exit();
76    return ECORE_CALLBACK_PASS_ON;
77 }
78
79 void
80 _elm_rescale(void)
81 {
82    edje_scale_set(_elm_config->scale);
83    _elm_win_rescale(NULL, EINA_FALSE);
84 }
85
86 static void *app_mainfunc = NULL;
87 static const char *app_domain = NULL;
88 static const char *app_checkfile = NULL;
89
90 static const char *app_compile_bin_dir = NULL;
91 static const char *app_compile_lib_dir = NULL;
92 static const char *app_compile_data_dir = NULL;
93 static const char *app_compile_locale_dir = NULL;
94 static const char *app_prefix_dir = NULL;
95 static const char *app_bin_dir = NULL;
96 static const char *app_lib_dir = NULL;
97 static const char *app_data_dir = NULL;
98 static const char *app_locale_dir = NULL;
99
100 static Eina_Prefix *app_pfx = NULL;
101
102 static void
103 _prefix_check(void)
104 {
105    int argc = 0;
106    char **argv = NULL;
107    const char *dirs[4] = { NULL, NULL, NULL, NULL };
108    char *caps = NULL, *p1, *p2;
109
110    if (app_pfx) return;
111    if (!app_domain) return;
112
113    ecore_app_args_get(&argc, &argv);
114    if (argc < 1) return;
115
116    dirs[0] = app_compile_bin_dir;
117    dirs[1] = app_compile_lib_dir;
118    dirs[2] = app_compile_data_dir;
119    dirs[3] = app_compile_locale_dir;
120
121    if (!dirs[1]) dirs[1] = dirs[0];
122    if (!dirs[0]) dirs[0] = dirs[1];
123    if (!dirs[3]) dirs[3] = dirs[2];
124    if (!dirs[2]) dirs[2] = dirs[3];
125
126    if (app_domain)
127      {
128         caps = alloca(strlen(app_domain) + 1);
129         for (p1 = (char *)app_domain, p2 = caps; *p1; p1++, p2++)
130            *p2 = toupper(*p1);
131         *p2 = 0;
132      }
133    app_pfx = eina_prefix_new(argv[0], app_mainfunc, caps, app_domain,
134                              app_checkfile, dirs[0], dirs[1], dirs[2], dirs[3]);
135 }
136
137 static void
138 _prefix_shutdown(void)
139 {
140    if (app_pfx) eina_prefix_free(app_pfx);
141    if (app_domain) eina_stringshare_del(app_domain);
142    if (app_checkfile) eina_stringshare_del(app_checkfile);
143    if (app_compile_bin_dir) eina_stringshare_del(app_compile_bin_dir);
144    if (app_compile_lib_dir) eina_stringshare_del(app_compile_lib_dir);
145    if (app_compile_data_dir) eina_stringshare_del(app_compile_data_dir);
146    if (app_compile_locale_dir) eina_stringshare_del(app_compile_locale_dir);
147    if (app_prefix_dir) eina_stringshare_del(app_prefix_dir);
148    if (app_bin_dir) eina_stringshare_del(app_bin_dir);
149    if (app_lib_dir) eina_stringshare_del(app_lib_dir);
150    if (app_data_dir) eina_stringshare_del(app_data_dir);
151    if (app_locale_dir) eina_stringshare_del(app_locale_dir);
152    app_mainfunc = NULL;
153    app_domain = NULL;
154    app_checkfile = NULL;
155    app_compile_bin_dir = NULL;
156    app_compile_lib_dir = NULL;
157    app_compile_data_dir = NULL;
158    app_compile_locale_dir = NULL;
159    app_prefix_dir = NULL;
160    app_bin_dir = NULL;
161    app_lib_dir = NULL;
162    app_data_dir = NULL;
163    app_locale_dir = NULL;
164    app_pfx = NULL;
165 }
166
167 EAPI int
168 elm_init(int    argc,
169          char **argv)
170 {
171    _elm_init_count++;
172    if (_elm_init_count > 1) return _elm_init_count;
173    elm_quicklaunch_init(argc, argv);
174    elm_quicklaunch_sub_init(argc, argv);
175    _prefix_shutdown();
176    return _elm_init_count;
177 }
178
179 EAPI int
180 elm_shutdown(void)
181 {
182    _elm_init_count--;
183    if (_elm_init_count > 0) return _elm_init_count;
184    _elm_win_shutdown();
185    while (_elm_win_deferred_free) ecore_main_loop_iterate();
186 // wrningz :(
187 //   _prefix_shutdown();
188    elm_quicklaunch_sub_shutdown();
189    elm_quicklaunch_shutdown();
190    return _elm_init_count;
191 }
192
193 EAPI void
194 elm_app_info_set(void *mainfunc, const char *dom, const char *checkfile)
195 {
196    app_mainfunc = mainfunc;
197    eina_stringshare_replace(&app_domain, dom);
198    eina_stringshare_replace(&app_checkfile, checkfile);
199 }
200
201 EAPI void
202 elm_app_compile_bin_dir_set(const char *dir)
203 {
204    eina_stringshare_replace(&app_compile_bin_dir, dir);
205 }
206
207 EAPI void
208 elm_app_compile_lib_dir_set(const char *dir)
209 {
210    eina_stringshare_replace(&app_compile_lib_dir, dir);
211 }
212
213 EAPI void
214 elm_app_compile_data_dir_set(const char *dir)
215 {
216    eina_stringshare_replace(&app_compile_data_dir, dir);
217 }
218
219 EAPI void
220 elm_app_compile_locale_set(const char *dir)
221 {
222    eina_stringshare_replace(&app_compile_locale_dir, dir);
223 }
224
225 EAPI const char *
226 elm_app_prefix_dir_get(void)
227 {
228    if (app_prefix_dir) return app_prefix_dir;
229    _prefix_check();
230   if (!app_pfx) return "";
231    app_prefix_dir = eina_prefix_get(app_pfx);
232    return app_prefix_dir;
233 }
234
235 EAPI const char *
236 elm_app_bin_dir_get(void)
237 {
238    if (app_bin_dir) return app_bin_dir;
239    _prefix_check();
240    if (!app_pfx) return "";
241    app_bin_dir = eina_prefix_bin_get(app_pfx);
242    return app_bin_dir;
243 }
244
245 EAPI const char *
246 elm_app_lib_dir_get(void)
247 {
248    if (app_lib_dir) return app_lib_dir;
249    _prefix_check();
250    if (!app_pfx) return "";
251    app_lib_dir = eina_prefix_lib_get(app_pfx);
252    return app_lib_dir;
253 }
254
255 EAPI const char *
256 elm_app_data_dir_get(void)
257 {
258    if (app_data_dir) return app_data_dir;
259    _prefix_check();
260    if (!app_pfx) return "";
261    app_data_dir = eina_prefix_data_get(app_pfx);
262    return app_data_dir;
263 }
264
265 EAPI const char *
266 elm_app_locale_dir_get(void)
267 {
268    if (app_locale_dir) return app_locale_dir;
269    _prefix_check();
270    if (!app_pfx) return "";
271    app_locale_dir = eina_prefix_locale_get(app_pfx);
272    return app_locale_dir;
273 }
274
275 #ifdef ELM_EDBUS
276 static int _elm_need_e_dbus = 0;
277 #endif
278 EAPI Eina_Bool
279 elm_need_e_dbus(void)
280 {
281 #ifdef ELM_EDBUS
282    if (_elm_need_e_dbus++) return EINA_TRUE;
283    e_dbus_init();
284    return EINA_TRUE;
285 #else
286    return EINA_FALSE;
287 #endif
288 }
289
290 static void
291 _elm_unneed_e_dbus(void)
292 {
293 #ifdef ELM_EDBUS
294    if (--_elm_need_e_dbus) return;
295
296    _elm_need_e_dbus = 0;
297    e_dbus_shutdown();
298 #endif
299 }
300
301 #ifdef ELM_EFREET
302 static int _elm_need_efreet = 0;
303 #endif
304 EAPI Eina_Bool
305 elm_need_efreet(void)
306 {
307 #ifdef ELM_EFREET
308    if (_elm_need_efreet++) return EINA_TRUE;
309    efreet_init();
310    efreet_mime_init();
311    efreet_trash_init();
312     /*
313      {
314         Eina_List **list;
315
316         list = efreet_icon_extra_list_get();
317         if (list)
318           {
319              e_user_dir_concat_static(buf, "icons");
320              *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
321              e_prefix_data_concat_static(buf, "data/icons");
322              *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
323           }
324      }
325    */
326    return EINA_TRUE;
327 #else
328    return EINA_FALSE;
329 #endif
330 }
331
332 static void
333 _elm_unneed_efreet(void)
334 {
335 #ifdef ELM_EFREET
336    if (--_elm_need_efreet) return;
337
338    _elm_need_efreet = 0;
339    efreet_trash_shutdown();
340    efreet_mime_shutdown();
341    efreet_shutdown();
342 #endif
343 }
344
345 EAPI void
346 elm_quicklaunch_mode_set(Eina_Bool ql_on)
347 {
348    quicklaunch_on = ql_on;
349 }
350
351 EAPI Eina_Bool
352 elm_quicklaunch_mode_get(void)
353 {
354    return quicklaunch_on;
355 }
356
357 EAPI int
358 elm_quicklaunch_init(int    argc,
359                      char **argv)
360 {
361    _elm_ql_init_count++;
362    if (_elm_ql_init_count > 1) return _elm_ql_init_count;
363    eina_init();
364    _elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE);
365    if (!_elm_log_dom)
366      {
367         EINA_LOG_ERR("could not register elementary log domain.");
368         _elm_log_dom = EINA_LOG_DOMAIN_GLOBAL;
369      }
370
371    eet_init();
372    ecore_init();
373
374 #ifdef HAVE_ELEMENTARY_EMAP
375    emap_init();
376 #endif
377    ecore_app_args_set(argc, (const char **)argv);
378
379    memset(_elm_policies, 0, sizeof(_elm_policies));
380    if (!ELM_EVENT_POLICY_CHANGED)
381      ELM_EVENT_POLICY_CHANGED = ecore_event_type_new();
382
383    ecore_file_init();
384
385    _elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, NULL);
386
387    if (argv) _elm_appname = strdup(ecore_file_file_get(argv[0]));
388
389    pfx = eina_prefix_new(NULL, elm_quicklaunch_init,
390                          "ELM", "elementary", "config/profile.cfg",
391                          PACKAGE_LIB_DIR, /* don't have a bin dir currently */
392                          PACKAGE_LIB_DIR,
393                          PACKAGE_DATA_DIR,
394                          LOCALE_DIR);
395    if (pfx)
396      {
397         _elm_data_dir = eina_stringshare_add(eina_prefix_data_get(pfx));
398         _elm_lib_dir = eina_stringshare_add(eina_prefix_lib_get(pfx));
399      }
400    if (!_elm_data_dir) _elm_data_dir = eina_stringshare_add("/");
401    if (!_elm_lib_dir) _elm_lib_dir = eina_stringshare_add("/");
402
403    _elm_config_init();
404    return _elm_ql_init_count;
405 }
406
407 EAPI int
408 elm_quicklaunch_sub_init(int    argc,
409                          char **argv)
410 {
411    _elm_sub_init_count++;
412    if (_elm_sub_init_count > 1) return _elm_sub_init_count;
413    if (quicklaunch_on)
414      {
415 #ifdef SEMI_BROKEN_QUICKLAUNCH
416         return _elm_sub_init_count;
417 #endif
418      }
419    if (!quicklaunch_on)
420      {
421         ecore_app_args_set(argc, (const char **)argv);
422         evas_init();
423         edje_init();
424         _elm_module_init();
425         _elm_config_sub_init();
426 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
427         if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
428             ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
429             ENGINE_COMPARE(ELM_XRENDER_X11) ||
430             ENGINE_COMPARE(ELM_OPENGL_X11))
431 #undef ENGINE_COMPARE
432           {
433 #ifdef HAVE_ELEMENTARY_X
434              ecore_x_init(NULL);
435 #endif
436           }
437         ecore_evas_init(); // FIXME: check errors
438         ecore_imf_init();
439         ecore_con_init();
440         ecore_con_url_init();
441      }
442    return _elm_sub_init_count;
443 }
444
445 EAPI int
446 elm_quicklaunch_sub_shutdown(void)
447 {
448    _elm_sub_init_count--;
449    if (_elm_sub_init_count > 0) return _elm_sub_init_count;
450    if (quicklaunch_on)
451      {
452 #ifdef SEMI_BROKEN_QUICKLAUNCH
453         return _elm_sub_init_count;
454 #endif
455      }
456    if (!quicklaunch_on)
457      {
458         _elm_win_shutdown();
459         _elm_module_shutdown();
460         ecore_con_url_shutdown();
461         ecore_con_shutdown();
462         ecore_imf_shutdown();
463         ecore_evas_shutdown();
464 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
465         if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
466             ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
467             ENGINE_COMPARE(ELM_XRENDER_X11) ||
468             ENGINE_COMPARE(ELM_OPENGL_X11))
469 #undef ENGINE_COMPARE
470           {
471 #ifdef HAVE_ELEMENTARY_X
472              ecore_x_disconnect();
473 #endif
474           }
475 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
476         if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
477             ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
478             ENGINE_COMPARE(ELM_XRENDER_X11) ||
479             ENGINE_COMPARE(ELM_OPENGL_X11) ||
480             ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
481             ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
482             ENGINE_COMPARE(ELM_OPENGL_SDL) ||
483             ENGINE_COMPARE(ELM_SOFTWARE_WIN32) ||
484             ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
485 #undef ENGINE_COMPARE
486           evas_cserve_disconnect();
487         edje_shutdown();
488         evas_shutdown();
489      }
490    return _elm_sub_init_count;
491 }
492
493 EAPI int
494 elm_quicklaunch_shutdown(void)
495 {
496    _elm_ql_init_count--;
497    if (_elm_ql_init_count > 0) return _elm_ql_init_count;
498    if (pfx) eina_prefix_free(pfx);
499    pfx = NULL;
500    eina_stringshare_del(_elm_data_dir);
501    _elm_data_dir = NULL;
502    eina_stringshare_del(_elm_lib_dir);
503    _elm_lib_dir = NULL;
504
505    free(_elm_appname);
506    _elm_appname = NULL;
507
508    _elm_config_shutdown();
509
510    ecore_event_handler_del(_elm_exit_handler);
511    _elm_exit_handler = NULL;
512
513    _elm_theme_shutdown();
514    _elm_unneed_efreet();
515    _elm_unneed_e_dbus();
516    _elm_unneed_ethumb();
517    _elm_unneed_web();
518    ecore_file_shutdown();
519
520 #ifdef HAVE_ELEMENTARY_EMAP
521    emap_shutdown();
522 #endif
523
524    ecore_shutdown();
525    eet_shutdown();
526
527    if ((_elm_log_dom > -1) && (_elm_log_dom != EINA_LOG_DOMAIN_GLOBAL))
528      {
529         eina_log_domain_unregister(_elm_log_dom);
530         _elm_log_dom = -1;
531      }
532
533    _elm_widget_type_clear();
534
535    eina_shutdown();
536    return _elm_ql_init_count;
537 }
538
539 EAPI void
540 elm_quicklaunch_seed(void)
541 {
542 #ifndef SEMI_BROKEN_QUICKLAUNCH
543    if (quicklaunch_on)
544      {
545         Evas_Object *win, *bg, *bt;
546
547         win = elm_win_add(NULL, "seed", ELM_WIN_BASIC);
548         bg = elm_bg_add(win);
549         elm_win_resize_object_add(win, bg);
550         evas_object_show(bg);
551         bt = elm_button_add(win);
552         elm_button_label_set(bt, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~-_=+\\|]}[{;:'\",<.>/?");
553         elm_win_resize_object_add(win, bt);
554         ecore_main_loop_iterate();
555         evas_object_del(win);
556         ecore_main_loop_iterate();
557 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
558         if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
559             ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
560             ENGINE_COMPARE(ELM_XRENDER_X11) ||
561             ENGINE_COMPARE(ELM_OPENGL_X11))
562 #undef ENGINE_COMPARE
563           {
564 # ifdef HAVE_ELEMENTARY_X
565              ecore_x_sync();
566 # endif
567           }
568         ecore_main_loop_iterate();
569      }
570 #endif
571 }
572
573 static void *qr_handle = NULL;
574 static int (*qr_main)(int    argc,
575                       char **argv) = NULL;
576
577 EAPI Eina_Bool
578 elm_quicklaunch_prepare(int argc __UNUSED__,
579                         char   **argv)
580 {
581 #ifdef HAVE_FORK
582    char *exe = elm_quicklaunch_exe_path_get(argv[0]);
583    if (!exe)
584      {
585         ERR("requested quicklaunch binary '%s' does not exist\n", argv[0]);
586         return EINA_FALSE;
587      }
588    else
589      {
590         char *exe2, *p;
591         char *exename;
592
593         exe2 = malloc(strlen(exe) + 1 + 10);
594         strcpy(exe2, exe);
595         p = strrchr(exe2, '/');
596         if (p) p++;
597         else p = exe2;
598         exename = alloca(strlen(p) + 1);
599         strcpy(exename, p);
600         *p = 0;
601         strcat(p, "../lib/");
602         strcat(p, exename);
603         strcat(p, ".so");
604         if (!access(exe2, R_OK | X_OK))
605           {
606              free(exe);
607              exe = exe2;
608           }
609         else
610           free(exe2);
611      }
612    qr_handle = dlopen(exe, RTLD_NOW | RTLD_GLOBAL);
613    if (!qr_handle)
614      {
615         fprintf(stderr, "dlerr: %s\n", dlerror());
616         WRN("dlopen('%s') failed: %s", exe, dlerror());
617         free(exe);
618         return EINA_FALSE;
619      }
620    INF("dlopen('%s') = %p", exe, qr_handle);
621    qr_main = dlsym(qr_handle, "elm_main");
622    INF("dlsym(%p, 'elm_main') = %p", qr_handle, qr_main);
623    if (!qr_main)
624      {
625         WRN("not quicklauncher capable: no elm_main in '%s'", exe);
626         dlclose(qr_handle);
627         qr_handle = NULL;
628         free(exe);
629         return EINA_FALSE;
630      }
631    free(exe);
632    return EINA_TRUE;
633 #else
634    return EINA_FALSE;
635    (void)argv;
636 #endif
637 }
638
639 #ifdef HAVE_FORK
640 static void
641 save_env(void)
642 {
643    int i, size;
644    extern char **environ;
645    char **oldenv, **p;
646
647    oldenv = environ;
648
649    for (i = 0, size = 0; environ[i]; i++)
650      size += strlen(environ[i]) + 1;
651
652    p = malloc((i + 1) * sizeof(char *));
653    if (!p) return;
654
655    environ = p;
656
657    for (i = 0; oldenv[i]; i++)
658      environ[i] = strdup(oldenv[i]);
659    environ[i] = NULL;
660 }
661
662 #endif
663
664 EAPI Eina_Bool
665 elm_quicklaunch_fork(int    argc,
666                      char **argv,
667                      char  *cwd,
668                      void (postfork_func) (void *data),
669                      void  *postfork_data)
670 {
671 #ifdef HAVE_FORK
672    pid_t child;
673    int ret;
674    int real_argc;
675    char **real_argv;
676
677    // FIXME:
678    // need to accept current environment from elementary_run
679    if (!qr_main)
680      {
681         int i;
682         char **args;
683
684         child = fork();
685         if (child > 0) return EINA_TRUE;
686         else if (child < 0)
687           {
688              perror("could not fork");
689              return EINA_FALSE;
690           }
691         setsid();
692         if (chdir(cwd) != 0)
693           perror("could not chdir");
694         args = alloca((argc + 1) * sizeof(char *));
695         for (i = 0; i < argc; i++) args[i] = argv[i];
696         args[argc] = NULL;
697         WRN("%s not quicklaunch capable, fallback...", argv[0]);
698         execvp(argv[0], args);
699         ERR("failed to execute '%s': %s", argv[0], strerror(errno));
700         exit(-1);
701      }
702    child = fork();
703    if (child > 0) return EINA_TRUE;
704    else if (child < 0)
705      {
706         perror("could not fork");
707         return EINA_FALSE;
708      }
709    if (postfork_func) postfork_func(postfork_data);
710
711    if (quicklaunch_on)
712      {
713 #ifdef SEMI_BROKEN_QUICKLAUNCH
714         ecore_app_args_set(argc, (const char **)argv);
715         evas_init();
716         edje_init();
717         _elm_config_sub_init();
718 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
719         if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
720             ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
721             ENGINE_COMPARE(ELM_XRENDER_X11) ||
722             ENGINE_COMPARE(ELM_OPENGL_X11))
723 #undef ENGINE_COMPARE
724           {
725 # ifdef HAVE_ELEMENTARY_X
726              ecore_x_init(NULL);
727 # endif
728           }
729         ecore_evas_init(); // FIXME: check errors
730         ecore_imf_init();
731         _elm_module_init();
732 #endif
733      }
734
735    setsid();
736    if (chdir(cwd) != 0)
737      perror("could not chdir");
738    // FIXME: this is very linux specific. it changes argv[0] of the process
739    // so ps etc. report what you'd expect. for other unixes and os's this
740    // may just not work
741    save_env();
742    if (argv)
743      {
744         char *lastarg, *p;
745
746         ecore_app_args_get(&real_argc, &real_argv);
747         lastarg = real_argv[real_argc - 1] + strlen(real_argv[real_argc - 1]);
748         for (p = real_argv[0]; p < lastarg; p++) *p = 0;
749         strcpy(real_argv[0], argv[0]);
750      }
751    ecore_app_args_set(argc, (const char **)argv);
752    ret = qr_main(argc, argv);
753    exit(ret);
754    return EINA_TRUE;
755 #else
756    return EINA_FALSE;
757    (void)argc;
758    (void)argv;
759    (void)cwd;
760    (void)postfork_func;
761    (void)postfork_data;
762 #endif
763 }
764
765 EAPI void
766 elm_quicklaunch_cleanup(void)
767 {
768 #ifdef HAVE_FORK
769    if (qr_handle)
770      {
771         dlclose(qr_handle);
772         qr_handle = NULL;
773         qr_main = NULL;
774      }
775 #endif
776 }
777
778 EAPI int
779 elm_quicklaunch_fallback(int    argc,
780                          char **argv)
781 {
782    int ret;
783    elm_quicklaunch_init(argc, argv);
784    elm_quicklaunch_sub_init(argc, argv);
785    elm_quicklaunch_prepare(argc, argv);
786    ret = qr_main(argc, argv);
787    exit(ret);
788    return ret;
789 }
790
791 EAPI char *
792 elm_quicklaunch_exe_path_get(const char *exe)
793 {
794    static char *path = NULL;
795    static Eina_List *pathlist = NULL;
796    const char *pathitr;
797    const Eina_List *l;
798    char buf[PATH_MAX];
799    if (exe[0] == '/') return strdup(exe);
800    if ((exe[0] == '.') && (exe[1] == '/')) return strdup(exe);
801    if ((exe[0] == '.') && (exe[1] == '.') && (exe[2] == '/')) return strdup(exe);
802    if (!path)
803      {
804         const char *p, *pp;
805         char *buf2;
806         path = getenv("PATH");
807         buf2 = alloca(strlen(path) + 1);
808         p = path;
809         pp = p;
810         for (;; )
811           {
812              if ((*p == ':') || (!*p))
813                {
814                   int len;
815
816                   len = p - pp;
817                   strncpy(buf2, pp, len);
818                   buf2[len] = 0;
819                   pathlist = eina_list_append(pathlist, eina_stringshare_add(buf2));
820                   if (!*p) break;
821                   p++;
822                   pp = p;
823                }
824              else
825                {
826                   if (!*p) break;
827                   p++;
828                }
829           }
830      }
831    EINA_LIST_FOREACH(pathlist, l, pathitr)
832      {
833         snprintf(buf, sizeof(buf), "%s/%s", pathitr, exe);
834         if (!access(buf, R_OK | X_OK)) return strdup(buf);
835      }
836    return NULL;
837 }
838
839 EAPI void
840 elm_run(void)
841 {
842    ecore_main_loop_begin();
843 }
844
845 EAPI void
846 elm_exit(void)
847 {
848    ecore_main_loop_quit();
849 }
850
851 EAPI Eina_Bool
852 elm_policy_set(unsigned int policy,
853                int          value)
854 {
855    Elm_Event_Policy_Changed *ev;
856
857    if (policy >= ELM_POLICY_LAST)
858      return EINA_FALSE;
859
860    if (value == _elm_policies[policy])
861      return EINA_TRUE;
862
863    /* TODO: validade policy? */
864
865    ev = malloc(sizeof(*ev));
866    ev->policy = policy;
867    ev->new_value = value;
868    ev->old_value = _elm_policies[policy];
869
870    _elm_policies[policy] = value;
871
872    ecore_event_add(ELM_EVENT_POLICY_CHANGED, ev, NULL, NULL);
873
874    return EINA_TRUE;
875 }
876
877 EAPI int
878 elm_policy_get(unsigned int policy)
879 {
880    if (policy >= ELM_POLICY_LAST)
881      return 0;
882    return _elm_policies[policy];
883 }
884
885 EAPI void
886 elm_language_set(const char *lang)
887 {
888    setlocale(LC_ALL, lang);
889    _elm_win_translate();
890 }
891
892 EAPI Eina_Bool
893 elm_object_mirrored_get(const Evas_Object *obj)
894 {
895    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
896    return elm_widget_mirrored_get(obj);
897 }
898
899 EAPI void
900 elm_object_mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
901 {
902    EINA_SAFETY_ON_NULL_RETURN(obj);
903    elm_widget_mirrored_set(obj, mirrored);
904 }
905
906 EAPI Eina_Bool
907 elm_object_mirrored_automatic_get(const Evas_Object *obj)
908 {
909    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
910    return elm_widget_mirrored_automatic_get(obj);
911 }
912
913 EAPI void
914 elm_object_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic)
915 {
916    EINA_SAFETY_ON_NULL_RETURN(obj);
917    elm_widget_mirrored_automatic_set(obj, automatic);
918 }
919
920 EAPI void
921 elm_object_scale_set(Evas_Object *obj,
922                      double       scale)
923 {
924    EINA_SAFETY_ON_NULL_RETURN(obj);
925    elm_widget_scale_set(obj, scale);
926 }
927
928 EAPI double
929 elm_object_scale_get(const Evas_Object *obj)
930 {
931    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, 0.0);
932    return elm_widget_scale_get(obj);
933 }
934
935 EAPI void
936 elm_object_text_part_set(Evas_Object *obj, const char *part, const char *label)
937 {
938    EINA_SAFETY_ON_NULL_RETURN(obj);
939    elm_widget_text_part_set(obj, part, label);
940 }
941
942 EAPI const char *
943 elm_object_text_part_get(const Evas_Object *obj, const char *part)
944 {
945    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
946    return elm_widget_text_part_get(obj, part);
947 }
948
949 EAPI void
950 elm_object_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *text)
951 {
952    EINA_SAFETY_ON_NULL_RETURN(obj);
953    elm_widget_domain_translatable_text_part_set(obj, part, domain, text);
954 }
955
956 EAPI const char *
957 elm_object_translatable_text_part_get(const Evas_Object *obj, const char *part)
958 {
959    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
960    return elm_widget_translatable_text_part_get(obj, part);
961 }
962
963 EAPI void
964 elm_object_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content)
965 {
966    EINA_SAFETY_ON_NULL_RETURN(obj);
967    elm_widget_content_part_set(obj, part, content);
968 }
969
970 EAPI Evas_Object *
971 elm_object_content_part_get(const Evas_Object *obj, const char *part)
972 {
973    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
974    return elm_widget_content_part_get(obj, part);
975 }
976
977 EAPI Evas_Object *
978 elm_object_content_part_unset(Evas_Object *obj, const char *part)
979 {
980    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
981    return elm_widget_content_part_unset(obj, part);
982 }
983
984 EAPI double
985 elm_scale_get(void)
986 {
987    return _elm_config->scale;
988 }
989
990 EAPI void
991 elm_scale_set(double scale)
992 {
993    if (_elm_config->scale == scale) return;
994    _elm_config->scale = scale;
995    _elm_rescale();
996 }
997
998 EAPI void
999 elm_scale_all_set(double scale)
1000 {
1001 #ifdef HAVE_ELEMENTARY_X
1002    static Ecore_X_Atom atom = 0;
1003    unsigned int scale_i = (unsigned int)(scale * 1000.0);
1004
1005    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_SCALE");
1006    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1007                                   atom, &scale_i, 1);
1008 #endif
1009 }
1010
1011 EAPI Eina_Bool
1012 elm_password_show_last_get(void)
1013 {
1014    return _elm_config->password_show_last;
1015 }
1016
1017 EAPI void
1018 elm_password_show_last_set(Eina_Bool password_show_last)
1019 {
1020    if (_elm_config->password_show_last == password_show_last) return;
1021    _elm_config->password_show_last = password_show_last;
1022    edje_password_show_last_set(_elm_config->password_show_last);
1023 }
1024
1025 EAPI double
1026 elm_password_show_last_timeout_get(void)
1027 {
1028    return _elm_config->password_show_last_timeout;
1029 }
1030
1031 EAPI void
1032 elm_password_show_last_timeout_set(double password_show_last_timeout)
1033 {
1034    if (_elm_config->password_show_last_timeout == password_show_last_timeout) return;
1035    _elm_config->password_show_last_timeout = password_show_last_timeout;
1036    edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
1037 }
1038
1039 EAPI void
1040 elm_object_style_set(Evas_Object *obj,
1041                      const char  *style)
1042 {
1043    EINA_SAFETY_ON_NULL_RETURN(obj);
1044    elm_widget_style_set(obj, style);
1045 }
1046
1047 EAPI const char *
1048 elm_object_style_get(const Evas_Object *obj)
1049 {
1050    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1051    return elm_widget_style_get(obj);
1052 }
1053
1054 EAPI void
1055 elm_object_disabled_set(Evas_Object *obj,
1056                         Eina_Bool    disabled)
1057 {
1058    EINA_SAFETY_ON_NULL_RETURN(obj);
1059    elm_widget_disabled_set(obj, disabled);
1060 }
1061
1062 EAPI Eina_Bool
1063 elm_object_disabled_get(const Evas_Object *obj)
1064 {
1065    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1066    return elm_widget_disabled_get(obj);
1067 }
1068
1069 EAPI Eina_Bool
1070 elm_config_save(void)
1071 {
1072    return _elm_config_save();
1073 }
1074
1075 EAPI void
1076 elm_config_reload(void)
1077 {
1078    _elm_config_reload();
1079 }
1080
1081 EAPI const char *
1082 elm_profile_current_get(void)
1083 {
1084    return _elm_config_current_profile_get();
1085 }
1086
1087 EAPI const char *
1088 elm_profile_dir_get(const char *profile,
1089                     Eina_Bool   is_user)
1090 {
1091    return _elm_config_profile_dir_get(profile, is_user);
1092 }
1093
1094 EAPI void
1095 elm_profile_dir_free(const char *p_dir)
1096 {
1097    free((void *)p_dir);
1098 }
1099
1100 EAPI Eina_List *
1101 elm_profile_list_get(void)
1102 {
1103    return _elm_config_profiles_list();
1104 }
1105
1106 EAPI void
1107 elm_profile_list_free(Eina_List *l)
1108 {
1109    const char *dir;
1110
1111    EINA_LIST_FREE(l, dir)
1112      eina_stringshare_del(dir);
1113 }
1114
1115 EAPI void
1116 elm_profile_set(const char *profile)
1117 {
1118    EINA_SAFETY_ON_NULL_RETURN(profile);
1119    _elm_config_profile_set(profile);
1120 }
1121
1122 EAPI void
1123 elm_profile_all_set(const char *profile)
1124 {
1125 #ifdef HAVE_ELEMENTARY_X
1126    static Ecore_X_Atom atom = 0;
1127
1128    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_PROFILE");
1129    ecore_x_window_prop_string_set(ecore_x_window_root_first_get(),
1130                                   atom, profile);
1131 #endif
1132 }
1133
1134 EAPI const char *
1135 elm_engine_current_get(void)
1136 {
1137    return _elm_config->engine;
1138 }
1139
1140 EAPI void
1141 elm_engine_set(const char *engine)
1142 {
1143    EINA_SAFETY_ON_NULL_RETURN(engine);
1144
1145    _elm_config_engine_set(engine);
1146 }
1147
1148 EAPI const Eina_List *
1149 elm_text_classes_list_get(void)
1150 {
1151    return _elm_config_text_classes_get();
1152 }
1153
1154 EAPI void
1155 elm_text_classes_list_free(const Eina_List *list)
1156 {
1157    _elm_config_text_classes_free((Eina_List *)list);
1158 }
1159
1160 EAPI const Eina_List *
1161 elm_font_overlay_list_get(void)
1162 {
1163    return _elm_config_font_overlays_list();
1164 }
1165
1166 EAPI void
1167 elm_font_overlay_set(const char    *text_class,
1168                      const char    *font,
1169                      Evas_Font_Size size)
1170 {
1171    _elm_config_font_overlay_set(text_class, font, size);
1172 }
1173
1174 EAPI void
1175 elm_font_overlay_unset(const char *text_class)
1176 {
1177    _elm_config_font_overlay_remove(text_class);
1178 }
1179
1180 EAPI void
1181 elm_font_overlay_apply(void)
1182 {
1183    _elm_config_font_overlay_apply();
1184 }
1185
1186 EAPI void
1187 elm_font_overlay_all_apply(void)
1188 {
1189 #ifdef HAVE_ELEMENTARY_X
1190    static Ecore_X_Atom atom = 0;
1191    unsigned int dummy = (unsigned int)(1 * 1000.0);
1192
1193    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FONT_OVERLAY");
1194    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(), atom, &dummy,
1195                                   1);
1196 #endif
1197 }
1198
1199 EAPI Elm_Font_Properties *
1200 elm_font_properties_get(const char *font)
1201 {
1202    EINA_SAFETY_ON_NULL_RETURN_VAL(font, NULL);
1203    return _elm_font_properties_get(NULL, font);
1204 }
1205
1206 EAPI void
1207 elm_font_properties_free(Elm_Font_Properties *efp)
1208 {
1209    const char *str;
1210
1211    EINA_SAFETY_ON_NULL_RETURN(efp);
1212    EINA_LIST_FREE(efp->styles, str)
1213      if (str) eina_stringshare_del(str);
1214    if (efp->name) eina_stringshare_del(efp->name);
1215    free(efp);
1216 }
1217
1218 EAPI const char *
1219 elm_font_fontconfig_name_get(const char *name,
1220                              const char *style)
1221 {
1222    char buf[256];
1223
1224    EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);
1225    if (!style || style[0] == 0) return eina_stringshare_add(name);
1226    snprintf(buf, 256, "%s" ELM_FONT_TOKEN_STYLE "%s", name, style);
1227    return eina_stringshare_add(buf);
1228 }
1229
1230 EAPI void
1231 elm_font_fontconfig_name_free(const char *name)
1232 {
1233    eina_stringshare_del(name);
1234 }
1235
1236 EAPI Eina_Hash *
1237 elm_font_available_hash_add(Eina_List *list)
1238 {
1239    Eina_Hash *font_hash;
1240    Eina_List *l;
1241    void *key;
1242
1243    font_hash = NULL;
1244
1245    /* populate with default font families */
1246    font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Regular");
1247    font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Bold");
1248    font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Oblique");
1249    font_hash = _elm_font_available_hash_add(font_hash,
1250                                             "Sans:style=Bold Oblique");
1251
1252    font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Regular");
1253    font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Bold");
1254    font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Oblique");
1255    font_hash = _elm_font_available_hash_add(font_hash,
1256                                             "Serif:style=Bold Oblique");
1257
1258    font_hash = _elm_font_available_hash_add(font_hash,
1259                                             "Monospace:style=Regular");
1260    font_hash = _elm_font_available_hash_add(font_hash,
1261                                             "Monospace:style=Bold");
1262    font_hash = _elm_font_available_hash_add(font_hash,
1263                                             "Monospace:style=Oblique");
1264    font_hash = _elm_font_available_hash_add(font_hash,
1265                                             "Monospace:style=Bold Oblique");
1266
1267    EINA_LIST_FOREACH(list, l, key)
1268      font_hash = _elm_font_available_hash_add(font_hash, key);
1269
1270    return font_hash;
1271 }
1272
1273 EAPI void
1274 elm_font_available_hash_del(Eina_Hash *hash)
1275 {
1276    _elm_font_available_hash_del(hash);
1277 }
1278
1279 EAPI Evas_Coord
1280 elm_finger_size_get(void)
1281 {
1282    return _elm_config->finger_size;
1283 }
1284
1285 EAPI void
1286 elm_finger_size_set(Evas_Coord size)
1287 {
1288    if (_elm_config->finger_size == size) return;
1289    _elm_config->finger_size = size;
1290    _elm_rescale();
1291 }
1292
1293 EAPI void
1294 elm_finger_size_all_set(Evas_Coord size)
1295 {
1296 #ifdef HAVE_ELEMENTARY_X
1297    static Ecore_X_Atom atom = 0;
1298    unsigned int size_i = (unsigned int)size;
1299
1300    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FINGER_SIZE");
1301    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1302                                   atom, &size_i, 1);
1303 #endif
1304 }
1305
1306 EAPI void
1307 elm_autocapitalization_allow_all_set(Eina_Bool on)
1308 {
1309 #ifdef HAVE_ELEMENTARY_X
1310    static Ecore_X_Atom atom = 0;
1311    unsigned int on_i = (unsigned int)on;
1312
1313    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_AUTOCAPITAL_ALLOW");
1314    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1315                                   atom, &on_i, 1);
1316 #endif
1317 }
1318
1319 EAPI void
1320 elm_autoperiod_allow_all_set(Eina_Bool on)
1321 {
1322 #ifdef HAVE_ELEMENTARY_X
1323    static Ecore_X_Atom atom = 0;
1324    unsigned int on_i = (unsigned int)on;
1325
1326    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_AUTOPERIOD_ALLOW");
1327    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1328                                   atom, &on_i, 1);
1329 #endif
1330 }
1331
1332 EAPI void
1333 elm_coords_finger_size_adjust(int         times_w,
1334                               Evas_Coord *w,
1335                               int         times_h,
1336                               Evas_Coord *h)
1337 {
1338    if ((w) && (*w < (_elm_config->finger_size * times_w)))
1339      *w = _elm_config->finger_size * times_w;
1340    if ((h) && (*h < (_elm_config->finger_size * times_h)))
1341      *h = _elm_config->finger_size * times_h;
1342 }
1343
1344 EAPI void
1345 elm_all_flush(void)
1346 {
1347    const Eina_List *l;
1348    Evas_Object *obj;
1349
1350    edje_file_cache_flush();
1351    edje_collection_cache_flush();
1352    eet_clearcache();
1353    EINA_LIST_FOREACH(_elm_win_list, l, obj)
1354      {
1355         Evas *e = evas_object_evas_get(obj);
1356         evas_image_cache_flush(e);
1357         evas_font_cache_flush(e);
1358         evas_render_dump(e);
1359      }
1360 }
1361
1362 EAPI int
1363 elm_cache_flush_interval_get(void)
1364 {
1365    return _elm_config->cache_flush_poll_interval;
1366 }
1367
1368 EAPI void
1369 elm_cache_flush_interval_set(int size)
1370 {
1371    if (_elm_config->cache_flush_poll_interval == size) return;
1372    _elm_config->cache_flush_poll_interval = size;
1373
1374    _elm_recache();
1375 }
1376
1377 EAPI void
1378 elm_cache_flush_interval_all_set(int size)
1379 {
1380 #ifdef HAVE_ELEMENTARY_X
1381    static Ecore_X_Atom atom = 0;
1382    unsigned int size_i = (unsigned int)size;
1383
1384    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_CACHE_FLUSH_INTERVAL");
1385    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1386                                   atom, &size_i, 1);
1387 #endif
1388 }
1389
1390 EAPI Eina_Bool
1391 elm_cache_flush_enabled_get(void)
1392 {
1393    return _elm_config->cache_flush_enable;
1394 }
1395
1396 EAPI void
1397 elm_cache_flush_enabled_set(Eina_Bool enabled)
1398 {
1399    enabled = !!enabled;
1400    if (_elm_config->cache_flush_enable == enabled) return;
1401    _elm_config->cache_flush_enable = enabled;
1402
1403    _elm_recache();
1404 }
1405
1406 EAPI void
1407 elm_cache_flush_enabled_all_set(Eina_Bool enabled)
1408 {
1409 #ifdef HAVE_ELEMENTARY_X
1410    static Ecore_X_Atom atom = 0;
1411    unsigned int enabled_i = (unsigned int)enabled;
1412
1413    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_CACHE_FLUSH_ENABLE");
1414    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1415                                   atom, &enabled_i, 1);
1416 #endif
1417 }
1418
1419 EAPI int
1420 elm_font_cache_get(void)
1421 {
1422    return _elm_config->font_cache;
1423 }
1424
1425 EAPI void
1426 elm_font_cache_set(int size)
1427 {
1428    if (_elm_config->font_cache == size) return;
1429    _elm_config->font_cache = size;
1430
1431    _elm_recache();
1432 }
1433
1434 EAPI void
1435 elm_font_cache_all_set(int size)
1436 {
1437 #ifdef HAVE_ELEMENTARY_X
1438    static Ecore_X_Atom atom = 0;
1439    unsigned int size_i = (unsigned int)size;
1440
1441    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FONT_CACHE");
1442    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1443                                   atom, &size_i, 1);
1444 #endif
1445 }
1446
1447 EAPI int
1448 elm_image_cache_get(void)
1449 {
1450    return _elm_config->image_cache;
1451 }
1452
1453 EAPI void
1454 elm_image_cache_set(int size)
1455 {
1456    if (_elm_config->image_cache == size) return;
1457    _elm_config->image_cache = size;
1458
1459    _elm_recache();
1460 }
1461
1462 EAPI void
1463 elm_image_cache_all_set(int size)
1464 {
1465 #ifdef HAVE_ELEMENTARY_X
1466    static Ecore_X_Atom atom = 0;
1467    unsigned int size_i = (unsigned int)size;
1468
1469    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_IMAGE_CACHE");
1470    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1471                                   atom, &size_i, 1);
1472 #endif
1473 }
1474
1475 EAPI int
1476 elm_edje_file_cache_get(void)
1477 {
1478    return _elm_config->edje_cache;
1479 }
1480
1481 EAPI void
1482 elm_edje_file_cache_set(int size)
1483 {
1484    if (_elm_config->edje_cache == size) return;
1485    _elm_config->edje_cache = size;
1486
1487    _elm_recache();
1488 }
1489
1490 EAPI void
1491 elm_edje_file_cache_all_set(int size)
1492 {
1493 #ifdef HAVE_ELEMENTARY_X
1494    static Ecore_X_Atom atom = 0;
1495    unsigned int size_i = (unsigned int)size;
1496
1497    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_EDJE_FILE_CACHE");
1498    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1499                                   atom, &size_i, 1);
1500 #endif
1501 }
1502
1503 EAPI int
1504 elm_edje_collection_cache_get(void)
1505 {
1506    return _elm_config->edje_collection_cache;
1507 }
1508
1509 EAPI void
1510 elm_edje_collection_cache_set(int size)
1511 {
1512    if (_elm_config->edje_collection_cache == size) return;
1513    _elm_config->edje_collection_cache = size;
1514
1515    _elm_recache();
1516 }
1517
1518 EAPI void
1519 elm_edje_collection_cache_all_set(int size)
1520 {
1521 #ifdef HAVE_ELEMENTARY_X
1522    static Ecore_X_Atom atom = 0;
1523    unsigned int size_i = (unsigned int)size;
1524
1525    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_EDJE_COLLECTION_CACHE");
1526    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1527                                   atom, &size_i, 1);
1528 #endif
1529 }
1530
1531 EAPI Eina_Bool
1532 elm_object_focus_get(const Evas_Object *obj)
1533 {
1534    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1535    return elm_widget_focus_get(obj);
1536 }
1537
1538 EAPI void
1539 elm_object_focus_set(Evas_Object *obj,
1540                      Eina_Bool    focus)
1541 {
1542    EINA_SAFETY_ON_NULL_RETURN(obj);
1543    if (focus)
1544      {
1545         if (elm_widget_focus_get(obj)) return;
1546         elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
1547      }
1548    else
1549      {
1550         if (!elm_widget_can_focus_get(obj)) return;
1551         elm_widget_focused_object_clear(obj);
1552      }
1553 }
1554
1555 EAPI void
1556 elm_object_focus(Evas_Object *obj)
1557 {
1558    EINA_SAFETY_ON_NULL_RETURN(obj);
1559    elm_object_focus_set(obj, EINA_TRUE);
1560 }
1561
1562 EAPI void
1563 elm_object_unfocus(Evas_Object *obj)
1564 {
1565    EINA_SAFETY_ON_NULL_RETURN(obj);
1566    elm_object_focus_set(obj, EINA_FALSE);
1567 }
1568
1569 EAPI void
1570 elm_object_focus_allow_set(Evas_Object *obj,
1571                            Eina_Bool    enable)
1572 {
1573    EINA_SAFETY_ON_NULL_RETURN(obj);
1574    elm_widget_can_focus_set(obj, enable);
1575 }
1576
1577 EAPI Eina_Bool
1578 elm_object_focus_allow_get(const Evas_Object *obj)
1579 {
1580    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1581    return (elm_widget_can_focus_get(obj)) || (elm_widget_child_can_focus_get(obj));
1582 }
1583
1584 EAPI void
1585 elm_object_focus_custom_chain_set(Evas_Object *obj,
1586                                   Eina_List   *objs)
1587 {
1588    EINA_SAFETY_ON_NULL_RETURN(obj);
1589    elm_widget_focus_custom_chain_set(obj, objs);
1590 }
1591
1592 EAPI void
1593 elm_object_focus_custom_chain_unset(Evas_Object *obj)
1594 {
1595    EINA_SAFETY_ON_NULL_RETURN(obj);
1596    elm_widget_focus_custom_chain_unset(obj);
1597 }
1598
1599 EAPI const Eina_List *
1600 elm_object_focus_custom_chain_get(const Evas_Object *obj)
1601 {
1602    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1603    return elm_widget_focus_custom_chain_get(obj);
1604 }
1605
1606 EAPI void
1607 elm_object_focus_custom_chain_append(Evas_Object *obj,
1608                                      Evas_Object *child,
1609                                      Evas_Object *relative_child)
1610 {
1611    EINA_SAFETY_ON_NULL_RETURN(obj);
1612    EINA_SAFETY_ON_NULL_RETURN(child);
1613    elm_widget_focus_custom_chain_append(obj, child, relative_child);
1614 }
1615
1616 EAPI void
1617 elm_object_focus_custom_chain_prepend(Evas_Object *obj,
1618                                       Evas_Object *child,
1619                                       Evas_Object *relative_child)
1620 {
1621    EINA_SAFETY_ON_NULL_RETURN(obj);
1622    EINA_SAFETY_ON_NULL_RETURN(child);
1623    elm_widget_focus_custom_chain_prepend(obj, child, relative_child);
1624 }
1625
1626 EAPI void
1627 elm_object_focus_cycle(Evas_Object        *obj,
1628                        Elm_Focus_Direction dir)
1629 {
1630    EINA_SAFETY_ON_NULL_RETURN(obj);
1631    elm_widget_focus_cycle(obj, dir);
1632 }
1633
1634 EAPI void
1635 elm_object_focus_direction_go(Evas_Object *obj,
1636                               int          x,
1637                               int          y)
1638 {
1639    EINA_SAFETY_ON_NULL_RETURN(obj);
1640    elm_widget_focus_direction_go(obj, x, y);
1641 }
1642
1643 EAPI void
1644 elm_object_tree_unfocusable_set(Evas_Object *obj,
1645                                 Eina_Bool    tree_unfocusable)
1646 {
1647    EINA_SAFETY_ON_NULL_RETURN(obj);
1648    elm_widget_tree_unfocusable_set(obj, tree_unfocusable);
1649 }
1650
1651 EAPI Eina_Bool
1652 elm_object_tree_unfocusable_get(const Evas_Object *obj)
1653 {
1654    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1655    return elm_widget_tree_unfocusable_get(obj);
1656 }
1657
1658 EAPI Eina_Bool
1659 elm_focus_highlight_enabled_get(void)
1660 {
1661    return _elm_config->focus_highlight_enable;
1662 }
1663
1664 EAPI void
1665 elm_focus_highlight_enabled_set(Eina_Bool enable)
1666 {
1667    _elm_config->focus_highlight_enable = !!enable;
1668 }
1669
1670 EAPI Eina_Bool
1671 elm_focus_highlight_animate_get(void)
1672 {
1673    return _elm_config->focus_highlight_animate;
1674 }
1675
1676 EAPI void
1677 elm_focus_highlight_animate_set(Eina_Bool animate)
1678 {
1679    _elm_config->focus_highlight_animate = !!animate;
1680 }
1681
1682 EAPI Eina_Bool
1683 elm_scroll_bounce_enabled_get(void)
1684 {
1685    return _elm_config->thumbscroll_bounce_enable;
1686 }
1687
1688 EAPI void
1689 elm_scroll_bounce_enabled_set(Eina_Bool enabled)
1690 {
1691    _elm_config->thumbscroll_bounce_enable = enabled;
1692 }
1693
1694 EAPI void
1695 elm_scroll_bounce_enabled_all_set(Eina_Bool enabled)
1696 {
1697 #ifdef HAVE_ELEMENTARY_X
1698    static Ecore_X_Atom atom = 0;
1699    unsigned int bounce_enable_i = (unsigned int)enabled;
1700
1701    if (!atom)
1702      atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BOUNCE_ENABLE");
1703    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1704                                   atom, &bounce_enable_i, 1);
1705 #endif
1706 }
1707
1708 EAPI double
1709 elm_scroll_bounce_friction_get(void)
1710 {
1711    return _elm_config->thumbscroll_bounce_friction;
1712 }
1713
1714 EAPI void
1715 elm_scroll_bounce_friction_set(double friction)
1716 {
1717    _elm_config->thumbscroll_bounce_friction = friction;
1718 }
1719
1720 EAPI void
1721 elm_scroll_bounce_friction_all_set(double friction)
1722 {
1723 #ifdef HAVE_ELEMENTARY_X
1724    static Ecore_X_Atom atom = 0;
1725    unsigned int bounce_friction_i = (unsigned int)(friction * 1000.0);
1726
1727    if (!atom)
1728      atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BOUNCE_FRICTION");
1729    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1730                                   atom, &bounce_friction_i, 1);
1731 #endif
1732 }
1733
1734 EAPI double
1735 elm_scroll_page_scroll_friction_get(void)
1736 {
1737    return _elm_config->page_scroll_friction;
1738 }
1739
1740 EAPI void
1741 elm_scroll_page_scroll_friction_set(double friction)
1742 {
1743    _elm_config->page_scroll_friction = friction;
1744 }
1745
1746 EAPI void
1747 elm_scroll_page_scroll_friction_all_set(double friction)
1748 {
1749 #ifdef HAVE_ELEMENTARY_X
1750    static Ecore_X_Atom atom = 0;
1751    unsigned int page_scroll_friction_i = (unsigned int)(friction * 1000.0);
1752
1753    if (!atom)
1754      atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_PAGE_SCROLL_FRICTION");
1755    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1756                                   atom, &page_scroll_friction_i, 1);
1757 #endif
1758 }
1759
1760 EAPI double
1761 elm_scroll_bring_in_scroll_friction_get(void)
1762 {
1763    return _elm_config->bring_in_scroll_friction;
1764 }
1765
1766 EAPI void
1767 elm_scroll_bring_in_scroll_friction_set(double friction)
1768 {
1769    _elm_config->bring_in_scroll_friction = friction;
1770 }
1771
1772 EAPI void
1773 elm_scroll_bring_in_scroll_friction_all_set(double friction)
1774 {
1775 #ifdef HAVE_ELEMENTARY_X
1776    static Ecore_X_Atom atom = 0;
1777    unsigned int bring_in_scroll_friction_i = (unsigned int)(friction * 1000.0);
1778
1779    if (!atom)
1780      atom =
1781        ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BRING_IN_SCROLL_FRICTION");
1782    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1783                                   atom, &bring_in_scroll_friction_i, 1);
1784 #endif
1785 }
1786
1787 EAPI double
1788 elm_scroll_zoom_friction_get(void)
1789 {
1790    return _elm_config->zoom_friction;
1791 }
1792
1793 EAPI void
1794 elm_scroll_zoom_friction_set(double friction)
1795 {
1796    _elm_config->zoom_friction = friction;
1797 }
1798
1799 EAPI void
1800 elm_scroll_zoom_friction_all_set(double friction)
1801 {
1802 #ifdef HAVE_ELEMENTARY_X
1803    static Ecore_X_Atom atom = 0;
1804    unsigned int zoom_friction_i = (unsigned int)(friction * 1000.0);
1805
1806    if (!atom)
1807      atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_ZOOM_FRICTION");
1808    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1809                                   atom, &zoom_friction_i, 1);
1810 #endif
1811 }
1812
1813 EAPI Eina_Bool
1814 elm_scroll_thumbscroll_enabled_get(void)
1815 {
1816    return _elm_config->thumbscroll_enable;
1817 }
1818
1819 EAPI void
1820 elm_scroll_thumbscroll_enabled_set(Eina_Bool enabled)
1821 {
1822    _elm_config->thumbscroll_enable = enabled;
1823 }
1824
1825 EAPI void
1826 elm_scroll_thumbscroll_enabled_all_set(Eina_Bool enabled)
1827 {
1828 #ifdef HAVE_ELEMENTARY_X
1829    static Ecore_X_Atom atom = 0;
1830    unsigned int ts_enable_i = (unsigned int)enabled;
1831
1832    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_ENABLE");
1833    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1834                                   atom, &ts_enable_i, 1);
1835 #endif
1836 }
1837
1838 EAPI unsigned int
1839 elm_scroll_thumbscroll_threshold_get(void)
1840 {
1841    return _elm_config->thumbscroll_threshold;
1842 }
1843
1844 EAPI void
1845 elm_scroll_thumbscroll_threshold_set(unsigned int threshold)
1846 {
1847    _elm_config->thumbscroll_threshold = threshold;
1848 }
1849
1850 EAPI void
1851 elm_scroll_thumbscroll_threshold_all_set(unsigned int threshold)
1852 {
1853 #ifdef HAVE_ELEMENTARY_X
1854    static Ecore_X_Atom atom = 0;
1855    unsigned int ts_threshold_i = (unsigned int)threshold;
1856
1857    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_THRESHOLD");
1858    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1859                                   atom, &ts_threshold_i, 1);
1860 #endif
1861 }
1862
1863 EAPI double
1864 elm_scroll_thumbscroll_momentum_threshold_get(void)
1865 {
1866    return _elm_config->thumbscroll_momentum_threshold;
1867 }
1868
1869 EAPI void
1870 elm_scroll_thumbscroll_momentum_threshold_set(double threshold)
1871 {
1872    _elm_config->thumbscroll_momentum_threshold = threshold;
1873 }
1874
1875 EAPI void
1876 elm_scroll_thumbscroll_momentum_threshold_all_set(double threshold)
1877 {
1878 #ifdef HAVE_ELEMENTARY_X
1879    static Ecore_X_Atom atom = 0;
1880    unsigned int ts_momentum_threshold_i = (unsigned int)(threshold * 1000.0);
1881
1882    if (!atom)
1883      atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_MOMENTUM_THRESHOLD");
1884    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1885                                   atom, &ts_momentum_threshold_i, 1);
1886 #endif
1887 }
1888
1889 EAPI double
1890 elm_scroll_thumbscroll_friction_get(void)
1891 {
1892    return _elm_config->thumbscroll_friction;
1893 }
1894
1895 EAPI void
1896 elm_scroll_thumbscroll_friction_set(double friction)
1897 {
1898    _elm_config->thumbscroll_friction = friction;
1899 }
1900
1901 EAPI void
1902 elm_scroll_thumbscroll_friction_all_set(double friction)
1903 {
1904 #ifdef HAVE_ELEMENTARY_X
1905    static Ecore_X_Atom atom = 0;
1906    unsigned int ts_friction_i = (unsigned int)(friction * 1000.0);
1907
1908    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_FRICTION");
1909    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1910                                   atom, &ts_friction_i, 1);
1911 #endif
1912 }
1913
1914 EAPI double
1915 elm_scroll_thumbscroll_border_friction_get(void)
1916 {
1917    return _elm_config->thumbscroll_border_friction;
1918 }
1919
1920 EAPI void
1921 elm_scroll_thumbscroll_border_friction_set(double friction)
1922 {
1923    if (friction < 0.0)
1924      friction = 0.0;
1925
1926    if (friction > 1.0)
1927      friction = 1.0;
1928
1929    _elm_config->thumbscroll_friction = friction;
1930 }
1931
1932 EAPI void
1933 elm_scroll_thumbscroll_border_friction_all_set(double friction)
1934 {
1935    if (friction < 0.0)
1936      friction = 0.0;
1937
1938    if (friction > 1.0)
1939      friction = 1.0;
1940
1941 #ifdef HAVE_ELEMENTARY_X
1942    static Ecore_X_Atom atom = 0;
1943    unsigned int border_friction_i = (unsigned int)(friction * 1000.0);
1944
1945    if (!atom)
1946      atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BORDER_FRICTION");
1947    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1948                                   atom, &border_friction_i, 1);
1949 #endif
1950 }
1951
1952 EAPI double
1953 elm_scroll_thumbscroll_sensitivity_friction_get(void)
1954 {
1955    return _elm_config->thumbscroll_sensitivity_friction;
1956 }
1957
1958 EAPI void
1959 elm_scroll_thumbscroll_sensitivity_friction_set(double friction)
1960 {
1961    if (friction < 0.1)
1962      friction = 0.1;
1963
1964    if (friction > 1.0)
1965      friction = 1.0;
1966
1967    _elm_config->thumbscroll_friction = friction;
1968 }
1969
1970 EAPI void
1971 elm_scroll_thumbscroll_sensitivity_friction_all_set(double friction)
1972 {
1973    if (friction < 0.1)
1974      friction = 0.1;
1975
1976    if (friction > 1.0)
1977      friction = 1.0;
1978
1979 #ifdef HAVE_ELEMENTARY_X
1980    static Ecore_X_Atom atom = 0;
1981    unsigned int sensitivity_friction_i = (unsigned int)(friction * 1000.0);
1982
1983    if (!atom)
1984      atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_SENSITIVITY_FRICTION");
1985    ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1986                                   atom, &sensitivity_friction_i, 1);
1987 #endif
1988 }
1989
1990 EAPI void
1991 elm_object_scroll_hold_push(Evas_Object *obj)
1992 {
1993    EINA_SAFETY_ON_NULL_RETURN(obj);
1994    elm_widget_scroll_hold_push(obj);
1995 }
1996
1997 EAPI void
1998 elm_object_scroll_hold_pop(Evas_Object *obj)
1999 {
2000    EINA_SAFETY_ON_NULL_RETURN(obj);
2001    elm_widget_scroll_hold_pop(obj);
2002 }
2003
2004 EAPI void
2005 elm_object_scroll_freeze_push(Evas_Object *obj)
2006 {
2007    EINA_SAFETY_ON_NULL_RETURN(obj);
2008    elm_widget_scroll_freeze_push(obj);
2009 }
2010
2011 EAPI void
2012 elm_object_scroll_lock_x_set(Evas_Object *obj,
2013                              Eina_Bool    lock)
2014 {
2015    EINA_SAFETY_ON_NULL_RETURN(obj);
2016    elm_widget_drag_lock_x_set(obj, lock);
2017 }
2018
2019 EAPI void
2020 elm_object_scroll_lock_y_set(Evas_Object *obj,
2021                              Eina_Bool    lock)
2022 {
2023    EINA_SAFETY_ON_NULL_RETURN(obj);
2024    elm_widget_drag_lock_y_set(obj, lock);
2025 }
2026
2027 EAPI Eina_Bool
2028 elm_object_scroll_lock_x_get(const Evas_Object *obj)
2029 {
2030    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
2031    return elm_widget_drag_lock_x_get(obj);
2032 }
2033
2034 EAPI Eina_Bool
2035 elm_object_scroll_lock_y_get(const Evas_Object *obj)
2036 {
2037    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
2038    return elm_widget_drag_lock_y_get(obj);
2039 }
2040
2041 EAPI void
2042 elm_object_scroll_freeze_pop(Evas_Object *obj)
2043 {
2044    EINA_SAFETY_ON_NULL_RETURN(obj);
2045    elm_widget_scroll_freeze_pop(obj);
2046 }
2047
2048 EAPI Eina_Bool
2049 elm_object_widget_check(const Evas_Object *obj)
2050 {
2051    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
2052    return elm_widget_is(obj);
2053 }
2054
2055 EAPI Evas_Object *
2056 elm_object_parent_widget_get(const Evas_Object *obj)
2057 {
2058    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
2059    return elm_widget_parent_widget_get(obj);
2060 }
2061
2062 EAPI Evas_Object *
2063 elm_object_top_widget_get(const Evas_Object *obj)
2064 {
2065    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
2066    return elm_widget_top_get(obj);
2067 }
2068
2069 EAPI const char *
2070 elm_object_widget_type_get(const Evas_Object *obj)
2071 {
2072    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
2073    return elm_widget_type_get(obj);
2074 }
2075
2076 EAPI void
2077 elm_object_signal_emit(Evas_Object *obj,
2078                        const char  *emission,
2079                        const char  *source)
2080 {
2081    EINA_SAFETY_ON_NULL_RETURN(obj);
2082    elm_widget_signal_emit(obj, emission, source);
2083 }
2084
2085 EAPI void
2086 elm_object_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source), void *data)
2087 {
2088     EINA_SAFETY_ON_NULL_RETURN(obj);
2089     EINA_SAFETY_ON_NULL_RETURN(func);
2090     elm_widget_signal_callback_add(obj, emission, source, func, data);
2091 }
2092
2093 EAPI void *
2094 elm_object_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source))
2095 {
2096     EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
2097     EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
2098     return elm_widget_signal_callback_del(obj, emission, source, func);
2099 }
2100
2101 EAPI void
2102 elm_object_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data)
2103 {
2104    EINA_SAFETY_ON_NULL_RETURN(obj);
2105    EINA_SAFETY_ON_NULL_RETURN(func);
2106    elm_widget_event_callback_add(obj, func, data);
2107 }
2108
2109 EAPI void *
2110 elm_object_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data)
2111 {
2112    EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
2113    EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
2114    return elm_widget_event_callback_del(obj, func, data);
2115 }
2116
2117 EAPI void
2118 elm_object_tree_dump(const Evas_Object *top)
2119 {
2120 #ifdef ELM_DEBUG
2121    elm_widget_tree_dump(top);
2122 #else
2123    return;
2124    (void)top;
2125 #endif
2126 }
2127
2128 EAPI void
2129 elm_object_tree_dot_dump(const Evas_Object *top,
2130                          const char        *file)
2131 {
2132 #ifdef ELM_DEBUG
2133    FILE *f = fopen(file, "wb");
2134    elm_widget_tree_dot_dump(top, f);
2135    fclose(f);
2136 #else
2137    return;
2138    (void)top;
2139    (void)file;
2140 #endif
2141 }
2142
2143 EAPI void
2144 elm_longpress_timeout_set(double longpress_timeout)
2145 {
2146    _elm_config->longpress_timeout = longpress_timeout;
2147 }
2148
2149 EAPI double
2150 elm_longpress_timeout_get(void)
2151 {
2152    return _elm_config->longpress_timeout;
2153 }
2154
2155 EAPI Evas_Object *
2156 elm_object_item_object_get(const Elm_Object_Item *it)
2157 {
2158    return ((Elm_Widget_Item *) it)->widget;
2159 }
2160
2161 EAPI void
2162 elm_object_item_content_part_set(Elm_Object_Item *it,
2163                                  const char *part,
2164                                  Evas_Object *content)
2165 {
2166    elm_widget_item_content_part_set(it, part, content);
2167 }
2168
2169 EAPI Evas_Object *
2170 elm_object_item_content_part_get(const Elm_Object_Item *it,
2171                                  const char *part)
2172 {
2173    return elm_widget_item_content_part_get(it, part);
2174 }
2175
2176 EAPI Evas_Object *
2177 elm_object_item_content_part_unset(Elm_Object_Item *it, const char *part)
2178 {
2179    return elm_widget_item_content_part_unset(it, part);
2180 }
2181
2182 EAPI void
2183 elm_object_item_text_part_set(Elm_Object_Item *it,
2184                               const char *part,
2185                               const char *label)
2186 {
2187    elm_widget_item_text_part_set(it, part, label);
2188 }
2189
2190 EAPI const char *
2191 elm_object_item_text_part_get(const Elm_Object_Item *it, const char *part)
2192 {
2193    return elm_widget_item_text_part_get(it, part);
2194 }
2195
2196 EAPI void *
2197 elm_object_item_data_get(const Elm_Object_Item *it)
2198 {
2199    return elm_widget_item_data_get(it);
2200 }
2201
2202 EAPI void
2203 elm_object_item_data_set(Elm_Object_Item *it, void *data)
2204 {
2205    elm_widget_item_data_set(it, data);
2206 }
2207
2208 EAPI void
2209 elm_object_item_signal_emit(Elm_Object_Item *it, const char *emission, const char *source)
2210 {
2211    elm_widget_item_signal_emit(it, emission, source);
2212 }
2213
2214 EAPI void
2215 elm_object_access_info_set(Evas_Object *obj, const char *txt)
2216 {
2217    elm_widget_access_info_set(obj, txt);
2218 }
2219
2220 EAPI void
2221 elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt)
2222 {
2223    _elm_widget_item_access_info_set((Elm_Widget_Item *)it, txt);
2224 }
2225