efl/legacy/elementary/src/lib/elm_main.c

88 lines
1.8 KiB
C
Raw Normal View History

#include <Elementary.h>
#include "elm_priv.h"
char *_elm_appname = NULL;
Elm_Config *_elm_config = NULL;
static int
_elm_signal_exit(void *data, int ev_type, void *ev)
{
elm_exit();
return 1;
}
EAPI void
elm_init(int argc, char **argv)
{
int i;
eet_init();
ecore_init();
ecore_app_args_set(argc, (const char **)argv);
ecore_file_init();
evas_init();
edje_init();
ecore_evas_init(); // FIXME: check errors
ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, NULL);
_elm_appname = strdup(ecore_file_file_get(argv[0]));
// FIXME: actually load config
_elm_config = ELM_NEW(Elm_Config);
_elm_config->engine = ELM_SOFTWARE_X11;
_elm_config->thumbscroll_enable = 1;
_elm_config->thumbscroll_threshhold = 24;
_elm_config->thumbscroll_momentum_threshhold = 100.0;
_elm_config->thumbscroll_friction = 1.0;
_elm_config->scale = 1.0;
_elm_config->bgpixmap = 0;
_elm_config->compositing = 1;
if ((_elm_config->engine == ELM_SOFTWARE_X11) ||
(_elm_config->engine == ELM_SOFTWARE_16_X11) ||
(_elm_config->engine == ELM_XRENDER_X11) ||
(_elm_config->engine == ELM_OPENGL_X11))
{
int val = 1000;
ecore_x_init(NULL);
if (ecore_x_window_prop_card32_get(ecore_x_window_root_first_get(),
ecore_x_atom_get("ENLIGHTENMENT_SCALE"),
&val, 1) > 0)
{
if (val > 0) _elm_config->scale = (double)val / 1000.0;
}
if (!ecore_x_screen_is_composited(0))
_elm_config->compositing = 0;
}
}
EAPI void
elm_shutdown(void)
{
_elm_win_shutdown();
free(_elm_config);
free(_elm_appname);
ecore_evas_shutdown();
edje_shutdown();
evas_shutdown();
ecore_file_shutdown();
ecore_shutdown();
eet_shutdown();
}
EAPI void
elm_run(void)
{
ecore_main_loop_begin();
}
EAPI void
elm_exit(void)
{
ecore_main_loop_quit();
}