} \
while (0)
+static Evas_Object *main_win = NULL;
+
static int quiet = 0;
static int interactive = 1;
}
static void
-_profile_change_do(Evas_Object *win,
- const char *profile)
+_config_display_update(Evas_Object *win)
{
int flush_interval, font_c, image_c, edje_file_c, edje_col_c, ts_threshould;
double scale, s_bounce_friction, ts_momentum_threshold, ts_friction,
Elm_Theme *th;
int fs;
- elm_profile_all_set(profile);
-
scale = elm_scale_get();
fs = elm_finger_size_get();
flush_interval = elm_cache_flush_interval_get();
zoom_friction = elm_scroll_zoom_friction_get();
/* gotta update root windows' atoms */
- elm_scale_all_set(scale);
+// elm_scale_all_set(scale);
elm_slider_value_set(evas_object_data_get(win, "scale_slider"), scale);
- elm_finger_size_all_set(fs);
+// elm_finger_size_all_set(fs);
elm_slider_value_set(evas_object_data_get(win, "fs_slider"), fs);
- elm_cache_flush_interval_all_set(flush_interval);
+// elm_cache_flush_interval_all_set(flush_interval);
elm_slider_value_set(evas_object_data_get(win,
"cache_flush_interval_slider"),
flush_interval);
- elm_font_cache_all_set(font_c);
+// elm_font_cache_all_set(font_c);
elm_slider_value_set(evas_object_data_get(win, "font_cache_slider"),
font_c / 1024.0);
- elm_image_cache_all_set(image_c);
+// elm_image_cache_all_set(image_c);
elm_slider_value_set(evas_object_data_get(win, "image_cache_slider"),
image_c / 1024.0);
- elm_edje_file_cache_all_set(edje_file_c);
+// elm_edje_file_cache_all_set(edje_file_c);
elm_slider_value_set(evas_object_data_get(win, "edje_file_cache_slider"),
edje_file_c);
- elm_edje_collection_cache_all_set(edje_col_c);
+// elm_edje_collection_cache_all_set(edje_col_c);
elm_slider_value_set(evas_object_data_get(win,
"edje_collection_cache_slider"),
edje_col_c);
-
- elm_scroll_bounce_enabled_all_set(s_bounce);
+
+// elm_scroll_bounce_enabled_all_set(s_bounce);
elm_check_state_set(evas_object_data_get(win, "scroll_bounce_check"),
s_bounce);
- elm_scroll_bounce_friction_all_set(s_bounce_friction);
+// elm_scroll_bounce_friction_all_set(s_bounce_friction);
elm_slider_value_set(evas_object_data_get(win, "bounce_friction_slider"),
s_bounce_friction);
- elm_scroll_thumbscroll_enabled_all_set(ts);
+// elm_scroll_thumbscroll_enabled_all_set(ts);
elm_check_state_set(evas_object_data_get(win, "thumbscroll_check"), ts);
- elm_scroll_thumbscroll_threshold_all_set(ts_threshould);
+// elm_scroll_thumbscroll_threshold_all_set(ts_threshould);
elm_slider_value_set(evas_object_data_get(win,
"thumbscroll_threshold_slider"),
ts_threshould);
- elm_scroll_thumbscroll_momentum_threshold_all_set(ts_momentum_threshold);
+// elm_scroll_thumbscroll_momentum_threshold_all_set(ts_momentum_threshold);
elm_slider_value_set(evas_object_data_get(win,
"ts_momentum_threshold_slider"),
ts_momentum_threshold);
- elm_scroll_thumbscroll_friction_all_set(ts_friction);
+// elm_scroll_thumbscroll_friction_all_set(ts_friction);
elm_slider_value_set(evas_object_data_get(win,
"thumbscroll_friction_slider"),
ts_friction);
- elm_scroll_thumbscroll_border_friction_all_set(ts_border_friction);
+// elm_scroll_thumbscroll_border_friction_all_set(ts_border_friction);
elm_slider_value_set(evas_object_data_get(win, "ts_border_friction_slider"),
ts_border_friction);
- elm_scroll_thumbscroll_sensitivity_friction_all_set(ts_sensitivity_friction);
+// elm_scroll_thumbscroll_sensitivity_friction_all_set(ts_sensitivity_friction);
elm_slider_value_set(evas_object_data_get(win, "ts_sensitivity_friction_slider"),
ts_sensitivity_friction);
- elm_scroll_page_scroll_friction_all_set(page_friction);
+// elm_scroll_page_scroll_friction_all_set(page_friction);
elm_slider_value_set(evas_object_data_get(win,
"page_scroll_friction_slider"),
page_friction);
- elm_scroll_bring_in_scroll_friction_all_set(bring_in_friction);
+// elm_scroll_bring_in_scroll_friction_all_set(bring_in_friction);
elm_slider_value_set(evas_object_data_get(win,
"bring_in_scroll_friction_slider"),
bring_in_friction);
- elm_scroll_zoom_friction_all_set(zoom_friction);
+// elm_scroll_zoom_friction_all_set(zoom_friction);
elm_slider_value_set(evas_object_data_get(win,
"zoom_scroll_friction_slider"),
zoom_friction);
curr_theme = _elm_theme_current_get(elm_theme_get(NULL));
- elm_theme_all_set(curr_theme);
+// elm_theme_all_set(curr_theme);
th = elm_theme_new();
elm_theme_set(th, curr_theme);
}
static void
+_profile_change_do(Evas_Object *win,
+ const char *profile)
+{
+ elm_profile_all_set(profile);
+ _config_display_update(win);
+}
+
+static Eina_Bool
+_config_all_changed(void *data,
+ int ev_type __UNUSED__,
+ void *ev __UNUSED__)
+{
+ Evas_Object *win = data;
+ _config_display_update(win);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static void
_engine_use(void *data,
Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
if (!strcmp(profile, selection))
return;
- elm_config_save(); /* dump config into old profile's data dir */
elm_profile_set(selection); /* just here to update info for getters below */
_profile_change_do(elm_object_top_widget_get(li), selection);
th = elm_object_theme_get(sample);
defth = elm_theme_get(th);
elm_theme_all_set(defth);
+ elm_config_save();
}
static void
cur_profile = elm_profile_current_get();
cur_selected = !strcmp(cur_profile, sel_profile);
- pdir = elm_profile_dir_get(sel_profile, EINA_FALSE);
+ pdir = elm_profile_dir_get(sel_profile, EINA_TRUE);
+ if (!pdir) pdir = elm_profile_dir_get(sel_profile, EINA_FALSE);
#ifdef ELM_EFREET
snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir);
desk = efreet_desktop_new(buf);
if ((desk) && (desk->name)) prof_name = desk->name;
else
+ {
+ if (desk) efreet_desktop_free(desk);
+ pdir = elm_profile_dir_get(sel_profile, EINA_FALSE);
+ snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir);
+ desk = efreet_desktop_new(buf);
+ if ((desk) && (desk->name)) prof_name = desk->name;
+ else prof_name = cur_profile;
+ }
#endif
prof_name = cur_profile;
Elm_List_Item *it;
Evas_Object *ic;
- pdir = elm_profile_dir_get(profile, EINA_FALSE);
+ pdir = elm_profile_dir_get(profile, EINA_TRUE);
+ if (!pdir) pdir = elm_profile_dir_get(profile, EINA_FALSE);
label = profile;
#ifdef ELM_EFREET
snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir);
desk = efreet_desktop_new(buf);
if ((desk) && (desk->name)) label = desk->name;
+ else
+ {
+ if (desk) efreet_desktop_free(desk);
+ pdir = elm_profile_dir_get(profile, EINA_FALSE);
+ snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir);
+ desk = efreet_desktop_new(buf);
+ if ((desk) && (desk->name)) label = desk->name;
+ else label = profile;
+ }
#endif
buf[0] = 0;
Evas_Object *win, *bg, *bx0;
win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
+ main_win = win;
elm_win_title_set(win, "Elementary Config");
+ ecore_event_handler_add(ELM_EVENT_CONFIG_ALL_CHANGED, _config_all_changed,
+ win);
+
evas_object_smart_callback_add(win, "delete,request", config_exit, NULL);
bg = elm_bg_add(win);
evas_object_size_hint_weight_set(bg, 1.0, 1.0);
EAPI extern int ELM_ECORE_EVENT_ETHUMB_CONNECT;
/**
+ * Emitted when the application has reconfigured elementary settings due
+ * to an external configuration tool asking it to.
+ */
+ EAPI extern int ELM_EVENT_CONFIG_ALL_CHANGED;
+
+ /**
* Emitted when any Elementary's policy value is changed.
*/
EAPI extern int ELM_EVENT_POLICY_CHANGED;
#include <Elementary.h>
#include "elm_priv.h"
+EAPI int ELM_EVENT_CONFIG_ALL_CHANGED = 0;
Elm_Config *_elm_config = NULL;
char *_elm_profile = NULL;
#ifdef HAVE_ELEMENTARY_X
static Ecore_Event_Handler *_prop_change_handler = NULL;
+static Ecore_Timer *_prop_all_update_timer = NULL;
+static Ecore_Timer *_prop_change_delay_timer = NULL;
static Ecore_X_Window _root_1st = 0;
-#define ATOM_COUNT 23
+#define ATOM_COUNT 2
static Ecore_X_Atom _atom[ATOM_COUNT];
static Ecore_X_Atom _atom_config = 0;
static const char *_atom_names[ATOM_COUNT] =
{
- "ENLIGHTENMENT_SCALE",
- "ENLIGHTENMENT_FINGER_SIZE",
- "ENLIGHTENMENT_THEME",
- "ENLIGHTENMENT_PROFILE",
- "ENLIGHTENMENT_FONT_OVERLAY",
- "ENLIGHTENMENT_CACHE_FLUSH_INTERVAL",
- "ENLIGHTENMENT_CACHE_FLUSH_ENABLE",
- "ENLIGHTENMENT_FONT_CACHE",
- "ENLIGHTENMENT_IMAGE_CACHE",
- "ENLIGHTENMENT_EDJE_FILE_CACHE",
- "ENLIGHTENMENT_EDJE_COLLECTION_CACHE",
- "ENLIGHTENMENT_THUMBSCROLL_BOUNCE_ENABLE",
- "ENLIGHTENMENT_THUMBSCROLL_BOUNCE_FRICTION",
- "ENLIGHTENMENT_THUMBSCROLL_ENABLE",
- "ENLIGHTENMENT_THUMBSCROLL_THRESHOLD",
- "ENLIGHTENMENT_THUMBSCROLL_MOMENTUM_THRESHOLD",
- "ENLIGHTENMENT_THUMBSCROLL_FRICTION",
- "ENLIGHTENMENT_THUMBSCROLL_BORDER_FRICTION",
- "ENLIGHTENMENT_THUMBSCROLL_SENSITIVITY_FRICTION",
- "ENLIGHTENMENT_THUMBSCROLL_PAGE_SCROLL_FRICTION",
- "ENLIGHTENMENT_THUMBSCROLL_BRING_IN_SCROLL_FRICTION",
- "ENLIGHTENMENT_THUMBSCROLL_ZOOM_FRICTION",
- "ENLIGHTENMENT_CONFIG"
+ "ELM_PROFILE",
+ "ELM_CONFIG"
};
-#define ATOM_E_SCALE 0
-#define ATOM_E_FINGER_SIZE 1
-#define ATOM_E_THEME 2
-#define ATOM_E_PROFILE 3
-#define ATOM_E_FONT_OVERLAY 4
-#define ATOM_E_CACHE_FLUSH_INTERVAL 5
-#define ATOM_E_CACHE_FLUSH_ENABLE 6
-#define ATOM_E_FONT_CACHE 7
-#define ATOM_E_IMAGE_CACHE 8
-#define ATOM_E_EDJE_FILE_CACHE 9
-#define ATOM_E_EDJE_COLLECTION_CACHE 10
-#define ATOM_E_THUMBSCROLL_BOUNCE_ENABLE 11
-#define ATOM_E_THUMBSCROLL_BOUNCE_FRICTION 12
-#define ATOM_E_THUMBSCROLL_ENABLE 13
-#define ATOM_E_THUMBSCROLL_THRESHOLD 14
-#define ATOM_E_THUMBSCROLL_MOMENTUM_THRESHOLD 15
-#define ATOM_E_THUMBSCROLL_FRICTION 16
-#define ATOM_E_THUMBSCROLL_BORDER_FRICTION 17
-#define ATOM_E_THUMBSCROLL_SENSITIVITY_FRICTION 18
-#define ATOM_E_THUMBSCROLL_PAGE_SCROLL_FRICTION 19
-#define ATOM_E_THUMBSCROLL_BRING_IN_SCROLL_FRICTION 20
-#define ATOM_E_THUMBSCROLL_ZOOM_FRICTION 21
-#define ATOM_E_CONFIG 22
+#define ATOM_E_PROFILE 0
+#define ATOM_E_CONFIG 1
+static Eina_Bool _prop_all_update_cb(void *data __UNUSED__);
static Eina_Bool _prop_config_get(void);
+static void _prop_config_set(void);
static Eina_Bool _prop_change(void *data __UNUSED__,
int ev_type __UNUSED__,
void *ev);
static Eina_Bool
+_prop_all_update_cb(void *data __UNUSED__)
+{
+ _prop_config_set();
+ ecore_x_window_prop_string_set(_root_1st, _atom[ATOM_E_PROFILE],
+ _elm_profile);
+ _prop_all_update_timer = NULL;
+ return EINA_FALSE;
+}
+
+static Eina_Bool
_prop_config_get(void)
{
int size = 0;
unsigned char *data = NULL;
Elm_Config *config_data;
- snprintf(buf, sizeof(buf), "ENLIGHTENMENT_CONFIG_%s", _elm_profile);
+ snprintf(buf, sizeof(buf), "ELM_CONFIG_%s", _elm_profile);
atom = ecore_x_atom_get(buf);
_atom_config = atom;
if (!ecore_x_window_prop_property_get(_root_1st,
_elm_config_font_overlay_apply();
_elm_rescale();
_elm_recache();
+ ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL);
return EINA_TRUE;
}
+static void
+_prop_config_set(void)
+{
+ unsigned char *config_data = NULL;
+ int size = 0;
+
+ config_data = eet_data_descriptor_encode(_config_edd, _elm_config, &size);
+ if (config_data)
+ {
+ Ecore_X_Atom atom;
+ char buf[512];
+
+ snprintf(buf, sizeof(buf), "ELM_CONFIG_%s", _elm_profile);
+ atom = ecore_x_atom_get(buf);
+ _atom_config = atom;
+
+ ecore_x_window_prop_property_set(_root_1st, _atom_config,
+ _atom[ATOM_E_CONFIG], 8,
+ config_data, size);
+ free(config_data);
+ }
+}
+
+static Eina_Bool
+_prop_change_delay_cb(void *data __UNUSED__)
+{
+ char *s;
+
+ s = ecore_x_window_prop_string_get(_root_1st, _atom[ATOM_E_PROFILE]);
+ if (s)
+ {
+ if (_elm_profile) free(_elm_profile);
+ _elm_profile = s;
+ }
+ _prop_config_get();
+ _prop_change_delay_timer = NULL;
+ return EINA_FALSE;
+}
+
static Eina_Bool
_prop_change(void *data __UNUSED__,
int ev_type __UNUSED__,
if (event->win == _root_1st)
{
- if (event->atom == _atom[ATOM_E_SCALE])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- double pscale;
-
- pscale = _elm_config->scale;
- if (val > 0) _elm_config->scale = (double)val / 1000.0;
- if (pscale != _elm_config->scale)
- {
- _elm_rescale();
- _elm_recache();
- }
- }
- }
- else if (event->atom == _atom[ATOM_E_FINGER_SIZE])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- int pfinger_size;
-
- pfinger_size = _elm_config->finger_size;
- _elm_config->finger_size = val;
- if (pfinger_size != _elm_config->finger_size)
- {
- _elm_rescale();
- _elm_recache();
- }
- }
- }
- else if (event->atom == _atom[ATOM_E_THEME])
- {
- char *val = NULL;
-
- val = ecore_x_window_prop_string_get(event->win,
- event->atom);
- eina_stringshare_replace(&_elm_config->theme, val);
- if (val)
- {
- _elm_theme_parse(NULL, val);
- free(val);
- _elm_rescale();
- _elm_recache();
- }
- }
- else if (event->atom == _atom[ATOM_E_PROFILE])
- {
- char *val = NULL;
-
- val = ecore_x_window_prop_string_get(event->win,
- event->atom);
- if (val)
- {
- int changed = 0;
-
- if (_elm_profile)
- {
- if (strcmp(_elm_profile, val)) changed = 1;
- free(_elm_profile);
- }
- _elm_profile = val;
- if (changed)
- {
- if (!_prop_config_get())
- {
- _config_free();
- _config_load();
- _config_apply();
- _elm_config_font_overlay_apply();
- _elm_rescale();
- }
- }
- }
- }
- else if (event->atom == _atom[ATOM_E_FONT_OVERLAY])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- _config_free();
- _config_load();
- _config_apply();
- _elm_config_font_overlay_apply();
- _elm_rescale();
- }
- }
- else if (event->atom == _atom[ATOM_E_CACHE_FLUSH_INTERVAL])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- int cache_flush_interval;
-
- cache_flush_interval = _elm_config->cache_flush_poll_interval;
- _elm_config->cache_flush_poll_interval = val;
- if (cache_flush_interval !=
- _elm_config->cache_flush_poll_interval)
- _elm_recache();
- }
- }
- else if (event->atom == _atom[ATOM_E_CACHE_FLUSH_ENABLE])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- _elm_config->cache_flush_enable = !!val;
- _elm_recache();
- }
- }
- else if (event->atom == _atom[ATOM_E_FONT_CACHE])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- int font_cache;
-
- font_cache = _elm_config->font_cache;
- _elm_config->font_cache = val;
- if (font_cache != _elm_config->font_cache)
- _elm_recache();
- }
- }
- else if (event->atom == _atom[ATOM_E_IMAGE_CACHE])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- int image_cache;
-
- image_cache = _elm_config->image_cache;
- _elm_config->image_cache = val;
- if (image_cache != _elm_config->image_cache)
- _elm_recache();
- }
- }
- else if (event->atom == _atom[ATOM_E_EDJE_FILE_CACHE])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- int edje_file_cache;
-
- edje_file_cache = _elm_config->edje_cache;
- _elm_config->edje_cache = val;
- if (edje_file_cache != _elm_config->edje_cache)
- _elm_recache();
- }
- }
- else if (event->atom == _atom[ATOM_E_EDJE_COLLECTION_CACHE])
+ if (event->atom == _atom[ATOM_E_PROFILE])
{
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- int edje_collection_cache;
-
- edje_collection_cache = _elm_config->edje_collection_cache;
- _elm_config->edje_collection_cache = val;
- if (edje_collection_cache !=
- _elm_config->edje_collection_cache)
- _elm_recache();
- }
- }
- else if (event->atom == _atom[ATOM_E_THUMBSCROLL_BOUNCE_ENABLE])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- _elm_config->thumbscroll_bounce_enable = !!val;
- }
- }
- else if (event->atom == _atom[ATOM_E_THUMBSCROLL_BOUNCE_FRICTION])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- if (val > 0)
- _elm_config->thumbscroll_bounce_friction =
- (double)val / 1000.0;
- }
- }
- else if (event->atom == _atom[ATOM_E_THUMBSCROLL_ENABLE])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- _elm_config->thumbscroll_enable = !!val;
- }
- }
- else if (event->atom == _atom[ATOM_E_THUMBSCROLL_THRESHOLD])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- if (val > 0) _elm_config->thumbscroll_threshold = val;
- }
- }
- else if (event->atom == _atom[ATOM_E_THUMBSCROLL_MOMENTUM_THRESHOLD])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- _elm_config->thumbscroll_momentum_threshold =
- (double)val / 1000.0;
- }
- }
- else if (event->atom == _atom[ATOM_E_THUMBSCROLL_FRICTION])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- _elm_config->thumbscroll_friction = (double)val / 1000.0;
- }
- }
- else if (event->atom == _atom[ATOM_E_THUMBSCROLL_BORDER_FRICTION])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- _elm_config->thumbscroll_border_friction =
- (double)val / 1000.0;
- }
- }
- else if (event->atom == _atom[ATOM_E_THUMBSCROLL_SENSITIVITY_FRICTION])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- _elm_config->thumbscroll_sensitivity_friction =
- (double)val / 1000.0;
- }
- }
- else if (event->atom == _atom[ATOM_E_THUMBSCROLL_PAGE_SCROLL_FRICTION])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- _elm_config->page_scroll_friction =
- (double)val / 1000.0;
- }
- }
- else if (event->atom ==
- _atom[ATOM_E_THUMBSCROLL_BRING_IN_SCROLL_FRICTION])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- _elm_config->bring_in_scroll_friction =
- (double)val / 1000.0;
- }
- }
- else if (event->atom ==
- _atom[ATOM_E_THUMBSCROLL_ZOOM_FRICTION])
- {
- unsigned int val = 1000;
-
- if (ecore_x_window_prop_card32_get(event->win,
- event->atom,
- &val, 1) > 0)
- {
- _elm_config->zoom_friction = (double)val / 1000.0;
- }
+ if (_prop_change_delay_timer) ecore_timer_del(_prop_change_delay_timer);
+ _prop_change_delay_timer = ecore_timer_add(0.1, _prop_change_delay_cb, NULL);
}
else if (((_atom_config > 0) && (event->atom == _atom_config)) ||
(event->atom == _atom[ATOM_E_CONFIG]))
{
- _prop_config_get();
+ if (_prop_change_delay_timer) ecore_timer_del(_prop_change_delay_timer);
+ _prop_change_delay_timer = ecore_timer_add(0.1, _prop_change_delay_cb, NULL);
}
}
return ECORE_CALLBACK_PASS_ON;
void
_elm_config_init(void)
{
+ if (!ELM_EVENT_CONFIG_ALL_CHANGED)
+ ELM_EVENT_CONFIG_ALL_CHANGED = ecore_event_type_new();
_desc_init();
_profile_fetch_from_conf();
_config_load();
#undef ENGINE_COMPARE
{
#ifdef HAVE_ELEMENTARY_X
- unsigned int val = 1000;
-
if (!ecore_x_init(NULL))
{
ERR("Cannot connect to X11 display. check $DISPLAY variable");
ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
_prop_change_handler = ecore_event_handler_add
(ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, NULL);
- if (!getenv("ELM_SCALE"))
- {
- if (ecore_x_window_prop_card32_get(_root_1st,
- _atom[ATOM_E_SCALE],
- &val, 1) > 0)
- {
- if (val > 0)
- {
- _elm_config->scale = (double)val / 1000.0;
- // FIXME: hack until e export finger size too
- if (!getenv("ELM_FINGER_SIZE"))
- {
- _elm_config->finger_size = 40.0 * _elm_config->scale;
- }
- edje_scale_set(_elm_config->scale);
- }
- }
- }
- if (!getenv("ELM_FINGER_SIZE"))
- {
- if (ecore_x_window_prop_card32_get(_root_1st,
- _atom[ATOM_E_FINGER_SIZE],
- &val, 1) > 0)
- {
- if (val > 0)
- {
- _elm_config->finger_size = val;
- }
- }
- }
- if (!getenv("ELM_THEME"))
- {
- char *s;
-
- s = ecore_x_window_prop_string_get(_root_1st,
- _atom[ATOM_E_THEME]);
- if (s)
- {
- eina_stringshare_replace(&_elm_config->theme, s);
- _elm_theme_parse(NULL, s);
- free(s);
- }
- }
if (!getenv("ELM_PROFILE"))
{
char *s;
}
void
+_elm_config_all_update(void)
+{
+#ifdef HAVE_ELEMENTARY_X
+ if (_prop_all_update_timer) ecore_timer_del(_prop_all_update_timer);
+ _prop_all_update_timer = ecore_timer_add(0.1, _prop_all_update_cb, NULL);
+ _prop_config_set();
+ ecore_x_window_prop_string_set(_root_1st, _atom[ATOM_E_PROFILE],
+ _elm_profile);
+#endif
+}
+
+void
_elm_config_profile_set(const char *profile)
{
Eina_Bool changed = EINA_FALSE;
void
_elm_config_shutdown(void)
{
+#ifdef HAVE_ELEMENTARY_X
+ if (_prop_all_update_timer)
+ {
+ ecore_timer_del(_prop_all_update_timer);
+ _prop_all_update_cb(NULL);
+ }
+ _prop_all_update_timer = NULL;
+ if (_prop_change_delay_timer) ecore_timer_del(_prop_change_delay_timer);
+ _prop_change_delay_timer = NULL;
+#endif
+
#define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
EAPI void
elm_scale_all_set(double scale)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int scale_i = (unsigned int)(scale * 1000.0);
-
- if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_SCALE");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &scale_i, 1);
-#endif
+ elm_scale_set(scale);
+ _elm_config_all_update();
}
EAPI Eina_Bool
EAPI void
elm_profile_all_set(const char *profile)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
-
- if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_PROFILE");
- ecore_x_window_prop_string_set(ecore_x_window_root_first_get(),
- atom, profile);
-#endif
+ _elm_config_profile_set(profile);
+ _elm_config_all_update();
}
EAPI const char *
EAPI void
elm_font_overlay_all_apply(void)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int dummy = (unsigned int)(1 * 1000.0);
-
- if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FONT_OVERLAY");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(), atom, &dummy,
- 1);
-#endif
+ elm_font_overlay_apply();
+ _elm_config_all_update();
}
EAPI Elm_Font_Properties *
EAPI void
elm_finger_size_all_set(Evas_Coord size)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int size_i = (unsigned int)size;
-
- if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FINGER_SIZE");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &size_i, 1);
-#endif
+ elm_finger_size_set(size);
+ _elm_config_all_update();
}
EAPI void
EAPI void
elm_cache_flush_interval_all_set(int size)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int size_i = (unsigned int)size;
-
- if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_CACHE_FLUSH_INTERVAL");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &size_i, 1);
-#endif
+ elm_cache_flush_interval_set(size);
+ _elm_config_all_update();
}
EAPI Eina_Bool
EAPI void
elm_cache_flush_enabled_all_set(Eina_Bool enabled)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int enabled_i = (unsigned int)enabled;
-
- if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_CACHE_FLUSH_ENABLE");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &enabled_i, 1);
-#endif
+ elm_cache_flush_enabled_set(enabled);
+ _elm_config_all_update();
}
EAPI int
EAPI void
elm_font_cache_all_set(int size)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int size_i = (unsigned int)size;
-
- if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FONT_CACHE");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &size_i, 1);
-#endif
+ elm_font_cache_set(size);
+ _elm_config_all_update();
}
EAPI int
EAPI void
elm_image_cache_all_set(int size)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int size_i = (unsigned int)size;
-
- if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_IMAGE_CACHE");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &size_i, 1);
-#endif
+ elm_image_cache_set(size);
+ _elm_config_all_update();
}
EAPI int
EAPI void
elm_edje_file_cache_all_set(int size)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int size_i = (unsigned int)size;
-
- if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_EDJE_FILE_CACHE");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &size_i, 1);
-#endif
+ elm_edje_file_cache_set(size);
+ _elm_config_all_update();
}
EAPI int
EAPI void
elm_edje_collection_cache_all_set(int size)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int size_i = (unsigned int)size;
-
- if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_EDJE_COLLECTION_CACHE");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &size_i, 1);
-#endif
+ elm_edje_collection_cache_set(size);
+ _elm_config_all_update();
}
EAPI Eina_Bool
EAPI void
elm_scroll_bounce_enabled_all_set(Eina_Bool enabled)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int bounce_enable_i = (unsigned int)enabled;
-
- if (!atom)
- atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BOUNCE_ENABLE");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &bounce_enable_i, 1);
-#endif
+ elm_scroll_bounce_enabled_set(enabled);
+ _elm_config_all_update();
}
EAPI double
EAPI void
elm_scroll_bounce_friction_all_set(double friction)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int bounce_friction_i = (unsigned int)(friction * 1000.0);
-
- if (!atom)
- atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BOUNCE_FRICTION");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &bounce_friction_i, 1);
-#endif
+ elm_scroll_bounce_friction_set(friction);
+ _elm_config_all_update();
}
EAPI double
EAPI void
elm_scroll_page_scroll_friction_all_set(double friction)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int page_scroll_friction_i = (unsigned int)(friction * 1000.0);
-
- if (!atom)
- atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_PAGE_SCROLL_FRICTION");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &page_scroll_friction_i, 1);
-#endif
+ elm_scroll_page_scroll_friction_set(friction);
+ _elm_config_all_update();
}
EAPI double
EAPI void
elm_scroll_bring_in_scroll_friction_all_set(double friction)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int bring_in_scroll_friction_i = (unsigned int)(friction * 1000.0);
-
- if (!atom)
- atom =
- ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BRING_IN_SCROLL_FRICTION");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &bring_in_scroll_friction_i, 1);
-#endif
+ elm_scroll_bring_in_scroll_friction_set(friction);
+ _elm_config_all_update();
}
EAPI double
EAPI void
elm_scroll_zoom_friction_all_set(double friction)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int zoom_friction_i = (unsigned int)(friction * 1000.0);
-
- if (!atom)
- atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_ZOOM_FRICTION");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &zoom_friction_i, 1);
-#endif
+ elm_scroll_zoom_friction_set(friction);
+ _elm_config_all_update();
}
EAPI Eina_Bool
EAPI void
elm_scroll_thumbscroll_enabled_all_set(Eina_Bool enabled)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int ts_enable_i = (unsigned int)enabled;
-
- if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_ENABLE");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &ts_enable_i, 1);
-#endif
+ elm_scroll_thumbscroll_enabled_set(enabled);
+ _elm_config_all_update();
}
EAPI unsigned int
EAPI void
elm_scroll_thumbscroll_threshold_all_set(unsigned int threshold)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int ts_threshold_i = (unsigned int)threshold;
-
- if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_THRESHOLD");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &ts_threshold_i, 1);
-#endif
+ elm_scroll_thumbscroll_threshold_set(threshold);
+ _elm_config_all_update();
}
EAPI double
EAPI void
elm_scroll_thumbscroll_momentum_threshold_all_set(double threshold)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int ts_momentum_threshold_i = (unsigned int)(threshold * 1000.0);
-
- if (!atom)
- atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_MOMENTUM_THRESHOLD");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &ts_momentum_threshold_i, 1);
-#endif
+ elm_scroll_thumbscroll_momentum_threshold_set(threshold);
+ _elm_config_all_update();
}
EAPI double
EAPI void
elm_scroll_thumbscroll_friction_all_set(double friction)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int ts_friction_i = (unsigned int)(friction * 1000.0);
-
- if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_FRICTION");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &ts_friction_i, 1);
-#endif
+ elm_scroll_thumbscroll_friction_set(friction);
+ _elm_config_all_update();
}
EAPI double
EAPI void
elm_scroll_thumbscroll_border_friction_set(double friction)
{
- if (friction < 0.0)
- friction = 0.0;
-
- if (friction > 1.0)
- friction = 1.0;
-
+ if (friction < 0.0) friction = 0.0;
+ if (friction > 1.0) friction = 1.0;
_elm_config->thumbscroll_friction = friction;
}
EAPI void
elm_scroll_thumbscroll_border_friction_all_set(double friction)
{
- if (friction < 0.0)
- friction = 0.0;
-
- if (friction > 1.0)
- friction = 1.0;
-
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int border_friction_i = (unsigned int)(friction * 1000.0);
-
- if (!atom)
- atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BORDER_FRICTION");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &border_friction_i, 1);
-#endif
+ elm_scroll_thumbscroll_border_friction_set(friction);
+ _elm_config_all_update();
}
EAPI double
EAPI void
elm_scroll_thumbscroll_sensitivity_friction_set(double friction)
{
- if (friction < 0.1)
- friction = 0.1;
-
- if (friction > 1.0)
- friction = 1.0;
-
+ if (friction < 0.1) friction = 0.1;
+ if (friction > 1.0) friction = 1.0;
_elm_config->thumbscroll_friction = friction;
}
EAPI void
elm_scroll_thumbscroll_sensitivity_friction_all_set(double friction)
{
- if (friction < 0.1)
- friction = 0.1;
-
- if (friction > 1.0)
- friction = 1.0;
-
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
- unsigned int sensitivity_friction_i = (unsigned int)(friction * 1000.0);
-
- if (!atom)
- atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_SENSITIVITY_FRICTION");
- ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
- atom, &sensitivity_friction_i, 1);
-#endif
+ elm_scroll_thumbscroll_sensitivity_friction_set(friction);
+ _elm_config_all_update();
}
EAPI void
const char *_elm_config_current_profile_get(void);
const char *_elm_config_profile_dir_get(const char *prof, Eina_Bool is_user);
Eina_List *_elm_config_profiles_list(void);
+void _elm_config_all_update(void);
void _elm_config_profile_set(const char *profile);
void _elm_config_engine_set(const char *engine);
EAPI void
elm_theme_all_set(const char *theme)
{
-#ifdef HAVE_ELEMENTARY_X
- static Ecore_X_Atom atom = 0;
-
- if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THEME");
- ecore_x_window_prop_string_set(ecore_x_window_root_first_get(),
- atom, theme);
-#endif
+ eina_stringshare_replace(&_elm_config->theme, theme);
elm_theme_set(NULL, theme);
+ _elm_config_all_update();
}
EAPI Eina_List *