Yes - i know. Release. Freeze. I put this in as it solves a complaint
authorCarsten Haitzler <raster@rasterman.com>
Tue, 28 Aug 2012 10:37:02 +0000 (10:37 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Tue, 28 Aug 2012 10:37:02 +0000 (10:37 +0000)
(i guess bug report) about using cpua nd drawing while minimized.

SVN revision: 75776

ChangeLog
config/default/base.src
config/mobile/base.src
config/standard/base.src
src/lib/elm_config.c
src/lib/elm_priv.h
src/lib/elm_win.c

index 0fe3b72..2d10540 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
        * Patch in incomplete access support in segment control and spinner
 
+2012-08-28  Carsten Haitzler (The Rasterman)
+
+       * Track window states as a total count and be able to self-throttle
+          or suspend rendering as a result.
+
index 8043a8e..d56350c 100644 (file)
@@ -64,6 +64,12 @@ group "Elm_Config" struct {
   value "year_min" int: 2;
   value "year_max" int: 137;
   value "softcursor_mode" uchar: 0;
+  value "auto_norender_withdrawn" uchar: 0;
+  value "auto_norender_iconified_same_as_withdrawn" uchar: 0;
+  value "auto_flush_withdrawn" uchar: 0;
+  value "auto_dump_withdrawn" uchar: 0;
+  value "auto_throttle" uchar: 0;
+  value "auto_throttle_amount" double: 0.1;
   group "color_palette" list {
      group "Elm_Custom_Palette" struct {
         value "palette_name" string: "default";
index 90a4113..090e091 100644 (file)
@@ -64,6 +64,12 @@ group "Elm_Config" struct {
   value "year_min" int: 2;
   value "year_max" int: 137;
   value "softcursor_mode" uchar: 0;
+  value "auto_norender_withdrawn" uchar: 1;
+  value "auto_norender_iconified_same_as_withdrawn" uchar: 1;
+  value "auto_flush_withdrawn" uchar: 1;
+  value "auto_dump_withdrawn" uchar: 1;
+  value "auto_throttle" uchar: 1;
+  value "auto_throttle_amount" double: 0.0666666666;
   group "color_palette" list {
      group "Elm_Custom_Palette" struct {
         value "palette_name" string: "default";
index 5566d10..a234617 100644 (file)
@@ -62,6 +62,12 @@ group "Elm_Config" struct {
   value "weekend_start" int: 6;
   value "weekend_len" int: 2;
   value "softcursor_mode" uchar: 0;
+  value "auto_norender_withdrawn" uchar: 1;
+  value "auto_norender_iconified_same_as_withdrawn" uchar: 0;
+  value "auto_flush_withdrawn" uchar: 1;
+  value "auto_dump_withdrawn" uchar: 1;
+  value "auto_throttle" uchar: 0;
+  value "auto_throttle_amount" double: 0.0333333333;
   group "color_palette" list {
      group "Elm_Custom_Palette" struct {
         value "palette_name" string: "default";
index f9b2d8d..9a11b2c 100644 (file)
@@ -392,6 +392,12 @@ _desc_init(void)
    ELM_CONFIG_VAL(D, T, year_max, T_INT);
    ELM_CONFIG_LIST(D, T, color_palette, _config_color_palette_edd);
    ELM_CONFIG_VAL(D, T, softcursor_mode, T_UCHAR);
+   ELM_CONFIG_VAL(D, T, auto_norender_withdrawn, T_UCHAR);
+   ELM_CONFIG_VAL(D, T, auto_norender_iconified_same_as_withdrawn, T_UCHAR);
+   ELM_CONFIG_VAL(D, T, auto_flush_withdrawn, T_UCHAR);
+   ELM_CONFIG_VAL(D, T, auto_dump_withdrawn, T_UCHAR);
+   ELM_CONFIG_VAL(D, T, auto_throttle, T_UCHAR);
+   ELM_CONFIG_VAL(D, T, auto_throttle_amount, T_DOUBLE);
 #undef T
 #undef D
 #undef T_INT
@@ -1063,6 +1069,12 @@ _config_load(void)
    _elm_config->year_max = 137;
    _elm_config->softcursor_mode = 0; /* 0 = auto, 1 = on, 2 = off */
    _elm_config->color_palette = NULL;
+   _elm_config->auto_norender_withdrawn = 0;
+   _elm_config->auto_norender_iconified_same_as_withdrawn = 1;
+   _elm_config->auto_flush_withdrawn = 0;
+   _elm_config->auto_dump_withdrawn = 0;
+   _elm_config->auto_throttle = 0;
+   _elm_config->auto_throttle_amount = 0.1;
 }
 
 static const char *
@@ -1547,6 +1559,19 @@ _env_get(void)
    if (s) _elm_config->desktop_entry = !!atoi(s);
    s = getenv("ELM_ACCESS_MODE");
    if (s) _elm_config->access_mode = ELM_ACCESS_MODE_ON;
+
+   s = getenv("ELM_AUTO_THROTTLE");
+   if (s) _elm_config->auto_throttle = EINA_TRUE;
+   s = getenv("ELM_AUTO_THROTTLE_AMOUNT");
+   if (s) _elm_config->auto_throttle_amount = _elm_atof(s);
+   s = getenv("ELM_AUTO_NORENDER_WITHDRAWN");
+   if (s) _elm_config->auto_norender_withdrawn = EINA_TRUE;
+   s = getenv("ELM_AUTO_NORENDER_ICONIFIED_SAME_AS_WITHDRAWN");
+   if (s) _elm_config->auto_norender_iconified_same_as_withdrawn = EINA_TRUE;
+   s = getenv("ELM_AUTO_FLUSH_WITHDRAWN");
+   if (s) _elm_config->auto_flush_withdrawn = EINA_TRUE;
+   s = getenv("ELM_AUTO_DUMP_WIDTHDRAWN");
+   if (s) _elm_config->auto_dump_withdrawn = EINA_TRUE;
 }
 
 EAPI Eina_Bool
index be50413..f4af9c8 100644 (file)
@@ -198,9 +198,9 @@ struct _Elm_Config
    double        longpress_timeout;
    unsigned char effect_enable;
    unsigned char desktop_entry;
-   Eina_Bool     password_show_last;
+   unsigned char password_show_last;
    double        password_show_last_timeout;
-   Eina_Bool     glayer_zoom_finger_enable;
+   unsigned char glayer_zoom_finger_enable;
    double        glayer_zoom_finger_factor;
    double        glayer_zoom_wheel_factor;
    double        glayer_zoom_distance_tolerance;
@@ -213,7 +213,7 @@ struct _Elm_Config
    double        glayer_long_tap_start_timeout;
    double        glayer_double_tap_timeout;
    int           access_mode;
-   Eina_Bool     glayer_continues_enable;
+   unsigned char glayer_continues_enable;
    int           week_start;
    int           weekend_start;
    int           weekend_len;
@@ -221,6 +221,12 @@ struct _Elm_Config
    int           year_max;
    Eina_List    *color_palette;
    unsigned char softcursor_mode;
+   unsigned char auto_norender_withdrawn;
+   unsigned char auto_norender_iconified_same_as_withdrawn;
+   unsigned char auto_flush_withdrawn;
+   unsigned char auto_dump_withdrawn;
+   unsigned char auto_throttle;
+   double        auto_throttle_amount;
 
    /* Not part of the EET file */
    Eina_Bool     is_mirrored : 1;
index 5bee88d..6a3fe7e 100644 (file)
@@ -186,6 +186,101 @@ EVAS_SMART_SUBCLASS_NEW
 Eina_List *_elm_win_list = NULL;
 int _elm_win_deferred_free = 0;
 
+static int _elm_win_count = 0;
+static int _elm_win_count_shown = 0;
+static int _elm_win_count_iconified = 0;
+static int _elm_win_count_withdrawn = 0;
+
+static Eina_Bool _elm_win_auto_throttled = EINA_FALSE;
+
+static Ecore_Job *_elm_win_state_eval_job = NULL;
+
+static void
+_elm_win_state_eval(void *data __UNUSED__)
+{
+   Eina_List *l;
+   Evas_Object *obj;
+   
+   _elm_win_state_eval_job = NULL;
+   
+   if (_elm_config->auto_norender_withdrawn)
+     {
+        EINA_LIST_FOREACH(_elm_win_list, l, obj)
+          {
+             if ((elm_win_withdrawn_get(obj)) ||
+                 ((elm_win_iconified_get(obj) && 
+                   (_elm_config->auto_norender_iconified_same_as_withdrawn))))
+               {
+                  if (!evas_object_data_get(obj, "__win_auto_norender"))
+                    {
+                       Evas *evas = evas_object_evas_get(obj);
+                       
+                       elm_win_norender_push(obj);
+                       evas_object_data_set(obj, "__win_auto_norender", obj);
+                       
+                       if (_elm_config->auto_flush_withdrawn)
+                         {
+                            edje_file_cache_flush();
+                            edje_collection_cache_flush();
+                            evas_image_cache_flush(evas);
+                            evas_font_cache_flush(evas);
+                         }
+                       if (_elm_config->auto_dump_withdrawn)
+                         {
+                            evas_render_dump(evas);
+                         }
+                    }
+               }
+             else
+               {
+                  if (evas_object_data_get(obj, "__win_auto_norender"))
+                    {
+                       elm_win_norender_pop(obj);
+                       evas_object_data_del(obj, "__win_auto_norender");
+                    }
+               }
+          }
+     }
+   if (_elm_config->auto_throttle)
+     {
+        if (_elm_win_count == 0)
+          {
+             if (_elm_win_auto_throttled)
+               {
+                  ecore_throttle_adjust(-_elm_config->auto_throttle_amount);
+                  _elm_win_auto_throttled = EINA_FALSE;
+               }
+          }
+        else
+          {
+             if ((_elm_win_count_iconified + _elm_win_count_withdrawn) >= 
+                 _elm_win_count_shown)
+               {
+                  if (!_elm_win_auto_throttled)
+                    {
+                       ecore_throttle_adjust(_elm_config->auto_throttle_amount);
+                       _elm_win_auto_throttled = EINA_TRUE;
+                    }
+               }
+             else
+               {
+                  if (_elm_win_auto_throttled)
+                    {
+                       ecore_throttle_adjust(-_elm_config->auto_throttle_amount);
+                       _elm_win_auto_throttled = EINA_FALSE;
+                    }
+               }
+          }
+     }
+}
+
+static void
+_elm_win_state_eval_queue(void)
+{
+   if (_elm_win_state_eval_job) ecore_job_del(_elm_win_state_eval_job);
+   _elm_win_state_eval_job = ecore_job_add(_elm_win_state_eval, NULL);
+}
+
 // example shot spec (wait 0.1 sec then save as my-window.png):
 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
 
@@ -744,6 +839,9 @@ _elm_win_state_change(Ecore_Evas *ee)
 
    obj = ELM_WIDGET_DATA(sd)->obj;
 
+   if (sd->withdrawn) _elm_win_count_withdrawn--;
+   if (sd->iconified) _elm_win_count_iconified--;
+   
    if (sd->withdrawn != ecore_evas_withdrawn_get(sd->ee))
      {
         sd->withdrawn = ecore_evas_withdrawn_get(sd->ee);
@@ -769,6 +867,11 @@ _elm_win_state_change(Ecore_Evas *ee)
         sd->maximized = ecore_evas_maximized_get(sd->ee);
         ch_maximized = EINA_TRUE;
      }
+
+   if (sd->withdrawn) _elm_win_count_withdrawn++;
+   if (sd->iconified) _elm_win_count_iconified++;
+   _elm_win_state_eval_queue();
+   
    if ((ch_withdrawn) || (ch_iconified))
      {
         if (sd->withdrawn)
@@ -956,6 +1059,11 @@ _elm_win_smart_show(Evas_Object *obj)
 {
    ELM_WIN_DATA_GET(obj, sd);
 
+   if (!evas_object_visible_get(obj))
+     {
+        _elm_win_count_shown++;
+        _elm_win_state_eval_queue();
+     }
    _elm_win_parent_sc->base.show(obj);
 
    TRAP(sd, show);
@@ -969,6 +1077,11 @@ _elm_win_smart_hide(Evas_Object *obj)
 {
    ELM_WIN_DATA_GET(obj, sd);
 
+   if (evas_object_visible_get(obj))
+     {
+        _elm_win_count_shown--;
+        _elm_win_state_eval_queue();
+     }
    _elm_win_parent_sc->base.hide(obj);
 
    TRAP(sd, hide);
@@ -1182,7 +1295,12 @@ _elm_win_smart_del(Evas_Object *obj)
    if (sd->autodel_clear) *(sd->autodel_clear) = -1;
 
    _elm_win_list = eina_list_remove(_elm_win_list, obj);
-
+   if (sd->withdrawn) _elm_win_count_withdrawn--;
+   if (sd->iconified) _elm_win_count_iconified--;
+   if (evas_object_visible_get(obj)) _elm_win_count_shown--;
+   _elm_win_count--;
+   _elm_win_state_eval_queue();
+   
    if (sd->ee)
      {
         ecore_evas_callback_delete_request_set(sd->ee, NULL);
@@ -1632,8 +1750,12 @@ _elm_win_on_resize_obj_changed_size_hints(void *data,
 void
 _elm_win_shutdown(void)
 {
-   while (_elm_win_list)
-     evas_object_del(_elm_win_list->data);
+   while (_elm_win_list) evas_object_del(_elm_win_list->data);
+   if (_elm_win_state_eval_job)
+     {
+        ecore_job_del(_elm_win_state_eval_job);
+        _elm_win_state_eval_job = NULL;
+     }
 }
 
 void
@@ -1661,7 +1783,7 @@ _elm_win_access(Eina_Bool is_access)
    const Eina_List *l;
    Evas_Object *obj;
 
-   EINA_LIST_FOREACH (_elm_win_list, l, obj)
+   EINA_LIST_FOREACH(_elm_win_list, l, obj)
      elm_widget_access(obj, is_access);
 }
 
@@ -2177,9 +2299,7 @@ _elm_x_io_err(void *data __UNUSED__)
    Evas_Object *obj;
 
    EINA_LIST_FOREACH(_elm_win_list, l, obj)
-     {
-        evas_object_smart_callback_call(obj, SIG_IOERR, NULL);
-     }
+     evas_object_smart_callback_call(obj, SIG_IOERR, NULL);
    elm_exit();
 }
 #endif
@@ -2561,7 +2681,8 @@ elm_win_add(Evas_Object *parent,
 #endif
 
    _elm_win_list = eina_list_append(_elm_win_list, obj);
-
+   _elm_win_count++;
+   
    if (((fallback) && (!strcmp(fallback, "Software FB"))) ||
        ((!fallback) && (ENGINE_COMPARE(ELM_SOFTWARE_FB))))
      {