Elm caching settings exposed, part II.
authorGustavo Lima Chaves <glima@profusion.mobi>
Tue, 23 Nov 2010 06:10:58 +0000 (06:10 +0000)
committerGustavo Lima Chaves <glima@profusion.mobi>
Tue, 23 Nov 2010 06:10:58 +0000 (06:10 +0000)
Edje caching primitives exposed in Elm, too, now, and stored at
config. Also, there's now a poller running for all Elm apps doing
cache flushing. All these things have configurable values, of course.

Testing config version bumping too, it should work.

SVN revision: 54851

config/default/base.src
config/illume/base.src
config/standard/base.src
src/bin/config.c
src/lib/Elementary.h.in
src/lib/elm_config.c
src/lib/elm_main.c
src/lib/elm_priv.h

index 433514b..77a7d72 100644 (file)
@@ -15,8 +15,11 @@ group "Elm_Config" struct {
   value "bgpixmap" int: 0;
   value "compositing" int: 1;
   value "font_hinting" int: 2;
+  value "cache_flush_poll_interval" int: 512;
   value "image_cache" int: 4096;
   value "font_cache" int: 512;
+  value "edje_cache" int: 32;
+  value "edje_collection_cache" int: 64;
   value "finger_size" int: 40;
   value "fps" double: 60.0;
   value "theme" string: "default";
index 8b211da..10a3090 100644 (file)
@@ -15,8 +15,11 @@ group "Elm_Config" struct {
   value "bgpixmap" int: 0;
   value "compositing" int: 1;
   value "font_hinting" int: 2;
+  value "cache_flush_poll_interval" int: 512;
   value "image_cache" int: 4096;
   value "font_cache" int: 512;
+  value "edje_cache" int: 32;
+  value "edje_collection_cache" int: 64;
   value "finger_size" int: 40;
   value "fps" double: 60.0;
   value "theme" string: "default";
index 33ee60c..e8befa1 100644 (file)
@@ -15,8 +15,11 @@ group "Elm_Config" struct {
   value "bgpixmap" int: 0;
   value "compositing" int: 1;
   value "font_hinting" int: 2;
+  value "cache_flush_poll_interval" int: 512;
   value "image_cache" int: 4096;
   value "font_cache" int: 512;
+  value "edje_cache" int: 32;
+  value "edje_collection_cache" int: 64;
   value "finger_size" int: 5;
   value "fps" double: 60.0;
   value "theme" string: "default-desktop";
index b20d651..33c53ee 100644 (file)
@@ -119,6 +119,26 @@ config_exit(void *data       __UNUSED__,
 }
 
 static void
+cf_round(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+   double val = elm_slider_value_get(obj);
+   double v;
+
+   v = ((double)((int)(val * 5.0))) / 5.0;
+   if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+cf_change(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+   double scale = elm_scale_get();
+   double val = elm_slider_value_get(obj);
+
+   if (scale == val) return;
+   elm_cache_flush_interval_all_set(val);
+}
+
+static void
 fc_round(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
 {
    double val = elm_slider_value_get(obj);
@@ -199,6 +219,46 @@ fs_change(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
 }
 
 static void
+efc_round(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+   double val = elm_slider_value_get(obj);
+   double v;
+
+   v = ((double)((int)(val * 5.0))) / 5.0;
+   if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+efc_change(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+   double scale = elm_scale_get();
+   double val = elm_slider_value_get(obj);
+
+   if (scale == val) return;
+   elm_edje_file_cache_all_set(val);
+}
+
+static void
+ecc_round(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+   double val = elm_slider_value_get(obj);
+   double v;
+
+   v = ((double)((int)(val * 5.0))) / 5.0;
+   if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+ecc_change(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+   double scale = elm_scale_get();
+   double val = elm_slider_value_get(obj);
+
+   if (scale == val) return;
+   elm_edje_collection_cache_all_set(val);
+}
+
+static void
 _status_basic(Evas_Object *win, Evas_Object *bx0)
 {
    Evas_Object *lb, *fr;
@@ -493,6 +553,7 @@ _font_overlay_change(void *data       __UNUSED__,
 static void
 _profile_change_do(Evas_Object *win, const char *profile)
 {
+   int flush_interval, font_c, image_c, edje_file_c, edje_col_c;
    const char *curr_theme, *curr_engine;
    const Eina_List *l_items, *l;
    Elm_List_Item *it;
@@ -504,6 +565,11 @@ _profile_change_do(Evas_Object *win, const char *profile)
 
    scale = elm_scale_get();
    fs = elm_finger_size_get();
+   flush_interval = elm_cache_flush_interval_get();
+   font_c = elm_font_cache_get();
+   image_c = elm_image_cache_get();
+   edje_file_c = elm_edje_file_cache_get();
+   edje_col_c = elm_edje_collection_cache_get();
 
    /* gotta update root windows' atoms */
    elm_scale_all_set(scale);
@@ -511,6 +577,24 @@ _profile_change_do(Evas_Object *win, const char *profile)
    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_slider_value_set(evas_object_data_get(win,
+                                             "cache_flush_interval_slider"),
+                        flush_interval);
+   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_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_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_slider_value_set(evas_object_data_get(win,
+                                             "edje_collection_cache_slider"),
+                        edje_col_c);
+
    curr_theme = _elm_theme_current_get(elm_theme_get(NULL));
    elm_theme_all_set(curr_theme);
 
@@ -2049,6 +2133,42 @@ _status_config_caches(Evas_Object *win, Evas_Object *pager)
    lb = elm_label_add(win);
    evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, 0.5);
+   elm_label_label_set(lb,"<hilight>Cache Flush Interval</>");
+   elm_frame_content_set(pd, lb);
+   evas_object_show(lb);
+
+   sl = elm_slider_add(win);
+   evas_object_data_set(win, "cache_flush_interval_slider", sl);
+   evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+   elm_slider_span_size_set(sl, 120);
+   elm_slider_unit_format_set(sl, "%1.0f ticks");
+   elm_slider_indicator_format_set(sl, "%1.0f");
+   elm_slider_min_max_set(sl, 8.0, 4096.0);
+   elm_slider_value_set(sl, elm_cache_flush_interval_get());
+   elm_box_pack_end(bx, sl);
+   evas_object_show(sl);
+
+   evas_object_smart_callback_add(sl, "changed", cf_round, NULL);
+   evas_object_smart_callback_add(sl, "delay,changed", cf_change, NULL);
+
+   sp = elm_separator_add(win);
+   elm_separator_horizontal_set(sp, 1);
+   evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
+   elm_box_pack_end(bx, sp);
+   evas_object_show(sp);
+
+   pd = elm_frame_add(win);
+   evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(pd, EVAS_HINT_FILL, 0.5);
+   elm_object_style_set(pd, "pad_medium");
+   elm_box_pack_end(bx, pd);
+   evas_object_show(pd);
+
+   lb = elm_label_add(win);
+   evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, 0.5);
    elm_label_label_set(lb,"<hilight>Font Cache Size</>");
    elm_frame_content_set(pd, lb);
    evas_object_show(lb);
@@ -2058,10 +2178,10 @@ _status_config_caches(Evas_Object *win, Evas_Object *pager)
    evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
    elm_slider_span_size_set(sl, 120);
-   elm_slider_unit_format_set(sl, "%1.1f");
-   elm_slider_indicator_format_set(sl, "%1.1f MB");
+   elm_slider_unit_format_set(sl, "%1.1f MB");
+   elm_slider_indicator_format_set(sl, "%1.1f");
    elm_slider_min_max_set(sl, 0.0, 4.0);
-   elm_slider_value_set(sl, (double)elm_font_cache_get() / 1024);
+   elm_slider_value_set(sl, (double)elm_font_cache_get() / 1024.0);
    elm_box_pack_end(bx, sl);
    evas_object_show(sl);
 
@@ -2094,16 +2214,88 @@ _status_config_caches(Evas_Object *win, Evas_Object *pager)
    evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
    elm_slider_span_size_set(sl, 120);
-   elm_slider_unit_format_set(sl, "%1.0f");
-   elm_slider_indicator_format_set(sl, "%1.0f MB");
+   elm_slider_unit_format_set(sl, "%1.0f MB");
+   elm_slider_indicator_format_set(sl, "%1.0f");
    elm_slider_min_max_set(sl, 0, 32);
-   elm_slider_value_set(sl, (double)elm_image_cache_get() / 1024);
+   elm_slider_value_set(sl, (double)elm_image_cache_get() / 1024.0);
    elm_box_pack_end(bx, sl);
    evas_object_show(sl);
 
    evas_object_smart_callback_add(sl, "changed", ic_round, NULL);
    evas_object_smart_callback_add(sl, "delay,changed", ic_change, NULL);
 
+   sp = elm_separator_add(win);
+   elm_separator_horizontal_set(sp, 1);
+   evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
+   elm_box_pack_end(bx, sp);
+   evas_object_show(sp);
+
+   pd = elm_frame_add(win);
+   evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(pd, EVAS_HINT_FILL, 0.5);
+   elm_object_style_set(pd, "pad_medium");
+   elm_box_pack_end(bx, pd);
+   evas_object_show(pd);
+
+   lb = elm_label_add(win);
+   evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, 0.5);
+   elm_label_label_set(lb,"<hilight>Number of Edje Files to Cache</>");
+   elm_frame_content_set(pd, lb);
+   evas_object_show(lb);
+
+   sl = elm_slider_add(win);
+   evas_object_data_set(win, "edje_file_cache_slider", sl);
+   evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+   elm_slider_span_size_set(sl, 120);
+   elm_slider_unit_format_set(sl, "%1.0f files");
+   elm_slider_indicator_format_set(sl, "%1.0f");
+   elm_slider_min_max_set(sl, 0, 256);
+   elm_slider_value_set(sl, elm_edje_file_cache_get());
+   elm_box_pack_end(bx, sl);
+   evas_object_show(sl);
+
+   evas_object_smart_callback_add(sl, "changed", efc_round, NULL);
+   evas_object_smart_callback_add(sl, "delay,changed", efc_change, NULL);
+
+   sp = elm_separator_add(win);
+   elm_separator_horizontal_set(sp, 1);
+   evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
+   elm_box_pack_end(bx, sp);
+   evas_object_show(sp);
+
+   pd = elm_frame_add(win);
+   evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(pd, EVAS_HINT_FILL, 0.5);
+   elm_object_style_set(pd, "pad_medium");
+   elm_box_pack_end(bx, pd);
+   evas_object_show(pd);
+
+   lb = elm_label_add(win);
+   evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, 0.5);
+   elm_label_label_set(lb,"<hilight>Number of Edje Collections to Cache</>");
+   elm_frame_content_set(pd, lb);
+   evas_object_show(lb);
+
+   sl = elm_slider_add(win);
+   evas_object_data_set(win, "edje_collection_cache_slider", sl);
+   evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+   elm_slider_span_size_set(sl, 120);
+   elm_slider_unit_format_set(sl, "%1.0f collections");
+   elm_slider_indicator_format_set(sl, "%1.0f");
+   elm_slider_min_max_set(sl, 0, 512);
+   elm_slider_value_set(sl, elm_edje_collection_cache_get());
+   elm_box_pack_end(bx, sl);
+   evas_object_show(sl);
+
+   evas_object_smart_callback_add(sl, "changed", ecc_round, NULL);
+   evas_object_smart_callback_add(sl, "delay,changed", ecc_change, NULL);
+
    evas_object_data_set(win, "caches", bx);
 
    elm_pager_content_push(pager, bx);
index 4347696..63e18e2 100644 (file)
@@ -251,12 +251,21 @@ extern "C" {
    EAPI int          elm_policy_get(unsigned int policy);
 
    EAPI void         elm_all_flush(void);
+   EAPI int          elm_cache_flush_interval_get(void);
+   EAPI void         elm_cache_flush_interval_set(int size);
+   EAPI void         elm_cache_flush_interval_all_set(int size);
    EAPI int          elm_font_cache_get(void);
    EAPI void         elm_font_cache_set(int size);
    EAPI void         elm_font_cache_all_set(int size);
    EAPI int          elm_image_cache_get(void);
    EAPI void         elm_image_cache_set(int size);
    EAPI void         elm_image_cache_all_set(int size);
+   EAPI int          elm_edje_file_cache_get(void);
+   EAPI void         elm_edje_file_cache_set(int size);
+   EAPI void         elm_edje_file_cache_all_set(int size);
+   EAPI int          elm_edje_collection_cache_get(void);
+   EAPI void         elm_edje_collection_cache_set(int size);
+   EAPI void         elm_edje_collection_cache_all_set(int size);
 
    EAPI void         elm_object_scale_set(Evas_Object *obj, double scale);
    EAPI double       elm_object_scale_get(const Evas_Object *obj);
index 722e5c6..dfe81ec 100644 (file)
@@ -14,6 +14,8 @@ char *_elm_profile = NULL;
 static Eet_Data_Descriptor *_config_edd = NULL;
 static Eet_Data_Descriptor *_config_font_overlay_edd = NULL;
 
+static Ecore_Poller *_elm_cache_flush_poller = NULL;
+
 const char *_elm_engines[] = {
    "software_x11",
    "fb",
@@ -62,7 +64,7 @@ static size_t _elm_user_dir_snprintf(char *dst, size_t size, const char *fmt, ..
 #ifdef HAVE_ELEMENTARY_X
 static Ecore_Event_Handler *_prop_change_handler = NULL;
 static Ecore_X_Window _root_1st = 0;
-#define ATOM_COUNT 8
+#define ATOM_COUNT 11
 static Ecore_X_Atom _atom[ATOM_COUNT];
 static Ecore_X_Atom _atom_config = 0;
 static const char *_atom_names[ATOM_COUNT] =
@@ -72,8 +74,11 @@ static const char *_atom_names[ATOM_COUNT] =
     "ENLIGHTENMENT_THEME",
     "ENLIGHTENMENT_PROFILE",
     "ENLIGHTENMENT_FONT_OVERLAY",
+    "ENLIGHTENMENT_CACHE_FLUSH_INTERVAL",
     "ENLIGHTENMENT_FONT_CACHE",
     "ENLIGHTENMENT_IMAGE_CACHE",
+    "ENLIGHTENMENT_EDJE_FILE_CACHE",
+    "ENLIGHTENMENT_EDJE_COLLECTION_CACHE",
     "ENLIGHTENMENT_CONFIG"
   };
 #define ATOM_E_SCALE 0
@@ -81,9 +86,12 @@ static const char *_atom_names[ATOM_COUNT] =
 #define ATOM_E_THEME 2
 #define ATOM_E_PROFILE 3
 #define ATOM_E_FONT_OVERLAY 4
-#define ATOM_E_FONT_CACHE 5
-#define ATOM_E_IMAGE_CACHE 6
-#define ATOM_E_CONFIG 7
+#define ATOM_E_CACHE_FLUSH_INTERVAL 5
+#define ATOM_E_FONT_CACHE 6
+#define ATOM_E_IMAGE_CACHE 7
+#define ATOM_E_EDJE_FILE_CACHE 8
+#define ATOM_E_EDJE_COLLECTION_CACHE 9
+#define ATOM_E_CONFIG 10
 
 static Eina_Bool _prop_config_get(void);
 static Eina_Bool _prop_change(void *data __UNUSED__, int ev_type __UNUSED__, void *ev);
@@ -137,6 +145,7 @@ _prop_config_get(void)
    _config_apply();
    _elm_config_font_overlay_apply();
    _elm_rescale();
+   _elm_recache();
    return EINA_TRUE;
 }
 
@@ -159,7 +168,11 @@ _prop_change(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
 
                   pscale = _elm_config->scale;
                   if (val > 0) _elm_config->scale = (double)val / 1000.0;
-                  if (pscale != _elm_config->scale) _elm_rescale();
+                  if (pscale != _elm_config->scale)
+                      {
+                         _elm_rescale();
+                         _elm_recache();
+                      }
                }
           }
         else if (event->atom == _atom[ATOM_E_FINGER_SIZE])
@@ -174,7 +187,11 @@ _prop_change(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
 
                   pfinger_size = _elm_config->finger_size;
                   _elm_config->finger_size = val;
-                  if (pfinger_size != _elm_config->finger_size) _elm_rescale();
+                  if (pfinger_size != _elm_config->finger_size)
+                      {
+                         _elm_rescale();
+                         _elm_recache();
+                      }
                }
           }
         else if (event->atom == _atom[ATOM_E_THEME])
@@ -189,6 +206,7 @@ _prop_change(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
                   _elm_theme_parse(NULL, val);
                   free(val);
                   _elm_rescale();
+                  _elm_recache();
                }
           }
         else if (event->atom == _atom[ATOM_E_PROFILE])
@@ -235,6 +253,23 @@ _prop_change(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
                   _elm_rescale();
                }
           }
+        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();
+               }
+          }
         if (event->atom == _atom[ATOM_E_FONT_CACHE])
           {
              unsigned int val = 1000;
@@ -267,6 +302,39 @@ _prop_change(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
                     _elm_recache();
                }
           }
+        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();
+               }
+          }
+        if (event->atom == _atom[ATOM_E_EDJE_COLLECTION_CACHE])
+          {
+             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 (((_atom_config > 0) && (event->atom == _atom_config)) ||
                  (event->atom == _atom[ATOM_E_CONFIG]))
           {
@@ -338,8 +406,11 @@ _desc_init(void)
    /* EET_DATA_DESCRIPTOR_ADD_LIST(D, T, "font_dirs", font_dirs, sub_edd); */
    ELM_CONFIG_LIST(D, T, font_overlays, _config_font_overlay_edd);
    ELM_CONFIG_VAL(D, T, font_hinting, T_INT);
+   ELM_CONFIG_VAL(D, T, cache_flush_poll_interval, T_INT);
    ELM_CONFIG_VAL(D, T, image_cache, T_INT);
    ELM_CONFIG_VAL(D, T, font_cache, T_INT);
+   ELM_CONFIG_VAL(D, T, edje_cache, T_INT);
+   ELM_CONFIG_VAL(D, T, edje_collection_cache, T_INT);
    ELM_CONFIG_VAL(D, T, finger_size, T_INT);
    ELM_CONFIG_VAL(D, T, fps, T_DOUBLE);
    ELM_CONFIG_VAL(D, T, theme, T_STRING);
@@ -745,6 +816,16 @@ _config_sub_apply(void)
    if (_elm_config->modules) _elm_module_parse(_elm_config->modules);
 }
 
+static Eina_Bool
+_elm_cache_flush_cb(void *data __UNUSED__)
+{
+   elm_all_flush();
+   return ECORE_CALLBACK_RENEW;
+}
+
+/* kind of abusing this call right now -- shared between all of those
+ * properties -- but they are not meant to be called that periodically
+ * anyway */
 void
 _elm_recache(void)
 {
@@ -756,8 +837,23 @@ _elm_recache(void)
    EINA_LIST_FOREACH(_elm_win_list, l, win)
      {
         Evas *e = evas_object_evas_get(win);
-        evas_image_cache_set(e, _elm_config->image_cache * 1024);
-        evas_font_cache_set(e, _elm_config->font_cache * 1024);
+        evas_image_cache_set(e, _elm_config->image_cache);
+        evas_font_cache_set(e, _elm_config->font_cache);
+     }
+   edje_file_cache_set(_elm_config->edje_cache);
+   edje_collection_cache_set(_elm_config->edje_collection_cache);
+
+   if (_elm_cache_flush_poller)
+     {
+        ecore_poller_del(_elm_cache_flush_poller);
+        _elm_cache_flush_poller = NULL;
+     }
+   if (_elm_config->cache_flush_poll_interval > 0)
+     {
+        _elm_cache_flush_poller =
+          ecore_poller_add(ECORE_POLLER_CORE,
+                           _elm_config->cache_flush_poll_interval,
+                           _elm_cache_flush_cb, NULL);
      }
 }
 
@@ -829,19 +925,22 @@ _config_load(void)
    _elm_config->thumbscroll_momentum_threshold = 100.0;
    _elm_config->thumbscroll_friction = 1.0;
    _elm_config->thumbscroll_bounce_friction = 0.5;
-   _elm_config->thumbscroll_border_friction = 0.5;
+   _elm_config->thumbscroll_bounce_enable = EINA_TRUE;
    _elm_config->page_scroll_friction = 0.5;
    _elm_config->bring_in_scroll_friction = 0.5;
    _elm_config->zoom_friction = 0.5;
-   _elm_config->thumbscroll_bounce_enable = EINA_TRUE;
+   _elm_config->thumbscroll_border_friction = 0.5;
    _elm_config->scale = 1.0;
    _elm_config->bgpixmap = 0;
+   _elm_config->compositing = 1;
    _elm_config->font_hinting = 2;
+   _elm_config->cache_flush_poll_interval = 512;
    _elm_config->font_dirs = NULL;
    _elm_config->image_cache = 4096;
    _elm_config->font_cache = 512;
+   _elm_config->edje_cache = 32;
+   _elm_config->edje_collection_cache = 64;
    _elm_config->finger_size = 40;
-   _elm_config->compositing = 1;
    _elm_config->fps = 60.0;
    _elm_config->theme = eina_stringshare_add("default");
    _elm_config->modules = NULL;
@@ -1261,6 +1360,7 @@ _elm_config_init(void)
    _env_get();
    _config_apply();
    _elm_config_font_overlay_apply();
+   _elm_recache();
 }
 
 void
