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