move getenvs to just before use

SVN revision: 40879
This commit is contained in:
Carsten Haitzler 2009-06-03 14:30:32 +00:00
parent d7a3bd786d
commit 0106f9ac05
1 changed files with 65 additions and 83 deletions

View File

@ -347,17 +347,12 @@ elm_shutdown(void)
elm_quicklaunch_shutdown();
}
static const char *elm_engine, *elm_scale, *elm_theme, *elm_prefix, *elm_data_dir;
static const char *elm_font_hinting, *elm_font_path, *elm_image_cache;
static const char *elm_font_cache, *elm_finger_size, *elm_fps;
static const char *elm_thumbscroll_enabled, *elm_thumbscroll_threshhold;
static const char *elm_thumbscroll_momentum_threshhold, *elm_thumbscroll_friction;
EAPI void
elm_quicklaunch_init(int argc, char **argv)
{
int i;
char buf[PATH_MAX];
char *s;
eet_init();
ecore_init();
@ -371,31 +366,17 @@ elm_quicklaunch_init(int argc, char **argv)
_elm_appname = strdup(ecore_file_file_get(argv[0]));
elm_engine = getenv("ELM_ENGINE");
elm_scale = getenv("ELM_SCALE");
elm_theme = getenv("ELM_THEME");
elm_prefix = getenv("ELM_PREFIX");
elm_data_dir = getenv("ELM_DATA_DIR");
elm_font_hinting = getenv("ELM_FONT_HINTING");
elm_font_path = getenv("ELM_FONT_PATH");
elm_image_cache = getenv("ELM_IMAGE_CACHE");
elm_font_cache = getenv("ELM_FONT_CACHE");
elm_finger_size = getenv("ELM_FINGER_SIZE");
elm_fps = getenv("ELM_FPS");
elm_thumbscroll_enabled = getenv("ELM_THUMBSCROLL_ENABLE");
elm_thumbscroll_threshhold = getenv("ELM_THUMBSCROLL_THRESHOLD");
elm_thumbscroll_momentum_threshhold = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD");
elm_thumbscroll_friction = getenv("ELM_THUMBSCROLL_FRICTION");
if (!_elm_data_dir)
{
_elm_data_dir = eina_stringshare_add(elm_data_dir);
s = getenv("ELM_DATA_DIR");
_elm_data_dir = eina_stringshare_add(s);
}
if (!_elm_data_dir)
{
if (elm_prefix)
s = getenv("ELM_PREFIX");
if (s)
{
snprintf(buf, sizeof(buf), "%s/share/elementary", elm_prefix);
snprintf(buf, sizeof(buf), "%s/share/elementary", s);
_elm_data_dir = eina_stringshare_add(buf);
}
}
@ -452,75 +433,77 @@ elm_quicklaunch_init(int argc, char **argv)
_elm_config->compositing = 1;
_elm_config->fps = 60.0;
if (elm_engine)
s = getenv("ELM_ENGINE");
if (s)
{
if ((!strcasecmp(elm_engine, "x11")) ||
(!strcasecmp(elm_engine, "x")) ||
(!strcasecmp(elm_engine, "software-x11")) ||
(!strcasecmp(elm_engine, "software_x11")))
if ((!strcasecmp(s, "x11")) ||
(!strcasecmp(s, "x")) ||
(!strcasecmp(s, "software-x11")) ||
(!strcasecmp(s, "software_x11")))
_elm_config->engine = ELM_SOFTWARE_X11;
else if ((!strcasecmp(elm_engine, "x11-16")) ||
(!strcasecmp(elm_engine, "x16")) ||
(!strcasecmp(elm_engine, "software-16-x11")) ||
(!strcasecmp(elm_engine, "software_16_x11")))
else if ((!strcasecmp(s, "x11-16")) ||
(!strcasecmp(s, "x16")) ||
(!strcasecmp(s, "software-16-x11")) ||
(!strcasecmp(s, "software_16_x11")))
_elm_config->engine = ELM_SOFTWARE_16_X11;
else if ((!strcasecmp(elm_engine, "xrender")) ||
(!strcasecmp(elm_engine, "xr")) ||
(!strcasecmp(elm_engine, "xrender-x11")) ||
(!strcasecmp(elm_engine, "xrender_x11")))
else if ((!strcasecmp(s, "xrender")) ||
(!strcasecmp(s, "xr")) ||
(!strcasecmp(s, "xrender-x11")) ||
(!strcasecmp(s, "xrender_x11")))
_elm_config->engine = ELM_XRENDER_X11;
else if ((!strcasecmp(elm_engine, "fb")) ||
(!strcasecmp(elm_engine, "software-fb")) ||
(!strcasecmp(elm_engine, "software_fb")))
else if ((!strcasecmp(s, "fb")) ||
(!strcasecmp(s, "software-fb")) ||
(!strcasecmp(s, "software_fb")))
_elm_config->engine = ELM_SOFTWARE_FB;
else if ((!strcasecmp(elm_engine, "opengl")) ||
(!strcasecmp(elm_engine, "gl")) ||
(!strcasecmp(elm_engine, "opengl-x11")) ||
(!strcasecmp(elm_engine, "opengl_x11")))
else if ((!strcasecmp(s, "opengl")) ||
(!strcasecmp(s, "gl")) ||
(!strcasecmp(s, "opengl-x11")) ||
(!strcasecmp(s, "opengl_x11")))
_elm_config->engine = ELM_OPENGL_X11;
else if ((!strcasecmp(elm_engine, "ddraw")) ||
(!strcasecmp(elm_engine, "software-ddraw")) ||
(!strcasecmp(elm_engine, "software_ddraw")))
else if ((!strcasecmp(s, "ddraw")) ||
(!strcasecmp(s, "software-ddraw")) ||
(!strcasecmp(s, "software_ddraw")))
_elm_config->engine = ELM_SOFTWARE_WIN32;
else if ((!strcasecmp(elm_engine, "wince-gdi")) ||
(!strcasecmp(elm_engine, "software-16-wince-gdi")) ||
(!strcasecmp(elm_engine, "software_16_wince_gdi")))
else if ((!strcasecmp(s, "wince-gdi")) ||
(!strcasecmp(s, "software-16-wince-gdi")) ||
(!strcasecmp(s, "software_16_wince_gdi")))
_elm_config->engine = ELM_SOFTWARE_16_WINCE;
}
if (elm_thumbscroll_enabled)
_elm_config->thumbscroll_enable = atoi(elm_thumbscroll_enabled);
if (elm_thumbscroll_threshhold)
_elm_config->thumbscroll_threshhold = atoi(elm_thumbscroll_threshhold);
s = getenv("ELM_THUMBSCROLL_ENABLE");
if (s) _elm_config->thumbscroll_enable = atoi(s);
s = getenv("ELM_THUMBSCROLL_THRESHOLD");
if (s) _elm_config->thumbscroll_threshhold = atoi(s);
// FIXME: floatformat locale issues here 1.0 vs 1,0 - should just be 1.0
if (elm_thumbscroll_momentum_threshhold)
_elm_config->thumbscroll_momentum_threshhold = atof(elm_thumbscroll_momentum_threshhold);
if (elm_thumbscroll_friction)
_elm_config->thumbscroll_friction = atof(elm_thumbscroll_friction);
s = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD");
if (s) _elm_config->thumbscroll_momentum_threshhold = atof(s);
s = getenv("ELM_THUMBSCROLL_FRICTION");
if (s) _elm_config->thumbscroll_friction = atof(s);
if (elm_theme)
_elm_theme_parse(elm_theme);
else
_elm_theme_parse("default");
s = getenv("ELM_THEME");
if (s) _elm_theme_parse(s);
else _elm_theme_parse("default");
_elm_config->font_hinting = 2;
if (elm_font_hinting)
s= getenv("ELM_FONT_HINTING");
if (s)
{
if (!strcasecmp(elm_font_hinting, "none"))
if (!strcasecmp(s, "none"))
_elm_config->font_hinting = 0;
else if (!strcasecmp(elm_font_hinting, "auto"))
else if (!strcasecmp(s, "auto"))
_elm_config->font_hinting = 1;
else if (!strcasecmp(elm_font_hinting, "bytecode"))
else if (!strcasecmp(s, "bytecode"))
_elm_config->font_hinting = 2;
}
if (elm_font_path)
s = getenv("ELM_FONT_PATH");
if (s)
{
const char *p, *pp, *s;
char *buf;
buf = alloca(strlen(elm_font_path) + 1);
p = elm_font_path;
buf = alloca(strlen(s) + 1);
p = s;
pp = p;
for (;;)
{
@ -544,22 +527,22 @@ elm_quicklaunch_init(int argc, char **argv)
}
}
if (elm_image_cache)
_elm_config->image_cache = atoi(elm_image_cache);
s = getenv("ELM_IMAGE_CACHE");
if (s) _elm_config->image_cache = atoi(s);
if (elm_font_cache)
_elm_config->font_cache = atoi(elm_font_cache);
s = getenv("ELM_FONT_CACHE");
if (s) _elm_config->font_cache = atoi(s);
if (elm_scale)
_elm_config->scale = atof(elm_scale);
s = getenv("ELM_SCALE");
if (s) _elm_config->scale = atof(s);
_elm_config->finger_size =
(double)_elm_config->finger_size * _elm_config->scale;
if (elm_finger_size)
_elm_config->finger_size = atoi(elm_finger_size);
s = getenv("ELM_FINGER_SIZE");
if (s) _elm_config->finger_size = atoi(s);
if (elm_fps)
_elm_config->fps = atof(elm_fps);
s = getenv("ELM_FPS");
if (s) _elm_config->fps = atof(s);
if (_elm_config->fps < 1.0)
_elm_config->fps = 1.0;
@ -591,7 +574,7 @@ elm_quicklaunch_sub_init(int argc, char **argv)
ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
_elm_event_property_change = ecore_event_handler_add
(ECORE_X_EVENT_WINDOW_PROPERTY, _elm_window_property_change, NULL);
if (!elm_scale)
if (!getenv("ELM_SCALE"))
{
if (ecore_x_window_prop_card32_get(ecore_x_window_root_first_get(),
_elm_atom_enlightenment_scale,
@ -601,7 +584,7 @@ elm_quicklaunch_sub_init(int argc, char **argv)
{
_elm_config->scale = (double)val / 1000.0;
// FIXME: hack until e export finger size too
if (!elm_finger_size)
if (getenv("ELM_FINGER_SIZE"))
_elm_config->finger_size = 40.0 * _elm_config->scale;
}
}
@ -1067,7 +1050,6 @@ elm_finger_size_get(void)
EAPI void
elm_finger_size_set(Evas_Coord size)
{
elm_finger_size = NULL;
if (_elm_config->finger_size == size) return;
_elm_config->finger_size = size;
_elm_rescale();