@@ -1366,6 +1466,7 @@ _elm_config_reload(void)
   _config_apply();
   _elm_config_font_overlay_apply();
   _elm_rescale();
+  _elm_recache();
 }
 
 void
@@ -1398,6 +1499,7 @@ _elm_config_profile_set(const char *profile)
       _config_apply();
       _elm_config_font_overlay_apply();
       _elm_rescale();
+      _elm_recache();
     }
 }
 
index 32e8388..0841932 100644 (file)
@@ -1791,6 +1791,65 @@ elm_all_flush(void)
 }
 
 /**
+ * Get the configured cache flush interval time
+ *
+ * This gets the globally configured cache flush interval time, in
+ * ticks
+ *
+ * @return The cache flush interval time
+ * @ingroup Caches
+ *
+ * @see elm_all_flush()
+ */
+EAPI int
+elm_cache_flush_interval_get(void)
+{
+   return _elm_config->cache_flush_poll_interval;
+}
+
+/**
+ * Set the configured cache flush interval time
+ *
+ * This sets the globally configured cache flush interval time, in ticks
+ *
+ * @param size The cache flush interval time
+ * @ingroup Caches
+ *
+ * @see elm_all_flush()
+ */
+EAPI void
+elm_cache_flush_interval_set(int size)
+{
+   if (_elm_config->cache_flush_poll_interval == size) return;
+   _elm_config->cache_flush_poll_interval = size;
+
+   _elm_recache();
+}
+
+/**
+ * Set the configured cache flush interval time for all applications on the
+ * display
+ *
+ * This sets the globally configured cache flush interval time -- in ticks
+ * -- for all applications on the display.
+ *
+ * @param size The cache flush interval time
+ * @ingroup Caches
+ */
+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
+}
+
+/**
  * Get the configured font cache size
  *
  * This gets the globally configured font cache size, in bytes
@@ -1899,6 +1958,118 @@ elm_image_cache_all_set(int size)
 }
 
 /**
+ * Get the configured edje file cache size.
+ *
+ * This gets the globally configured edje file cache size, in number
+ * of files.
+ *
+ * @return The edje file cache size
+ * @ingroup Caches
+ */
+EAPI int
+elm_edje_file_cache_get(void)
+{
+   return _elm_config->edje_cache;
+}
+
+/**
+ * Set the configured edje file cache size
+ *
+ * This sets the globally configured edje file cache size, in number
+ * of files.
+ *
+ * @param size The edje file cache size
+ * @ingroup Caches
+ */
+EAPI void
+elm_edje_file_cache_set(int size)
+{
+   if (_elm_config->edje_cache == size) return;
+   _elm_config->edje_cache = size;
+
+   _elm_recache();
+}
+
+/**
+ * Set the configured edje file cache size for all applications on the
+ * display
+ *
+ * This sets the globally configured edje file cache size -- in number
+ * of files -- for all applications on the display.
+ *
+ * @param size The edje file cache size
+ * @ingroup Caches
+ */
+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
+}
+
+/**
+ * Get the configured edje collections (groups) cache size.
+ *
+ * This gets the globally configured edje collections cache size, in
+ * number of collections.
+ *
+ * @return The edje collections cache size
+ * @ingroup Caches
+ */
+EAPI int
+elm_edje_collection_cache_get(void)
+{
+   return _elm_config->edje_collection_cache;
+}
+
+/**
+ * Set the configured edje collections (groups) cache size
+ *
+ * This sets the globally configured edje collections cache size, in
+ * number of collections.
+ *
+ * @param size The edje collections cache size
+ * @ingroup Caches
+ */
+EAPI void
+elm_edje_collection_cache_set(int size)
+{
+   if (_elm_config->edje_collection_cache == size) return;
+   _elm_config->edje_collection_cache = size;
+
+   _elm_recache();
+}
+
+/**
+ * Set the configured edje collections (groups) cache size for all
+ * applications on the display
+ *
+ * This sets the globally configured edje collections cache size -- in
+ * number of collections -- for all applications on the display.
+ *
+ * @param size The edje collections cache size
+ * @ingroup Caches
+ */
+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
+}
+
+/**
  * Adjust size of an element for finger usage
  *
  * This takes width and height sizes (in pixels) as input and a size multiple
index c3a9c59..da88de2 100644 (file)
@@ -48,7 +48,7 @@ struct _Elm_Theme
 /* increment this whenever a new set of config values are added but the users
  * config doesn't need to be wiped - simply new values need to be put in
  */
-#define ELM_CONFIG_FILE_GENERATION 0x0001
+#define ELM_CONFIG_FILE_GENERATION 0x0002
 #define ELM_CONFIG_VERSION         ((ELM_CONFIG_EPOCH << 16) | ELM_CONFIG_FILE_GENERATION)
 
 /* note: always remember to sync it with elm_config.c */
@@ -89,8 +89,11 @@ struct _Elm_Config
    Eina_List   *font_dirs;
    Eina_List   *font_overlays;
    int          font_hinting;
+   int          cache_flush_poll_interval;
    int          image_cache;
    int          font_cache;
+   int          edje_cache;
+   int          edje_collection_cache;
    int          finger_size;
    double       fps;
    const char  *theme;