e:
authorCarsten Haitzler <raster@rasterman.com>
Fri, 11 Jan 2008 07:33:57 +0000 (07:33 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Fri, 11 Jan 2008 07:33:57 +0000 (07:33 +0000)
1. configure/build changes to allow cross-compiling painlessly
2. pager module namespace changes - this was still dirty afdter the namespace
cleanup, so clean it up
3. add a powersave subsystem - doesnt have an "automatic" way to turn on and
off right now, this i think is best provided by modules (that do things like
monitor acpi status's (eg close lid of laptop), AC power status etc. etc.
this allows e to nicely defer "power" expensive actions to avoid disk
spinups etc.
4. move to use the new ecore poller system  - discussed long ago as part of
power management/saving issues. now it exists
5. add a canvas idle flush call that helsp cope with the new shm greedy
software x11 engine stuff
6. use the new powersave subsystem where appropriate
7. fix non-zeroed/initted memory access in e_fm_main
8. fix mem leak for e menus
9. remove ipc handlers for changed/removed config values
10. use animaotr not timer for menu scrolls - then menu scrolls obey the fps
config
11. fix up timer/poll happienss of cursor idle stuff
12. remove avoid damage from popups for now - causing problems
13. change battery and temp readouts to b e shorter so they fit
14. pager can emit signals on focus change for mini-windows now
15. temperature module now uses a slave process and uses stdin/out to talk to
it and get output - this makes e smoother as in my expereicne i found getting
the temp on my laptop actually took like 200ms so e "hang" for 200ms while
reading the acpi files - so now the subprocess does it and just writesa back
to e when it gets it.

ecore:
1. add ecore_pollers. see the documentation on them in doxygen comments :)
2. fix timers to only go off when they have to - bug there that made e's
select time out a LOT more than it needed to. defensive coding hid the
problem. now fixed. e should be much more power friendly now.
3. formatting/niceness in ecore_exe stuff
4. some comments on comments with SIGIO ideas vs. select
5. add call to be able to add an idle enterer at the start of the list of
them, not just the end (as has been the default)
6. fix ecore_evas to support auto evas idler calls after 0.5 secs of idle in
all canvases - and to do it right
7. if argb destination - set the shape EVENT shape (to mask out events in
transparent regions much like shape does withotu translucency)
8. in ecore_x add support for the event shape

evas:
1. fix cache to work properly and not just always fill up (as it seemed to
like to think cahce useage dropped below 0 when it didnt and thus just
over-fill)
2. software x11 engine now ONLY uses shm segments - no ximages over the
socket. this ximage hack was there to avoid the 2 round trips involved in
setting up an shm image - now i mitigated that wih an shm image cache pool.
it keeps shm images around and repurposes them for new update regions if
appropriate. this means many fewer shm creates (about 1/100th the number) and
since we recycle the memory less 0 memory page filling by the kernel - in the
end, i recorded about a 10-20% speedup over the old software x11 engine.
simple tests i have seen up to 120% speedups. idle flush now does something -
it frees all the cached shm segments. it has a hard-coded limit of 4mb worth
of shm segments (or 32 segments - whichever comes first) to keep around. once
can never complain much about speedups methinks :). also evas will defer sync
until the NEXT frame is written - this means evas can calculate the next
frame of data while x dma's/copies the images to the screen at the same time
(if you hve a dual core or multi-cpu machnike or your xserver is able to use
DMA to copy image data to the screen/video ram then this should see a decent
speedup).

SVN revision: 33448

40 files changed:
configure.in
data/themes/default_pager.edc
src/bin/Makefile.am
src/bin/e_border.c
src/bin/e_border.h
src/bin/e_canvas.c
src/bin/e_canvas.h
src/bin/e_config.c
src/bin/e_config.h
src/bin/e_desklock.c
src/bin/e_exehist.c
src/bin/e_fm_custom.c
src/bin/e_fm_main.c
src/bin/e_gadcon.c
src/bin/e_includes.h
src/bin/e_int_menus.c
src/bin/e_ipc_handlers.h
src/bin/e_main.c
src/bin/e_menu.c
src/bin/e_place.c
src/bin/e_pointer.c
src/bin/e_pointer.h
src/bin/e_popup.c
src/bin/e_powersave.c [new file with mode: 0644]
src/bin/e_powersave.h [new file with mode: 0644]
src/bin/e_utils.c
src/modules/battery/e_mod_config.c
src/modules/battery/e_mod_main.c
src/modules/battery/e_mod_main.h
src/modules/conf_performance/e_int_config_performance.c
src/modules/cpufreq/e_mod_main.c
src/modules/cpufreq/e_mod_main.h
src/modules/cpufreq/freqset.c
src/modules/pager/e_mod_config.c
src/modules/pager/e_mod_main.c
src/modules/pager/e_mod_main.h
src/modules/temperature/Makefile.am
src/modules/temperature/e_mod_config.c
src/modules/temperature/e_mod_main.c
src/modules/temperature/e_mod_main.h

index 5f7e14a..f826fb2 100644 (file)
@@ -109,15 +109,27 @@ AC_SUBST(PACKAGE_DATA_DIR)
 AC_SUBST(LOCALE_DIR)
 AC_SUBST(PACKAGE_SYSCONF_DIR)
 
+#######################################
+## Simple X11 build/link
+
+AC_ARG_ENABLE(simple-x11,
+  AC_HELP_STRING([--enable-simple-x11], [enable simple x11 linking]),
+  [ want_evas_simple_x11=$enableval ]
+)
+    
 x_dir=""
 x_cflags=""
 x_libs=""
 AC_PATH_XTRA
 AC_CHECK_HEADER(X11/X.h,
   [
-    x_dir=${x_dir:-/usr/X11R6}
-    x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
-    x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext"
+    if test "x$want_evas_simple_x11" = "xyes"; then
+      x_libs="${x_libs} -lX11 -lXext"
+    else
+      x_dir=${x_dir:-/usr/X11R6}
+      x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
+      x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext"
+    fi
   ],[
     AC_MSG_ERROR([Cannot find X headers and libraries.])
   ]
index bd796bd..2850b2b 100644 (file)
@@ -10,7 +10,7 @@ images {
 }
 
 group {
-   name: "e/widgets/pager/popup";
+   name: "e/modules/pager/popup";
    parts {
       part {
         name:          "base";
@@ -96,7 +96,7 @@ group {
         }
       }
       part {
-        name: "text";
+        name: "e.text.label";
         type: TEXT;
         effect: SOFT_SHADOW;
         mouse_events: 0;
@@ -134,12 +134,12 @@ group {
            rel1 {
               relative: 0.0 0.0;
               offset:  16   -7;
-              to_y: "text";
+              to_y: "e.text.label";
            }
            rel2 {
               relative: 1.0 1.0;
               offset:  -17  6;
-              to_y: "text";
+              to_y: "e.text.label";
            }
            image {
               normal: "e17_ibar_over_h.png";
@@ -189,7 +189,7 @@ group {
         }
       }
       part {
-        name:          "pager";
+        name:          "e.swallow.content";
         type:          SWALLOW;
         clip_to:       "items_clip";
         description {
@@ -316,7 +316,7 @@ group {
         }
       }
       part {
-        name:          "items";
+        name:          "e.swallow.content";
         type:          SWALLOW;
         clip_to:       "clip";
          description {
@@ -647,7 +647,7 @@ group {
         }
       }
       part {
-        name:           "icon";
+        name:           "e.swallow.icon";
         type:           SWALLOW;
         description {
            state:       "default" 0.0;
index c2678d9..517e91a 100644 (file)
@@ -158,7 +158,8 @@ e_fm_shared.h \
 e_config_data.h \
 e_intl_data.h \
 e_toolbar.h \
-e_int_toolbar_config.h
+e_int_toolbar_config.h \
+e_powersave.h
 
 enlightenment_src = \
 e_user.c \
@@ -290,6 +291,7 @@ e_widget_font_preview.c \
 e_fm_custom.c \
 e_toolbar.c \
 e_int_toolbar_config.c \
+e_powersave.c \
 $(ENLIGHTENMENTHEADERS)
 
 enlightenment_SOURCES = \
index b5fd894..7ceafb3 100644 (file)
@@ -93,7 +93,7 @@ static int  _e_border_move_begin(E_Border *bd);
 static int  _e_border_move_end(E_Border *bd);
 static void _e_border_move_update(E_Border *bd);
 
-static int  _e_border_cb_ping_timer(void *data);
+static int  _e_border_cb_ping_poller(void *data);
 static int  _e_border_cb_kill_timer(void *data);
 
 static void _e_border_pointer_resize_begin(E_Border *bd);
@@ -2887,9 +2887,10 @@ e_border_ping(E_Border *bd)
    bd->ping_ok = 0;
    ecore_x_netwm_ping_send(bd->client.win);
    bd->ping = ecore_time_get();
-   if (bd->ping_timer) ecore_timer_del(bd->ping_timer);
-   bd->ping_timer = ecore_timer_add(e_config->ping_clients_wait,
-                                   _e_border_cb_ping_timer, bd);
+   if (bd->ping_poller) ecore_poller_del(bd->ping_poller);
+   bd->ping_poller = ecore_poller_add(ECORE_POLLER_CORE,
+                                     e_config->ping_clients_interval,
+                                     _e_border_cb_ping_poller, bd);
 }
 
 EAPI void
@@ -3213,10 +3214,10 @@ _e_border_free(E_Border *bd)
        ecore_timer_del(bd->kill_timer);
        bd->kill_timer = NULL;
      }
-   if (bd->ping_timer)
+   if (bd->ping_poller)
      {
-       ecore_timer_del(bd->ping_timer);
-       bd->ping_timer = NULL;
+       ecore_poller_del(bd->ping_poller);
+       bd->ping_poller = NULL;
      }
    while (bd->pending_move_resize)
      {
@@ -5352,8 +5353,8 @@ _e_border_eval(E_Border *bd)
          e_border_ping(bd);
        else
          {
-            if (bd->ping_timer) ecore_timer_del(bd->ping_timer);
-            bd->ping_timer = NULL;
+            if (bd->ping_poller) ecore_timer_del(bd->ping_poller);
+            bd->ping_poller = NULL;
          }
        bd->client.icccm.fetch.protocol = 0;
      }
@@ -6285,15 +6286,15 @@ _e_border_eval(E_Border *bd)
        if ((bd->shaded) && (!bd->shading))
          {
             evas_obscured_clear(bd->bg_evas);
-            if (0)
-              {
-                 if (bd->post_job) ecore_idle_enterer_del(bd->post_job);
-                 bd->post_job = ecore_idle_enterer_add(_e_border_post_move_resize_job,
-                                                       bd);
-                 bd->post_move = 1;
-                 bd->post_resize = 1;
-              }
-            else
+//          if (0)
+//            {
+//               if (bd->post_job) ecore_idle_enterer_del(bd->post_job);
+//               bd->post_job = ecore_idle_enterer_add(_e_border_post_move_resize_job,
+//                                                     bd);
+//               bd->post_move = 1;
+//               bd->post_resize = 1;
+//            }
+//          else
               {
                  ecore_x_window_move_resize(bd->win, 
                                             bd->x + bd->fx.x, 
@@ -6319,15 +6320,15 @@ _e_border_eval(E_Border *bd)
                                         bd->client_inset.l, bd->client_inset.t,
                                         bd->w - (bd->client_inset.l + bd->client_inset.r),
                                         bd->h - (bd->client_inset.t + bd->client_inset.b));
-            if (0)
-              {
-                 if (bd->post_job) ecore_idle_enterer_del(bd->post_job);
-                 bd->post_job = ecore_idle_enterer_add(_e_border_post_move_resize_job,
-                                                       bd);
-                 bd->post_move = 1;
-                 bd->post_resize = 1;
-              }
-            else
+//          if (0)
+//            {
+//               if (bd->post_job) ecore_idle_enterer_del(bd->post_job);
+//               bd->post_job = ecore_idle_enterer_add(_e_border_post_move_resize_job,
+//                                                     bd);
+//               bd->post_move = 1;
+//               bd->post_resize = 1;
+//            }
+//          else
               {
                  ecore_x_window_move_resize(bd->win,
                                             bd->x + bd->fx.x,
@@ -7467,7 +7468,7 @@ _e_border_move_update(E_Border *bd)
 }
 
 static int
-_e_border_cb_ping_timer(void *data)
+_e_border_cb_ping_poller(void *data)
 {
    E_Border *bd;
    
@@ -7499,7 +7500,7 @@ _e_border_cb_ping_timer(void *data)
             e_border_act_kill_begin(bd);
          }
      }
-   bd->ping_timer = NULL;
+   bd->ping_poller = NULL;
    e_border_ping(bd);
    return 0;
 }
index f5a211b..d3d9ccb 100644 (file)
@@ -460,7 +460,7 @@ struct _E_Border
    unsigned int layer;
    E_Action *cur_mouse_action;
    Ecore_Timer *raise_timer;
-   Ecore_Timer *ping_timer;
+   Ecore_Timer *ping_poller;
    Ecore_Timer *kill_timer;
    int shape_rects_num;
    Ecore_X_Rectangle *shape_rects;
index 9223c9c..41fea1a 100644 (file)
@@ -8,7 +8,7 @@ static int _e_canvas_cb_flush(void *data);
 
 /* local subsystem globals */
 static Evas_List *_e_canvases = NULL;
-static Ecore_Timer *_e_canvas_cache_flush_timer = NULL;
+static Ecore_Poller *_e_canvas_cache_flush_poller = NULL;
 
 /* externally accessible functions */
 EAPI void
@@ -86,16 +86,17 @@ e_canvas_recache(void)
      }
    edje_file_cache_set(e_config->edje_cache);
    edje_collection_cache_set(e_config->edje_collection_cache);
-   if (_e_canvas_cache_flush_timer)
+   if (_e_canvas_cache_flush_poller)
      {
-       ecore_timer_del(_e_canvas_cache_flush_timer);
-       _e_canvas_cache_flush_timer = NULL;
+       ecore_poller_del(_e_canvas_cache_flush_poller);
+       _e_canvas_cache_flush_poller = NULL;
      }
-   if (e_config->cache_flush_interval > 0.0)
+   if (e_config->cache_flush_poll_interval > 0)
      {
-       _e_canvas_cache_flush_timer = 
-         ecore_timer_add(e_config->cache_flush_interval, _e_canvas_cb_flush,
-                         NULL);
+       _e_canvas_cache_flush_poller = 
+         ecore_poller_add(ECORE_POLLER_CORE,
+                          e_config->cache_flush_poll_interval,
+                          _e_canvas_cb_flush, NULL);
      }
 }
 
@@ -116,6 +117,7 @@ e_canvas_cache_flush(void)
      }
    edje_file_cache_flush();
    edje_collection_cache_flush();
+   printf("...caches flushed.\n");
 }
 
 EAPI void
@@ -135,6 +137,22 @@ e_canvas_cache_reload(void)
 }
 
 EAPI void
+e_canvas_idle_flush(void)
+{
+   Evas_List *l;
+   
+   for (l = _e_canvases; l; l = l->next)
+     {
+       Ecore_Evas *ee;
+       Evas *e;
+       
+       ee = l->data;
+       e = ecore_evas_get(ee);
+       evas_render_idle_flush(e);
+     }
+}
+
+EAPI void
 e_canvas_rehint(void)
 {
    Evas_List *l;
index d285fcc..1b4b569 100644 (file)
@@ -12,6 +12,7 @@ EAPI int         e_canvas_engine_decide(int engine);
 EAPI void        e_canvas_recache(void);
 EAPI void        e_canvas_cache_flush(void);
 EAPI void        e_canvas_cache_reload(void);
+EAPI void        e_canvas_idle_flush(void);
 EAPI void        e_canvas_rehint(void);
 EAPI Ecore_Evas *e_canvas_new(int engine_hint, Ecore_X_Window win, int x, int y, int w, int h, int direct_resize, int override, Ecore_X_Window *win_ret, Ecore_X_Window *subwin_ret);
 
index 533861c..b0a2817 100644 (file)
 EAPI E_Config *e_config = NULL;
 
 /* local subsystem functions */
-static int  _e_config_save_cb(void *data);
+static void _e_config_save_cb(void *data);
 static void _e_config_free(void);
 static int  _e_config_cb_timer(void *data);
 static int  _e_config_eet_close_handle(Eet_File *ef, char *file);
 
 /* local subsystem globals */
 static int _e_config_save_block = 0;
-static Ecore_Timer *_e_config_save_timer = NULL;
+static E_Powersave_Deferred_Action *_e_config_save_defer = NULL;
 static char *_e_config_profile = NULL;
 
 static E_Config_DD *_e_config_edd = NULL;
@@ -81,6 +81,7 @@ e_config_init(void)
          }
        else
          _e_config_profile = strdup("default");
+       e_util_env_set("E_CONF_PROFILE", _e_config_profile);
      }
    else 
      _e_config_profile = strdup(_e_config_profile);
@@ -370,7 +371,6 @@ e_config_init(void)
    E_CONFIG_VAL(D, T, font_cache, INT); /**/
    E_CONFIG_VAL(D, T, edje_cache, INT); /**/
    E_CONFIG_VAL(D, T, edje_collection_cache, INT); /**/
-   E_CONFIG_VAL(D, T, cache_flush_interval, DOUBLE); /**/
    E_CONFIG_VAL(D, T, zone_desks_x_count, INT); /**/
    E_CONFIG_VAL(D, T, zone_desks_y_count, INT); /**/
    E_CONFIG_VAL(D, T, use_virtual_roots, INT); /* should not make this a config option (for now) */
@@ -449,7 +449,6 @@ e_config_init(void)
    E_CONFIG_VAL(D, T, kill_process, INT); /**/
    E_CONFIG_VAL(D, T, kill_timer_wait, DOUBLE); /**/
    E_CONFIG_VAL(D, T, ping_clients, INT); /**/
-   E_CONFIG_VAL(D, T, ping_clients_wait, DOUBLE); /**/
    E_CONFIG_VAL(D, T, transition_start, STR); /**/
    E_CONFIG_VAL(D, T, transition_desk, STR); /**/
    E_CONFIG_VAL(D, T, transition_change, STR); /**/
@@ -575,6 +574,9 @@ e_config_init(void)
    E_CONFIG_VAL(D, T, menu_favorites_show, INT);
    E_CONFIG_VAL(D, T, menu_apps_show, INT);
    
+   E_CONFIG_VAL(D, T, ping_clients_interval, INT);
+   E_CONFIG_VAL(D, T, cache_flush_poll_interval, INT);
+   
    e_config = e_config_domain_load("e", _e_config_edd);
    if (e_config)
      {
@@ -631,7 +633,6 @@ e_config_init(void)
    e_config->font_cache = 512;
    e_config->edje_cache = 32;
    e_config->edje_collection_cache = 64;
-   e_config->cache_flush_interval = 60.0;
    e_config->zone_desks_x_count = 4;
    e_config->zone_desks_y_count = 1;
    e_config->use_virtual_roots = 0;
@@ -689,7 +690,6 @@ e_config_init(void)
    e_config->kill_process = 1;
    e_config->kill_timer_wait = 10.0;
    e_config->ping_clients = 1;
-   e_config->ping_clients_wait = 10.0;
    e_config->transition_start = NULL;
    e_config->transition_desk = evas_stringshare_add("vswipe");
    e_config->transition_change = evas_stringshare_add("crossfade");
@@ -1477,6 +1477,11 @@ e_config_init(void)
    e_config->show_desktop_icons = 1;
    IFCFGEND;
 
+   IFCFG(0x0123);
+   e_config->ping_clients_interval = 128;
+   e_config->cache_flush_poll_interval = 512;
+   IFCFGEND;
+   
    e_config->config_version = E_CONFIG_FILE_VERSION;   
      
 #if 0 /* example of new config */
@@ -1497,7 +1502,7 @@ e_config_init(void)
    E_CONFIG_LIMIT(e_config->font_cache, 0, 32 * 1024);
    E_CONFIG_LIMIT(e_config->edje_cache, 0, 256);
    E_CONFIG_LIMIT(e_config->edje_collection_cache, 0, 512);
-   E_CONFIG_LIMIT(e_config->cache_flush_interval, 0.0, 600.0);
+   E_CONFIG_LIMIT(e_config->cache_flush_poll_interval, 8, 32768);
    E_CONFIG_LIMIT(e_config->zone_desks_x_count, 1, 64);
    E_CONFIG_LIMIT(e_config->zone_desks_y_count, 1, 64);
    E_CONFIG_LIMIT(e_config->show_desktop_icons, 0, 1);
@@ -1545,7 +1550,6 @@ e_config_init(void)
    E_CONFIG_LIMIT(e_config->kill_process, 0, 1);
    E_CONFIG_LIMIT(e_config->kill_timer_wait, 0.0, 120.0);
    E_CONFIG_LIMIT(e_config->ping_clients, 0, 1);
-   E_CONFIG_LIMIT(e_config->ping_clients_wait, 0.0, 120.0);
    E_CONFIG_LIMIT(e_config->move_info_follows, 0, 1);
    E_CONFIG_LIMIT(e_config->resize_info_follows, 0, 1);
    E_CONFIG_LIMIT(e_config->move_info_visible, 0, 1);
@@ -1609,6 +1613,8 @@ e_config_init(void)
 
    E_CONFIG_LIMIT(e_config->menu_favorites_show, 0, 1);
    E_CONFIG_LIMIT(e_config->menu_apps_show, 0, 1);
+
+   E_CONFIG_LIMIT(e_config->ping_clients_interval, 4, 1024);
    
    /* FIXME: disabled auto apply because it causes problems */
    e_config->cfgdlg_auto_apply = 0;
@@ -1649,10 +1655,10 @@ e_config_shutdown(void)
 EAPI int
 e_config_save(void)
 {
-   if (_e_config_save_timer)
+   if (_e_config_save_defer)
      {
-       ecore_timer_del(_e_config_save_timer);
-       _e_config_save_timer = NULL;
+       e_powersave_deferred_action_del(_e_config_save_defer);
+       _e_config_save_defer = NULL;
      }
    _e_config_save_cb(NULL);
    return e_config_domain_save("e", _e_config_edd, e_config);
@@ -1661,10 +1667,10 @@ e_config_save(void)
 EAPI void
 e_config_save_flush(void)
 {
-   if (_e_config_save_timer)
+   if (_e_config_save_defer)
      {
-       ecore_timer_del(_e_config_save_timer);
-       _e_config_save_timer = NULL;
+       e_powersave_deferred_action_del(_e_config_save_defer);
+       _e_config_save_defer = NULL;
        _e_config_save_cb(NULL);
      }
 }
@@ -1672,8 +1678,10 @@ e_config_save_flush(void)
 EAPI void
 e_config_save_queue(void)
 {
-   if (_e_config_save_timer) ecore_timer_del(_e_config_save_timer);
-   _e_config_save_timer = ecore_timer_add(0.25, _e_config_save_cb, NULL);
+   if (_e_config_save_defer)
+     e_powersave_deferred_action_del(_e_config_save_defer);
+   _e_config_save_defer = e_powersave_deferred_action_add(_e_config_save_cb,
+                                                         NULL);
 }
 
 EAPI char *
@@ -1687,6 +1695,7 @@ e_config_profile_set(char *prof)
 {
    E_FREE(_e_config_profile);
    _e_config_profile = strdup(prof);
+   e_util_env_set("E_CONF_PROFILE", _e_config_profile);
 }
 
 EAPI Evas_List *
@@ -1970,14 +1979,13 @@ e_config_binding_wheel_match(E_Config_Binding_Wheel *eb_in)
 }
 
 /* local subsystem functions */
-static int
+static void
 _e_config_save_cb(void *data)
 {
    e_config_profile_save();
    e_module_save_all();
    e_config_domain_save("e", _e_config_edd, e_config);
-   _e_config_save_timer = NULL;
-   return 0;
+   _e_config_save_defer = NULL;
 }
 
 static void
index 38aec9b..49de15b 100644 (file)
@@ -33,7 +33,7 @@ typedef struct _E_Event_Config_Icon_Theme   E_Event_Config_Icon_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 E_CONFIG_FILE_GENERATION 0x0122
+#define E_CONFIG_FILE_GENERATION 0x0123
 #define E_CONFIG_FILE_VERSION    ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION)
 
 #define E_EVAS_ENGINE_DEFAULT      0
@@ -74,7 +74,6 @@ struct _E_Config
    int         font_cache; // GUI
    int         edje_cache; // GUI
    int         edje_collection_cache; // GUI
-   double      cache_flush_interval; // GUI
    int         zone_desks_x_count; // GUI
    int         zone_desks_y_count; // GUI
    int         use_virtual_roots; // NO GUI - maybe remove?
@@ -154,7 +153,6 @@ struct _E_Config
    int         kill_process;
    double      kill_timer_wait;
    int         ping_clients;
-   double      ping_clients_wait;
    const char *transition_start; // GUI
    const char *transition_desk; // GUI
    const char *transition_change; // GUI
@@ -279,6 +277,9 @@ struct _E_Config
    int desk_auto_switch; // GUI;
 
    int thumb_nice;
+   
+   int ping_clients_interval;
+   int cache_flush_poll_interval; // GUI
 };
 
 struct _E_Config_Module
index 3749318..c10a947 100644 (file)
@@ -59,7 +59,7 @@ static pid_t _e_desklock_child_pid = -1;
 #endif
 static Ecore_Exe *_e_custom_desklock_exe = NULL;
 static Ecore_Event_Handler *_e_custom_desklock_exe_handler = NULL;
-static Ecore_Timer *_e_desklock_idle_timer = NULL;
+static Ecore_Poller *_e_desklock_idle_poller = NULL;
 static int _e_desklock_user_idle = 0;
 
 /***********************************************************************/
@@ -70,7 +70,7 @@ static int _e_desklock_cb_mouse_up(void *data, int type, void *event);
 static int _e_desklock_cb_mouse_wheel(void *data, int type, void *event);
 static int _e_desklock_cb_mouse_move(void *data, int type, void *event);
 static int _e_desklock_cb_custom_desklock_exit(void *data, int type, void *event);
-static int _e_desklock_cb_idle_timer(void *data);
+static int _e_desklock_cb_idle_poller(void *data);
 
 static void _e_desklock_passwd_update(void);
 static void _e_desklock_backspace(void);
@@ -93,9 +93,9 @@ EAPI int E_EVENT_DESKLOCK = 0;
 EAPI int
 e_desklock_init(void)
 {
-   /* A timer to tick every second, watching for an idle user */
-   _e_desklock_idle_timer = ecore_timer_add(1.0,
-                                           _e_desklock_cb_idle_timer, NULL);
+   /* A poller to tick every 256 ticks, watching for an idle user */
+   _e_desklock_idle_poller = ecore_poller_add(ECORE_POLLER_CORE, 256,
+                                             _e_desklock_cb_idle_poller, NULL);
      
    if (e_config->desklock_background)
      e_filereg_register(e_config->desklock_background);
@@ -841,7 +841,7 @@ _e_desklock_cb_custom_desklock_exit(void *data, int type, void *event)
 }
 
 static int 
-_e_desklock_cb_idle_timer(void *data)
+_e_desklock_cb_idle_poller(void *data)
 {
    if (e_config->desklock_autolock_idle)
      {
@@ -870,6 +870,6 @@ _e_desklock_cb_idle_timer(void *data)
          _e_desklock_user_idle = 0;
      }
 
-   /* Make sure our timer persists. */
+   /* Make sure our poller persists. */
    return 1;
 }
index 3731665..2f04ec9 100644 (file)
@@ -3,8 +3,6 @@
  */
 #include "e.h"
 
-/* currently default bind is alt+` buf alt+space has been suggested */
-
 /* local subsystem functions */
 typedef struct _E_Exehist E_Exehist;
 typedef struct _E_Exehist_Item E_Exehist_Item;
@@ -27,13 +25,14 @@ static void _e_exehist_load(void);
 static void _e_exehist_clear(void);
 static void _e_exehist_unload(void);
 static void _e_exehist_limit(void);
-static int _e_exehist_cb_unload(void *data);
+static void _e_exehist_cb_unload(void *data);
 
 /* local subsystem globals */
 static E_Config_DD *_e_exehist_config_edd = NULL;
 static E_Config_DD *_e_exehist_config_item_edd = NULL;
 static E_Exehist *_e_exehist = NULL;
-static Ecore_Timer *_e_exehist_unload_timer = NULL;
+static E_Powersave_Deferred_Action *_e_exehist_unload_defer = NULL;
+static int _e_exehist_changes = 0;
 
 /* externally accessible functions */
 EAPI int
@@ -61,7 +60,12 @@ e_exehist_init(void)
 EAPI int
 e_exehist_shutdown(void)
 {
-   _e_exehist_unload();
+   if (_e_exehist_unload_defer)
+     {
+       e_powersave_deferred_action_del(_e_exehist_unload_defer);
+       _e_exehist_unload_defer = NULL;
+     }
+   _e_exehist_cb_unload(NULL);
    E_CONFIG_DD_FREE(_e_exehist_config_item_edd);
    E_CONFIG_DD_FREE(_e_exehist_config_edd);
    return 1;
@@ -85,7 +89,7 @@ e_exehist_add(const char *launch_method, const char *exe)
    ei->exetime = ecore_time_get();
    _e_exehist->history = evas_list_append(_e_exehist->history, ei);
    _e_exehist_limit();
-   e_config_domain_save("exehist", _e_exehist_config_edd, _e_exehist);
+   _e_exehist_changes++;
    _e_exehist_unload_queue();
 }
 
@@ -95,7 +99,7 @@ e_exehist_clear(void)
    _e_exehist_load();
    if (!_e_exehist) return;
    _e_exehist_clear();
-   e_config_domain_save("exehist", _e_exehist_config_edd, _e_exehist);
+   _e_exehist_changes++;
    _e_exehist_unload_queue();
 }
 
@@ -114,6 +118,7 @@ e_exehist_popularity_get(const char *exe)
        ei = l->data;
        if ((ei->exe) && (!strcmp(exe, ei->exe))) count++;
      }
+   _e_exehist_unload_queue();
    return count;
 }
 
@@ -129,8 +134,13 @@ e_exehist_newest_run_get(const char *exe)
        E_Exehist_Item *ei;
        
        ei = l->data;
-       if ((ei->exe) && (!strcmp(exe, ei->exe))) return ei->exetime;
+       if ((ei->exe) && (!strcmp(exe, ei->exe)))
+         {
+            _e_exehist_unload_queue();
+         }
+            return ei->exetime;
      }
+   _e_exehist_unload_queue();
    return 0.0;
 }
 
@@ -169,6 +179,7 @@ e_exehist_list_get(void)
          }
        if (count > max) break;
      }
+   _e_exehist_unload_queue();
    return list;
 }
 
@@ -200,6 +211,7 @@ e_exehist_mime_desktop_add(const char *mime, Efreet_Desktop *desktop)
             if (ei->launch_method) evas_stringshare_del(ei->launch_method);
             free(ei);
             _e_exehist->mimes = evas_list_remove_list(_e_exehist->mimes, l);
+            _e_exehist_changes++;
             break;
          }
      }
@@ -214,7 +226,7 @@ e_exehist_mime_desktop_add(const char *mime, Efreet_Desktop *desktop)
    ei->exetime = ecore_time_get();
    _e_exehist->mimes = evas_list_append(_e_exehist->mimes, ei);
    _e_exehist_limit();
-   e_config_domain_save("exehist", _e_exehist_config_edd, _e_exehist);
+   _e_exehist_changes++;
    _e_exehist_unload_queue();
 }
 
@@ -250,8 +262,10 @@ e_exehist_mime_desktop_get(const char *mime)
 static void
 _e_exehist_unload_queue(void)
 {
-   if (_e_exehist_unload_timer) ecore_timer_del(_e_exehist_unload_timer);
-   _e_exehist_unload_timer = ecore_timer_add(2.0, _e_exehist_cb_unload, NULL);
+   if (_e_exehist_unload_defer)
+     e_powersave_deferred_action_del(_e_exehist_unload_defer);
+   _e_exehist_unload_defer = 
+     e_powersave_deferred_action_add(_e_exehist_cb_unload, NULL);
 }
 
 static void
@@ -331,10 +345,14 @@ _e_exehist_limit(void)
      }
 }
 
-static int
+static void
 _e_exehist_cb_unload(void *data)
 {
+   if (_e_exehist_changes)
+     {
+       e_config_domain_save("exehist", _e_exehist_config_edd, _e_exehist);
+       _e_exehist_changes = 0;
+     }
    _e_exehist_unload();
-   _e_exehist_unload_timer = NULL;
-   return 0;
+   _e_exehist_unload_defer = NULL;
 }
index 19f988f..27f6f06 100644 (file)
@@ -12,9 +12,9 @@ static Evas_Bool _e_fm2_custom_file_hash_foreach_save(Evas_Hash *hash, const cha
 static void _e_fm2_custom_file_info_load(void);
 static void _e_fm2_custom_file_info_save(void);
 static void _e_fm2_custom_file_info_free(void);
-static int _e_fm2_custom_file_cb_timer_save(void *data);
+static void _e_fm2_custom_file_cb_defer_save(void *data);
 
-static Ecore_Timer *_e_fm2_flush_timer = NULL;
+static E_Powersave_Deferred_Action*_e_fm2_flush_defer = NULL;
 static Eet_File *_e_fm2_custom_file = NULL;
 static Eet_Data_Descriptor *_e_fm2_custom_file_edd = NULL;
 static Evas_Hash *_e_fm2_custom_hash = NULL;
@@ -75,8 +75,8 @@ e_fm2_custom_file_shutdown(void)
 {
    _e_fm2_custom_file_info_save();
    _e_fm2_custom_file_info_free();
-   if (_e_fm2_flush_timer) ecore_timer_del(_e_fm2_flush_timer);
-   _e_fm2_flush_timer = NULL;
+   if (_e_fm2_flush_defer) e_powersave_deferred_action_del(_e_fm2_flush_defer);
+   _e_fm2_flush_defer = NULL;
    eet_data_descriptor_free(_e_fm2_custom_file_edd);
    _e_fm2_custom_file_edd = NULL;
 }
@@ -88,7 +88,7 @@ e_fm2_custom_file_get(const char *path)
    
    _e_fm2_custom_file_info_load();
    if (!_e_fm2_custom_file) return NULL;
-   if (_e_fm2_flush_timer) e_fm2_custom_file_flush();
+   if (_e_fm2_flush_defer) e_fm2_custom_file_flush();
    cf = evas_hash_find(_e_fm2_custom_hash, path);
    return cf;
 }
@@ -98,7 +98,7 @@ e_fm2_custom_file_set(const char *path, E_Fm2_Custom_File *cf)
 {
    _e_fm2_custom_file_info_load();
    if (!_e_fm2_custom_file) return;
-   if (_e_fm2_flush_timer) e_fm2_custom_file_flush();
+   if (_e_fm2_flush_defer) e_fm2_custom_file_flush();
    if (evas_hash_find(_e_fm2_custom_hash, path) != cf)
      {
        E_Fm2_Custom_File *cf2;
@@ -125,7 +125,7 @@ e_fm2_custom_file_del(const char *path)
        
    _e_fm2_custom_file_info_load();
    if (!_e_fm2_custom_file) return;
-   if (_e_fm2_flush_timer) e_fm2_custom_file_flush();
+   if (_e_fm2_flush_defer) e_fm2_custom_file_flush();
    
    list = _e_fm2_custom_hash_key_base_list(_e_fm2_custom_hash, path);
    if (list)
@@ -155,7 +155,7 @@ e_fm2_custom_file_rename(const char *path, const char *new_path)
 
    _e_fm2_custom_file_info_load();
    if (!_e_fm2_custom_file) return;
-   if (_e_fm2_flush_timer) e_fm2_custom_file_flush();
+   if (_e_fm2_flush_defer) e_fm2_custom_file_flush();
    cf2 = evas_hash_find(_e_fm2_custom_hash, path);
    if (cf2)
      {
@@ -203,8 +203,11 @@ EAPI void
 e_fm2_custom_file_flush(void)
 {
    if (!_e_fm2_custom_file) return;
-   if (_e_fm2_flush_timer) ecore_timer_del(_e_fm2_flush_timer);
-   _e_fm2_flush_timer = ecore_timer_add(1.0, _e_fm2_custom_file_cb_timer_save, NULL);
+   
+   if (_e_fm2_flush_defer)
+     e_powersave_deferred_action_del(_e_fm2_flush_defer);
+   _e_fm2_flush_defer = 
+     e_powersave_deferred_action_add(_e_fm2_custom_file_cb_defer_save, NULL);
 }
 
 /**/
@@ -372,11 +375,10 @@ _e_fm2_custom_file_info_free(void)
      }
 }
 
-static int
-_e_fm2_custom_file_cb_timer_save(void *data)
+static void
+_e_fm2_custom_file_cb_defer_save(void *data)
 {
    _e_fm2_custom_file_info_save();
    _e_fm2_custom_file_info_free();
-   _e_fm2_flush_timer = NULL;
-   return 0;
+   _e_fm2_flush_defer = NULL;
 }
index 22b3317..060012b 100644 (file)
@@ -280,7 +280,7 @@ _e_dbus_cb_dev_all(void *user_data, void *reply_data, DBusError *error)
    ecore_list_first_goto(ret->strings);
    while ((device = ecore_list_next(ret->strings)))
      {
-//     printf("DB INIT DEV+: %s\n", device);
+       printf("DB INIT DEV+: %s\n", device);
        char *udi;
 
        udi = device;
@@ -308,7 +308,7 @@ _e_dbus_cb_dev_store(void *user_data, void *reply_data, DBusError *error)
    ecore_list_first_goto(ret->strings);
    while ((device = ecore_list_next(ret->strings)))
      {
-//     printf("DB STORE+: %s\n", device);
+       printf("DB STORE+: %s\n", device);
        e_storage_add(device);
      }
 }
@@ -330,7 +330,7 @@ _e_dbus_cb_dev_vol(void *user_data, void *reply_data, DBusError *error)
    ecore_list_first_goto(ret->strings);
    while ((device = ecore_list_next(ret->strings)))
      {
-//     printf("DB VOL+: %s\n", device);
+       printf("DB VOL+: %s\n", device);
        e_volume_add(device);
      }
 }
@@ -349,7 +349,7 @@ _e_dbus_cb_store_is(void *user_data, void *reply_data, DBusError *error)
    
    if (ret && ret->boolean)
      {
-//     printf("DB STORE IS+: %s\n", udi);
+       printf("DB STORE IS+: %s\n", udi);
        e_storage_add(udi);
      }
    
@@ -362,7 +362,7 @@ _e_dbus_cb_vol_is(void *user_data, void *reply_data, DBusError *error)
 {
    char *udi = user_data;
    E_Hal_Device_Query_Capability_Return *ret = reply_data;
-   
+
    if (dbus_error_is_set(error))
      {
        dbus_error_free(error);
@@ -371,7 +371,7 @@ _e_dbus_cb_vol_is(void *user_data, void *reply_data, DBusError *error)
    
    if (ret && ret->boolean)
      {
-//     printf("DB VOL IS+: %s\n", udi);
+       printf("DB VOL IS+: %s\n", udi);
        e_volume_add(udi);
      }
    
@@ -389,7 +389,7 @@ _e_dbus_cb_dev_add(void *data, DBusMessage *msg)
    dbus_error_init(&err);
    dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &udi, DBUS_TYPE_INVALID);
    udi = strdup(udi);
-//   printf("DB DEV+: %s\n", udi);
+   printf("DB DEV+: %s\n", udi);
    ret = e_hal_device_query_capability(_e_dbus_conn, udi, "storage", 
                                       _e_dbus_cb_store_is, strdup(udi));
    e_hal_device_query_capability(_e_dbus_conn, udi, "volume",
@@ -407,7 +407,7 @@ _e_dbus_cb_dev_del(void *data, DBusMessage *msg)
    dbus_message_get_args(msg, 
                         &err, DBUS_TYPE_STRING, 
                         &udi, DBUS_TYPE_INVALID);
-//   printf("DB DEV-: %s\n", udi);
+   printf("DB DEV-: %s\n", udi);
    e_storage_del(udi);
    e_volume_del(udi);
 }
@@ -426,7 +426,7 @@ _e_dbus_cb_cap_add(void *data, DBusMessage *msg)
                         &capability, DBUS_TYPE_INVALID);
    if (!strcmp(capability, "storage"))
      {
-//        printf("DB STORE CAP+: %s\n", udi);
+        printf("DB STORE CAP+: %s\n", udi);
        e_storage_add(udi);
      }
 }
@@ -1485,6 +1485,7 @@ _e_file_add_mod(E_Dir *ed, const char *path, int op, int listing)
      }
 //   printf("MOD %s %3.3f\n", path, ecore_time_get());
    lnk = ecore_file_readlink(path);
+   memset(&st, 0, sizeof(struct stat));
    if (stat(path, &st) == -1)
      {
        if ((path[0] == 0) || (lnk)) broken_lnk = 1;
@@ -1848,6 +1849,7 @@ _e_cb_fop_cp_idler(void *data)
    char buf[PATH_MAX], buf2[PATH_MAX], *lnk;
    
    fop = (E_Fop *)data;
+   memset(&st, 0, sizeof(struct stat));
    if (!fop->data)
      {
        fd = calloc(1, sizeof(struct Fop_Data));
index ee985db..8289d26 100644 (file)
@@ -453,7 +453,8 @@ e_gadcon_populate_class(E_Gadcon *gc, const E_Gadcon_Client_Class *cc)
 
        cf_gcc = l->data;
        if ((cf_gcc->name) && (cc->name) && 
-           (!strcmp(cf_gcc->name, cc->name)))
+           (!strcmp(cf_gcc->name, cc->name)) &&
+           (cf_gcc->id) && (cf_gcc->style))
          {
             E_Gadcon_Client *gcc;
 
index f73350c..175f86c 100644 (file)
 #include "e_msgbus.h"
 #include "e_toolbar.h"
 #include "e_int_toolbar_config.h"
+#include "e_powersave.h"
index 10c8fb2..2683657 100644 (file)
@@ -12,6 +12,7 @@ struct _Main_Data
    E_Menu *all_apps;
    E_Menu *desktops;
    E_Menu *clients;
+   E_Menu *enlightenment;
    E_Menu *config;
    E_Menu *lost_clients;
    E_Menu *sys;
@@ -162,6 +163,7 @@ e_int_menus_main_new(void)
    if (l) _e_int_menus_augmentation_add(m, l);
 
    subm = e_menu_new();
+   dat->enlightenment = subm;
    mi = e_menu_item_new(m);
    e_menu_item_label_set(mi, _("Enlightenment"));
    e_util_menu_item_edje_icon_set(mi, "enlightenment/e");
@@ -415,6 +417,7 @@ _e_int_menus_main_del_hook(void *obj)
        if (dat->all_apps) e_object_del(E_OBJECT(dat->all_apps));
        e_object_del(E_OBJECT(dat->desktops));
        e_object_del(E_OBJECT(dat->clients));
+       e_object_del(E_OBJECT(dat->enlightenment));
        e_object_del(E_OBJECT(dat->config));
        if (dat->lost_clients) e_object_del(E_OBJECT(dat->lost_clients));
        e_object_del(E_OBJECT(dat->sys));
@@ -473,6 +476,8 @@ _e_int_menus_main_lock_defer_cb(void *data)
 static void
 _e_int_menus_main_lock(void *data, E_Menu *m, E_Menu_Item *mi)
 {
+   /* this is correct - should be after other idle enteres have run - i.e.
+    * after e_menu's idler_enterer has been run */
    ecore_idle_enterer_add(_e_int_menus_main_lock_defer_cb, m->zone);
 }
 
index 4ed8f1e..5ad5862 100644 (file)
@@ -2080,47 +2080,6 @@ break;
 #undef HDL
 
 /****************************************************************************/
-#define HDL E_IPC_OP_CACHE_FLUSH_INTERVAL_SET
-#if (TYPE == E_REMOTE_OPTIONS)
-   OP("-cache-flush-interval-set", 1, "Set the cache flush interval (sec) (0.0 = off)", 0, HDL)
-#elif (TYPE == E_REMOTE_OUT)
-   REQ_DOUBLE(atof(params[0]), HDL);
-#elif (TYPE == E_WM_IN)
-   START_DOUBLE(dbl, HDL);
-   e_config->cache_flush_interval = dbl;
-   E_CONFIG_LIMIT(e_config->cache_flush_interval, 0.0, 600.0);
-   e_canvas_recache();
-   SAVE;
-   END_DOUBLE;
-#elif (TYPE == E_REMOTE_IN)
-#endif
-#undef HDL
-
-/****************************************************************************/
-#define HDL E_IPC_OP_CACHE_FLUSH_INTERVAL_GET
-#if (TYPE == E_REMOTE_OPTIONS)
-   OP("-cache-flush-interval-get", 0, "Get the interval between cache flushed (sec)", 1, HDL)
-#elif (TYPE == E_REMOTE_OUT)
-   REQ_NULL(HDL);
-#elif (TYPE == E_WM_IN)
-   SEND_DOUBLE(e_config->cache_flush_interval, E_IPC_OP_CACHE_FLUSH_INTERVAL_GET_REPLY, HDL);
-#elif (TYPE == E_REMOTE_IN)
-#endif
-#undef HDL
-
-/****************************************************************************/
-#define HDL E_IPC_OP_CACHE_FLUSH_INTERVAL_GET_REPLY
-#if (TYPE == E_REMOTE_OPTIONS)
-#elif (TYPE == E_REMOTE_OUT)
-#elif (TYPE == E_WM_IN)
-#elif (TYPE == E_REMOTE_IN)
-   START_DOUBLE(fint, HDL);
-   printf("REPLY: %3.3f\n", fint);
-   END_DOUBLE;
-#endif
-#undef HDL
-
-/****************************************************************************/
 #define HDL E_IPC_OP_MENUS_FAST_MOVE_THRESHOLD_SET
 #if (TYPE == E_REMOTE_OPTIONS)
    OP("-menus-fast-move-threshold-set", 1, "Set the mouse speed (pixels/second) that is considered a 'fast move'", 0, HDL)
@@ -4560,46 +4519,6 @@ break;
 #undef HDL
 
 /****************************************************************************/
-#define HDL E_IPC_OP_PING_CLIENTS_WAIT_SET
-#if (TYPE == E_REMOTE_OPTIONS)
-   OP("-ping-clients-wait-set", 1, "Set client ping interval (0.0-120.0)", 0, HDL)
-#elif (TYPE == E_REMOTE_OUT)
-   REQ_DOUBLE(atof(params[0]), HDL);
-#elif (TYPE == E_WM_IN)
-   START_DOUBLE(val, HDL);
-   e_config->ping_clients_wait = val;
-   E_CONFIG_LIMIT(e_config->ping_clients_wait, 0.0, 120.0);
-   SAVE;
-   END_DOUBLE;
-#elif (TYPE == E_REMOTE_IN)
-#endif
-#undef HDL
-
-/****************************************************************************/
-#define HDL E_IPC_OP_PING_CLIENTS_WAIT_GET
-#if (TYPE == E_REMOTE_OPTIONS)
-   OP("-ping-clients-wait-get", 0, "Get client ping interval", 1, HDL)
-#elif (TYPE == E_REMOTE_OUT)
-   REQ_NULL(HDL);
-#elif (TYPE == E_WM_IN)
-   SEND_DOUBLE(e_config->ping_clients_wait, E_IPC_OP_PING_CLIENTS_WAIT_GET_REPLY, HDL);
-#elif (TYPE == E_REMOTE_IN)
-#endif
-#undef HDL
-
-/****************************************************************************/
-#define HDL E_IPC_OP_PING_CLIENTS_WAIT_GET_REPLY
-#if (TYPE == E_REMOTE_OPTIONS)
-#elif (TYPE == E_REMOTE_OUT)
-#elif (TYPE == E_WM_IN)
-#elif (TYPE == E_REMOTE_IN)
-   START_DOUBLE(val, HDL);
-   printf("REPLY: %3.3f\n", val);
-   END_DOUBLE;
-#endif
-#undef HDL
-
-/****************************************************************************/
 #define HDL E_IPC_OP_TRANSITION_START_SET
 #if (TYPE == E_REMOTE_OPTIONS)
    OP("-transition-start-set", 1, "Get the background transition used when E starts", 0, HDL)
index 550f531..2467d50 100644 (file)
@@ -357,7 +357,7 @@ main(int argc, char **argv)
      }
 
    /* an idle enterer to be called before all others */
-   _e_main_idle_enterer_before = ecore_idle_enterer_add(_e_main_cb_idler_before, NULL);
+   _e_main_idle_enterer_before = ecore_idle_enterer_before_add(_e_main_cb_idler_before, NULL);
    
    TS("x connect");
    /* init x */
@@ -862,8 +862,17 @@ main(int argc, char **argv)
      }
    _e_main_shutdown_push(e_order_shutdown);
 
+   e_init_status_set(_("Set Up Powersave modes"));
+   TS("powersave");
+   if (!e_powersave_init())
+     {
+       e_error_message_show(_("Enlightenment cannot set up its powersave modes."));
+       _e_main_shutdown(-1);
+     }
+   _e_main_shutdown_push(e_powersave_shutdown);
+
    TS("add idle enterers");
-   /* add in a handler that just before we go idle we flush x */
+   /* add in a handler that just before we go idle we flush x - will happen after ecore_evas's idle rendering as it's after ecore_evas_init() */
    _e_main_idle_enterer_flusher = ecore_idle_enterer_add(_e_main_cb_x_flusher, NULL);
       
    e_managers_keys_grab();
@@ -926,6 +935,8 @@ main(int argc, char **argv)
    starting = 0;
    /* start our main loop */
    ecore_main_loop_begin();
+
+   e_canvas_idle_flush();
    stopping = 1;
    
    /* ask all modules to save their config and then shutdown */
index 5d504ce..5c0cae4 100644 (file)
@@ -82,7 +82,7 @@ static int  _e_menu_cb_mouse_down                 (void *data, int type, void *e
 static int  _e_menu_cb_mouse_up                   (void *data, int type, void *event);
 static int  _e_menu_cb_mouse_move                 (void *data, int type, void *event);
 static int  _e_menu_cb_mouse_wheel                (void *data, int type, void *event);
-static int  _e_menu_cb_scroll_timer               (void *data);
+static int  _e_menu_cb_scroll_animator            (void *data);
 static int  _e_menu_cb_window_shape               (void *data, int ev_type, void *ev);
 
 static void _e_menu_cb_item_submenu_post_default  (void *data, E_Menu *m, E_Menu_Item *mi);
@@ -98,7 +98,7 @@ static Ecore_X_Time         _e_menu_activate_time       = 0;
 static int                  _e_menu_activate_floating   = 0;
 static int                  _e_menu_activate_maybe_drag = 0;
 static int                  _e_menu_activate_dragging   = 0;
-static Ecore_Timer         *_e_menu_scroll_timer        = NULL;
+static Ecore_Animator      *_e_menu_scroll_animator     = NULL;
 static double               _e_menu_scroll_start        = 0.0;
 static int                  _e_menu_x                   = 0;
 static int                  _e_menu_y                   = 0;
@@ -2394,9 +2394,9 @@ _e_menu_mouse_autoscroll_check(void)
    _e_menu_autoscroll_x = autoscroll_x;
    _e_menu_autoscroll_y = autoscroll_y;
    if ((!autoscroll_x) && (!autoscroll_y)) return;
-   if (_e_menu_scroll_timer) return;
-   _e_menu_scroll_timer = ecore_timer_add(1.0 / 60.0, 
-                                         _e_menu_cb_scroll_timer, NULL);
+   if (_e_menu_scroll_animator) return;
+   _e_menu_scroll_animator = ecore_animator_add(_e_menu_cb_scroll_animator,
+                                               NULL);
    _e_menu_scroll_start = ecore_time_get();
 }
 
@@ -2786,7 +2786,7 @@ _e_menu_cb_mouse_wheel(void *data, int type, void *event)
 }
 
 static int
-_e_menu_cb_scroll_timer(void *data)
+_e_menu_cb_scroll_animator(void *data)
 {
    double t, dt;
    double dx, dy;
@@ -2829,7 +2829,7 @@ _e_menu_cb_scroll_timer(void *data)
    _e_menu_mouse_autoscroll_check();
    if ((_e_menu_autoscroll_x == 0) && (_e_menu_autoscroll_y == 0))
      {
-       _e_menu_scroll_timer = NULL;
+       _e_menu_scroll_animator = NULL;
        return 0;
      }
    return 1;
index d01657f..b2e18fe 100644 (file)
@@ -442,7 +442,7 @@ e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w
    if ((*ry + h) > zone->h) *ry = zone->h - h;
    if (*ry < 0) *ry = 0;
 
-   printf("0 - PLACE %i %i | %ix%i\n", *rx, *ry, w, h);
+//   printf("0 - PLACE %i %i | %ix%i\n", *rx, *ry, w, h);
 
    *rx += zone->x;
    *ry += zone->y;
index 48d7c8d..6e48f75 100644 (file)
@@ -33,7 +33,8 @@ static int _e_pointer_cb_mouse_up(void *data, int type, void *event);
 static int _e_pointer_cb_mouse_move(void *data, int type, void *event);
 static int _e_pointer_cb_mouse_wheel(void *data, int type, void *event);
 static int _e_pointer_cb_idle_timer_pre(void *data);
-static int _e_pointer_cb_idle_timer(void *data);
+static int _e_pointer_cb_idle_timer_wait(void *data);
+static int _e_pointer_cb_idle_poller(void *data);
 
 /* externally accessible functions */
 EAPI int
@@ -331,6 +332,7 @@ _e_pointer_free(E_Pointer *p)
    if (p->type) evas_stringshare_del(p->type);
    
    if (p->idle_timer) ecore_timer_del(p->idle_timer);
+   if (p->idle_poller) ecore_poller_del(p->idle_poller);
    
    free(p);
 }
@@ -477,6 +479,11 @@ _e_pointer_active_handle(E_Pointer *p)
    /* we got some mouse event - if there was an idle timer emit an active
     * signal as we WERE idle, NOW we are active */
    if (p->idle_timer) ecore_timer_del(p->idle_timer);
+   if (p->idle_poller)
+     {
+       ecore_poller_del(p->idle_poller);
+       p->idle_poller = NULL;
+     }
    if (p->idle)
      {
        if (p->pointer_object)
@@ -569,12 +576,25 @@ _e_pointer_cb_idle_timer_pre(void *data)
    ecore_x_pointer_xy_get(p->win, &x, &y);
    p->x = x;
    p->y = y;
-   p->idle_timer = ecore_timer_add(4.0, _e_pointer_cb_idle_timer, p);
+   p->idle_timer = ecore_timer_add(4.0, _e_pointer_cb_idle_timer_wait, p);
+   return 0;
+}
+
+static int
+_e_pointer_cb_idle_timer_wait(void *data)
+{
+   E_Pointer *p;
+
+   p = data;
+   if (!p->idle_poller)
+     p->idle_poller = ecore_poller_add(ECORE_POLLER_CORE, 64,
+                                      _e_pointer_cb_idle_poller, p);
+   p->idle_timer = NULL;
    return 0;
 }
 
 static int
-_e_pointer_cb_idle_timer(void *data)
+_e_pointer_cb_idle_poller(void *data)
 {
    E_Pointer *p;
    int x, y;
@@ -595,6 +615,7 @@ _e_pointer_cb_idle_timer(void *data)
               edje_object_signal_emit(p->pointer_object, "e,state,mouse,active", "e");
             p->idle = 0;
          }
+       /* use poller to check from now on */
        return 1;
      }
    /* we are idle - report it if not idle before */
@@ -604,6 +625,5 @@ _e_pointer_cb_idle_timer(void *data)
          edje_object_signal_emit(p->pointer_object, "e,state,mouse,idle", "e");
        p->idle = 1;
      }
-   /* and check again in 4 seconds */
    return 1;
 }
index 5a71d67..8d500df 100644 (file)
@@ -26,6 +26,7 @@ struct _E_Pointer
    Ecore_X_Window    win;
    int               w, h;
    Ecore_Timer      *idle_timer;
+   Ecore_Poller     *idle_poller;
    int               x, y;
 
    const char       *type;
index 26c9556..c1dc343 100644 (file)
@@ -61,7 +61,7 @@ e_popup_new(E_Zone *zone, int x, int y, int w, int h)
                                  pop->zone->x + pop->x, pop->zone->y + pop->y, pop->w, pop->h, 1, 1,
                                  &(pop->evas_win), NULL);
    /* avoid excess exposes when shaped - set damage avoid to 1 */
-   ecore_evas_avoid_damage_set(pop->ecore_evas, 1);
+//   ecore_evas_avoid_damage_set(pop->ecore_evas, 1);
    
    e_canvas_add(pop->ecore_evas);
    pop->shape = e_container_shape_add(pop->zone->container);
diff --git a/src/bin/e_powersave.c b/src/bin/e_powersave.c
new file mode 100644 (file)
index 0000000..4d5d725
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#include "e.h"
+
+struct _E_Powersave_Deferred_Action
+{
+   void (*func) (void *data);
+   const void *data;
+   unsigned char delete_me : 1;
+};
+
+/* local subsystem functions */
+static int _e_powersave_cb_deferred_timer(void *data);
+static void _e_powersave_mode_eval(void);
+
+/* local subsystem globals */
+static int walking_deferred_actions = 0;
+static Evas_List *deferred_actions = NULL;
+static Ecore_Timer *deferred_timer = NULL;
+static E_Powersave_Mode powersave_mode_min = E_POWERSAVE_MODE_NONE;
+static E_Powersave_Mode powersave_mode_max = E_POWERSAVE_MODE_EXTREME;
+static E_Powersave_Mode powersave_mode = E_POWERSAVE_MODE_LOW;
+static double defer_time = 5.0;
+
+/* externally accessible functions */
+EAPI int
+e_powersave_init(void)
+{
+   _e_powersave_mode_eval();
+   return 1;
+}
+
+EAPI int
+e_powersave_shutdown(void)
+{
+   return 1;
+}
+
+EAPI E_Powersave_Deferred_Action *
+e_powersave_deferred_action_add(void (*func) (void *data), const void *data)
+{
+   E_Powersave_Deferred_Action *pa;
+   
+   pa = calloc(1, sizeof(E_Powersave_Deferred_Action));
+   if (!pa) return NULL;
+   if (deferred_timer) ecore_timer_del(deferred_timer);
+   deferred_timer = ecore_timer_add(defer_time,
+                                   _e_powersave_cb_deferred_timer,
+                                   NULL);
+   pa->func = func;
+   pa->data = data;
+   deferred_actions = evas_list_append(deferred_actions, pa);
+   return pa;
+}
+
+EAPI void
+e_powersave_deferred_action_del(E_Powersave_Deferred_Action *pa)
+{
+   if (walking_deferred_actions)
+     {
+       pa->delete_me = 1;
+       return;
+     }
+   else
+     {
+       deferred_actions = evas_list_remove(deferred_actions, pa);
+       free(pa);
+       if (!deferred_actions)
+         {
+            if (deferred_timer)
+              {
+                 ecore_timer_del(deferred_timer);
+                 deferred_timer = NULL;
+              }
+         }
+     }
+}
+
+EAPI void
+e_powersave_mode_min_set(E_Powersave_Mode mode)
+{
+   powersave_mode_min = mode;
+   e_powersave_mode_set(powersave_mode);
+}
+
+EAPI void
+e_powersave_mode_max_set(E_Powersave_Mode mode)
+{
+   powersave_mode_max = mode;
+   e_powersave_mode_set(powersave_mode);
+}
+
+EAPI void
+e_powersave_mode_set(E_Powersave_Mode mode)
+{
+   if (mode < powersave_mode_min) mode = powersave_mode_min;
+   else if (mode > powersave_mode_max) mode = powersave_mode_max;
+   powersave_mode = mode;
+   _e_powersave_mode_eval();
+}
+
+EAPI E_Powersave_Mode
+e_powersave_mode_min_get(void)
+{
+   return powersave_mode_min;
+}
+
+EAPI E_Powersave_Mode
+e_powersave_mode_max_get(void)
+{
+   return powersave_mode_max;
+}
+
+EAPI E_Powersave_Mode
+e_powersave_mode_get(void)
+{
+   return powersave_mode;
+}
+
+/* local subsystem functions */
+
+static int
+_e_powersave_cb_deferred_timer(void *data)
+{
+   walking_deferred_actions++;
+   while (deferred_actions)
+     {
+       E_Powersave_Deferred_Action *pa;
+       
+       pa = deferred_actions->data;
+       deferred_actions = evas_list_remove_list(deferred_actions, deferred_actions);
+       if (!pa->delete_me) pa->func((void *)pa->data);
+       free(pa);
+     }
+   walking_deferred_actions--;
+   if (!deferred_actions) deferred_timer = NULL;
+   return 0;
+}
+
+static void
+_e_powersave_mode_eval(void)
+{
+   double t = 0.0;
+   
+   switch (powersave_mode)
+     {
+       /* FIXME: these values are hardcoded - shoudl be configurable */
+      case E_POWERSAVE_MODE_NONE:
+       t = 0.25; /* time to defer "power expensive" activities */
+       break;
+      case E_POWERSAVE_MODE_LOW:
+       t = 5.0;
+       break;
+      case E_POWERSAVE_MODE_MEDIUM:
+       t = 60.0;
+       break;
+      case E_POWERSAVE_MODE_HIGH:
+       t = 300.0;
+       break;
+      case E_POWERSAVE_MODE_EXTREME:
+       t = 1200.0;
+       break;
+      default:
+       return;
+       break;
+     }
+   if (t != defer_time)
+     {
+       if (deferred_timer) ecore_timer_del(deferred_timer);
+       deferred_timer = ecore_timer_add(defer_time,
+                                        _e_powersave_cb_deferred_timer,
+                                        NULL);
+     }
+}
diff --git a/src/bin/e_powersave.h b/src/bin/e_powersave.h
new file mode 100644 (file)
index 0000000..1c2c86b
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#ifdef E_TYPEDEFS
+
+typedef enum _E_Powersave_Mode
+{
+   E_POWERSAVE_MODE_NONE,
+   E_POWERSAVE_MODE_LOW,
+   E_POWERSAVE_MODE_MEDIUM,
+   E_POWERSAVE_MODE_HIGH,
+   E_POWERSAVE_MODE_EXTREME
+} E_Powersave_Mode;
+
+typedef struct _E_Powersave_Deferred_Action E_Powersave_Deferred_Action;
+
+#else
+#ifndef E_POWERSAVE_H
+#define E_POWERSAVE_H
+
+EAPI int e_powersave_init(void);
+EAPI int e_powersave_shutdown(void);
+
+EAPI E_Powersave_Deferred_Action *e_powersave_deferred_action_add(void (*func) (void *data), const void *data);
+EAPI void                         e_powersave_deferred_action_del(E_Powersave_Deferred_Action *pa);
+EAPI void                         e_powersave_mode_min_set(E_Powersave_Mode mode);
+EAPI void                         e_powersave_mode_max_set(E_Powersave_Mode mode);
+EAPI void                         e_powersave_mode_set(E_Powersave_Mode mode);
+EAPI E_Powersave_Mode             e_powersave_mode_min_get(void);
+EAPI E_Powersave_Mode             e_powersave_mode_max_get(void);
+EAPI E_Powersave_Mode             e_powersave_mode_get(void);
+
+/* FIXME: in the powersave system add things like pre-loading entire files
+ * int memory for pre-caching to avoid disk spinup, when in an appropriate
+ * powersave mode */
+
+/* FIXME: in powersave mode also add the ability to reduce framerate when
+ * at a particular powersave mode */
+
+/* FIXME: in powersave mode also add the ability to change screenblanker
+ * preferences when in powersave mode as well as check in the screensaver
+ * has kicked in */
+
+/* FIXME: in powersave mode also if screenblanker has kicked in be able to
+ * auto-suspend etc. etc. */
+
+#endif
+#endif
index b4f4469..71cfb17 100644 (file)
@@ -947,7 +947,7 @@ e_util_defer_object_del(E_Object *obj)
    if (stopping)
      e_object_del(obj);
    else
-     ecore_idle_enterer_add(_e_util_cb_delayed_del, obj);
+     ecore_idle_enterer_before_add(_e_util_cb_delayed_del, obj);
 }
 
 EAPI const char *
index 34d1639..a276a4b 100644 (file)
@@ -4,7 +4,7 @@
 struct _E_Config_Dialog_Data
 {
    int show_alert;   
-   double poll_time;   
+   int poll_interval;
    int alarm_time;
    int alarm_percent;
 };
@@ -48,7 +48,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
    if (!battery_config) return;
    cfdata->alarm_time = battery_config->alarm;
    cfdata->alarm_percent = battery_config->alarm_p;
-   cfdata->poll_time = battery_config->poll_time;
+   cfdata->poll_interval = battery_config->poll_interval;
    if (cfdata->alarm_time > 0 || cfdata->alarm_percent > 0) 
      cfdata->show_alert = 1;
    else 
@@ -117,7 +117,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
    ob = e_widget_label_add(evas, _("Check battery every:"));
    e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 0, 1, 0);
    
-   ob = e_widget_slider_add(evas, 1, 0, _("%1.1f seconds"), 0.5, 900.0, 0.5, 0, &(cfdata->poll_time), NULL, 200);
+   ob = e_widget_slider_add(evas, 1, 0, _("%1.0f ticks"), 1, 1024, 4, 0, NULL, &(cfdata->poll_interval), 200);
    e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 0, 1, 0);
    
    ob = e_widget_check_add(evas, _("Show alert when battery is low"), &(cfdata->show_alert));
@@ -140,7 +140,7 @@ static int
 _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) 
 {
    if (!battery_config) return 0;
-   battery_config->poll_time = cfdata->poll_time;
+   battery_config->poll_interval = cfdata->poll_interval;
    if (cfdata->show_alert)
    { 
      battery_config->alarm = cfdata->alarm_time;
index c2f0752..d344d05 100644 (file)
@@ -352,7 +352,7 @@ _battery_cb_check(void *data)
             /* Error reading status */
             if (battery_config->battery_prev_battery != -2)
               edje_object_signal_emit(inst->o_battery, "e,state,unknown", "e");
-            edje_object_part_text_set(inst->o_battery, "e.text.reading", _("NO INFO"));
+            edje_object_part_text_set(inst->o_battery, "e.text.reading", _("ERROR"));
             edje_object_part_text_set(inst->o_battery, "e.text.time", "--:--");
             _battery_face_level_set(inst, (double)(rand() & 0xff) / 255.0);
             battery_config->battery_prev_battery = -2;
@@ -388,10 +388,16 @@ _battery_linux_acpi_check(void)
    int level_unknown = 0;
    int hours, minutes;
    Status *stat;
+   static double last_poll_time = 0.0;
+   double poll_time, t;
 
    stat = E_NEW(Status, 1);
    if (!stat) return NULL;
 
+   t = ecore_time_get();
+   poll_time = t - last_poll_time;
+   last_poll_time = t;
+   
    /* Read some information on first run. */
    bats = ecore_file_ls("/proc/acpi/battery");
    if (bats)
@@ -505,11 +511,11 @@ _battery_linux_acpi_check(void)
      }
    
    if ((rate_unknown) && (bat_level != battery_config->battery_prev_level) &&
-       (battery_config->battery_prev_level >= 0))
+       (battery_config->battery_prev_level >= 0) && (poll_time > 0.0))
      {
        bat_drain = 
          ((bat_level - battery_config->battery_prev_level) * 60 * 60) /
-         battery_config->poll_time;
+         poll_time;
        if (bat_drain < 0) bat_drain = -bat_drain;
        if (bat_drain == 0) bat_drain = 1;
        rate_unknown = 0;
@@ -547,7 +553,7 @@ _battery_linux_acpi_check(void)
      {
        stat->has_battery = 0;
        stat->state = BATTERY_STATE_NONE;
-       stat->reading = strdup(_("NO BAT"));
+       stat->reading = strdup(_("N/A"));
        stat->time = strdup("--:--");
        stat->level = 1.0;
      }
@@ -637,7 +643,7 @@ _battery_linux_apm_check(void)
      {
        stat->has_battery = 0;
        stat->state = BATTERY_STATE_NONE;
-       stat->reading = strdup("NO BAT");
+       stat->reading = strdup("N/A");
        stat->time = strdup("--:--");
        stat->level = 1.0;
        return stat;
@@ -864,7 +870,7 @@ _battery_linux_powerbook_check(void)
      {
        stat->has_battery = 0;
        stat->state = BATTERY_STATE_NONE;
-       stat->reading = strdup(_("NO BAT"));
+       stat->reading = strdup(_("N/A"));
        stat->time = strdup("--:--");
        stat->level = 1.0;
      }
@@ -1020,7 +1026,7 @@ _battery_bsd_acpi_check(void)
      {
        stat->has_battery = 0;
        stat->state = BATTERY_STATE_NONE;
-       stat->reading = strdup(_("NO BAT"));
+       stat->reading = strdup(_("N/A"));
        stat->time = strdup("--:--");
        stat->level = 1.0;
      }
@@ -1113,7 +1119,7 @@ _battery_bsd_apm_check(void)
      {
        stat->has_battery = 0;
        stat->state = BATTERY_STATE_NONE;
-       stat->reading = strdup("NO BAT");
+       stat->reading = strdup("N/A");
        stat->time = strdup("--:--");
        stat->level = 1.0;
        return stat;
@@ -1251,7 +1257,7 @@ _battery_darwin_check(void)
        CFRelease(sources);
        CFRelease(blob);
        stat->state = BATTERY_STATE_NONE;
-       stat->reading = strdup("NO BAT");
+       stat->reading = strdup("N/A");
        stat->time = strdup("--:--");
        stat->level = 1.0;
        return stat;
@@ -1392,9 +1398,10 @@ void
 _battery_config_updated(void)
 {
    if (!battery_config) return;
-   ecore_timer_del(battery_config->battery_check_timer);
-   battery_config->battery_check_timer = ecore_timer_add(battery_config->poll_time,
-                                                _battery_cb_check, NULL);
+   ecore_poller_del(battery_config->battery_check_poller);
+   battery_config->battery_check_poller = 
+     ecore_poller_add(ECORE_POLLER_CORE, battery_config->poll_interval,
+                     _battery_cb_check, NULL);
    _battery_cb_check(NULL);
 }
 
@@ -1417,7 +1424,7 @@ e_modapi_init(E_Module *m)
 #undef D
 #define T Config
 #define D conf_edd
-   E_CONFIG_VAL(D, T, poll_time, DOUBLE);
+   E_CONFIG_VAL(D, T, poll_interval, INT);
    E_CONFIG_VAL(D, T, alarm, INT);
    E_CONFIG_VAL(D, T, alarm_p, INT);
 
@@ -1425,11 +1432,11 @@ e_modapi_init(E_Module *m)
    if (!battery_config)
      {
        battery_config = E_NEW(Config, 1);
-       battery_config->poll_time = 30.0;
+       battery_config->poll_interval = 256;
        battery_config->alarm = 30;
        battery_config->alarm_p = 10;
      }
-   E_CONFIG_LIMIT(battery_config->poll_time, 0.5, 1000.0);
+   E_CONFIG_LIMIT(battery_config->poll_interval, 1, 1024);
    E_CONFIG_LIMIT(battery_config->alarm, 0, 60);
    E_CONFIG_LIMIT(battery_config->alarm_p, 0, 100);
    
@@ -1437,8 +1444,9 @@ e_modapi_init(E_Module *m)
    battery_config->battery_prev_drain = 1;
    battery_config->battery_prev_ac = -1;
    battery_config->battery_prev_battery = -1;
-   battery_config->battery_check_timer = ecore_timer_add(battery_config->poll_time,
-                                                _battery_cb_check, NULL);
+   battery_config->battery_check_poller = 
+     ecore_poller_add(ECORE_POLLER_CORE, battery_config->poll_interval,
+                     _battery_cb_check, NULL);
    battery_config->module = m;
    
    e_gadcon_provider_register(&_gadcon_class);
@@ -1460,8 +1468,8 @@ e_modapi_shutdown(E_Module *m)
    
    if (battery_config->config_dialog)
      e_object_del(E_OBJECT(battery_config->config_dialog));
-   if (battery_config->battery_check_timer)
-     ecore_timer_del(battery_config->battery_check_timer);
+   if (battery_config->battery_check_poller)
+     ecore_poller_del(battery_config->battery_check_poller);
    if (battery_config->menu)
      {
         e_menu_post_deactivate_callback_set(battery_config->menu, NULL, NULL);
index c53d822..d233781 100644 (file)
@@ -15,7 +15,7 @@ typedef struct _Status       Status;
 struct _Config
 {
    /* saved * loaded config values */
-   double           poll_time;
+   int              poll_interval;
    int              alarm;     /* Alarm on minutes remaining */
    int             alarm_p;    /* Alarm on percentage remaining */
    /* just config state */
@@ -25,7 +25,7 @@ struct _Config
    E_Menu          *menu;
    int              alarm_triggered;
    int              battery_check_mode;
-   Ecore_Timer     *battery_check_timer;
+   Ecore_Poller    *battery_check_poller;
    int              battery_prev_drain;
    int              battery_prev_ac;
    int              battery_prev_battery;
index 3a8de7a..1c582ce 100644 (file)
@@ -12,7 +12,7 @@ struct _E_Config_Dialog_Data
    double framerate;
 
    /* Advanced */   
-   double cache_flush_interval;
+   int cache_flush_poll_interval;
    double font_cache;
    double image_cache;
    int edje_cache;
@@ -50,7 +50,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
    cfdata->image_cache = ((double)e_config->image_cache / 1024);
    cfdata->edje_cache = e_config->edje_cache;
    cfdata->edje_collection_cache = e_config->edje_collection_cache;
-   cfdata->cache_flush_interval = e_config->cache_flush_interval;
+   cfdata->cache_flush_poll_interval = e_config->cache_flush_poll_interval;
 }
 
 static void *
@@ -75,6 +75,7 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
    if (cfdata->framerate <= 0.0) cfdata->framerate = 1.0;
    e_config->framerate = cfdata->framerate;
    edje_frametime_set(1.0 / e_config->framerate);
+   e_canvas_recache();
    e_config_save_queue();
    return 1;
 }
@@ -101,12 +102,13 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
 {
    if (cfdata->framerate <= 0.0) cfdata->framerate = 1.0;
    e_config->framerate = cfdata->framerate;
-   e_config->cache_flush_interval = cfdata->cache_flush_interval;   
+   e_config->cache_flush_poll_interval = cfdata->cache_flush_poll_interval;   
    e_config->font_cache = (cfdata->font_cache * 1024);
    e_config->image_cache = (cfdata->image_cache * 1024);
    e_config->edje_cache = cfdata->edje_cache;
    e_config->edje_collection_cache = cfdata->edje_collection_cache;
    edje_frametime_set(1.0 / e_config->framerate);
+   e_canvas_recache();
    e_config_save_queue();
    return 1;
 }
@@ -121,14 +123,14 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
    of = e_widget_framelist_add(evas, _("General Settings"), 0);
    ob = e_widget_label_add(evas, _("Framerate"));
    e_widget_framelist_object_append(of, ob);   
-   ob = e_widget_slider_add(evas, 1, 0, _("%1.0f fps"), 5.0, 200.0, 5.0, 0, &(cfdata->framerate), NULL, 150);
+   ob = e_widget_slider_add(evas, 1, 0, _("%1.0f fps"), 5.0, 240.0, 1.0, 0, &(cfdata->framerate), NULL, 150);
    e_widget_framelist_object_append(of, ob);
    e_widget_list_object_append(o, of, 1, 1, 0.5);   
 
    of = e_widget_framelist_add(evas, _("Cache Settings"), 0);   
    ob = e_widget_label_add(evas, _("Cache Flush Interval"));
    e_widget_framelist_object_append(of, ob);   
-   ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"), 0.0, 600.0, 1.0, 0, &(cfdata->cache_flush_interval), NULL, 150);
+   ob = e_widget_slider_add(evas, 1, 0, _("%1.0f ticks"), 8, 4096, 8, 0, NULL, &(cfdata->cache_flush_poll_interval), 150);
    e_widget_framelist_object_append(of, ob);
 
    ob = e_widget_label_add(evas, _("Size Of Font Cache"));
index 80f0267..31b694e 100644 (file)
@@ -174,38 +174,38 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
        cpufreq_config->menu_poll = mn;
        
        mi = e_menu_item_new(mn);
-       e_menu_item_label_set(mi, _("Fast (0.5 sec)"));
+       e_menu_item_label_set(mi, _("Fast (4 ticks)"));
        e_menu_item_radio_set(mi, 1);
        e_menu_item_radio_group_set(mi, 1);
-       if (cpufreq_config->poll_time <= 0.5) e_menu_item_toggle_set(mi, 1);
+       if (cpufreq_config->poll_interval <= 4) e_menu_item_toggle_set(mi, 1);
        e_menu_item_callback_set(mi, _cpufreq_menu_fast, NULL);
 
        mi = e_menu_item_new(mn);
-       e_menu_item_label_set(mi, _("Medium (1 sec)"));
+       e_menu_item_label_set(mi, _("Medium (8 ticks)"));
        e_menu_item_radio_set(mi, 1);
        e_menu_item_radio_group_set(mi, 1);
-       if (cpufreq_config->poll_time > 0.5) e_menu_item_toggle_set(mi, 1);
+       if (cpufreq_config->poll_interval > 4) e_menu_item_toggle_set(mi, 1);
        e_menu_item_callback_set(mi, _cpufreq_menu_medium, NULL);
 
        mi = e_menu_item_new(mn);
-       e_menu_item_label_set(mi, _("Normal (2 sec)"));
+       e_menu_item_label_set(mi, _("Normal (32 ticks)"));
        e_menu_item_radio_set(mi, 1);
        e_menu_item_radio_group_set(mi, 1);
-       if (cpufreq_config->poll_time >= 2.0) e_menu_item_toggle_set(mi, 1);
+       if (cpufreq_config->poll_interval >= 32) e_menu_item_toggle_set(mi, 1);
        e_menu_item_callback_set(mi, _cpufreq_menu_normal, NULL);
 
        mi = e_menu_item_new(mn);
-       e_menu_item_label_set(mi, _("Slow (5 sec)"));
+       e_menu_item_label_set(mi, _("Slow (64 ticks)"));
        e_menu_item_radio_set(mi, 1);
        e_menu_item_radio_group_set(mi, 1);
-       if (cpufreq_config->poll_time >= 5.0) e_menu_item_toggle_set(mi, 1);
+       if (cpufreq_config->poll_interval >= 64) e_menu_item_toggle_set(mi, 1);
        e_menu_item_callback_set(mi, _cpufreq_menu_slow, NULL);
 
        mi = e_menu_item_new(mn);
-       e_menu_item_label_set(mi, _("Very Slow (30 sec)"));
+       e_menu_item_label_set(mi, _("Very Slow (256 ticks)"));
        e_menu_item_radio_set(mi, 1);
        e_menu_item_radio_group_set(mi, 1);
-       if (cpufreq_config->poll_time >= 30.0) e_menu_item_toggle_set(mi, 1);
+       if (cpufreq_config->poll_interval >= 128) e_menu_item_toggle_set(mi, 1);
        e_menu_item_callback_set(mi, _cpufreq_menu_very_slow, NULL);
 
        if (cpufreq_config->status->governors)
@@ -756,45 +756,55 @@ _cpufreq_face_cb_set_governor(void *data, Evas_Object *obj, const char *emission
 static void
 _cpufreq_menu_fast(void *data, E_Menu *m, E_Menu_Item *mi)
 {
-   cpufreq_config->poll_time = 0.5;
-   ecore_timer_del(cpufreq_config->frequency_check_timer);
-   cpufreq_config->frequency_check_timer = ecore_timer_add(cpufreq_config->poll_time, _cpufreq_cb_check, NULL);
+   cpufreq_config->poll_interval = 4;
+   ecore_poller_del(cpufreq_config->frequency_check_poller);
+   cpufreq_config->frequency_check_poller = 
+     ecore_poller_add(ECORE_POLLER_CORE, cpufreq_config->poll_interval,
+                     _cpufreq_cb_check, NULL);
    e_config_save_queue();
 }
 
 static void
 _cpufreq_menu_medium(void *data, E_Menu *m, E_Menu_Item *mi)
 {
-   cpufreq_config->poll_time = 1.0;
-   ecore_timer_del(cpufreq_config->frequency_check_timer);
-   cpufreq_config->frequency_check_timer = ecore_timer_add(cpufreq_config->poll_time, _cpufreq_cb_check, NULL);
+   cpufreq_config->poll_interval = 8;
+   ecore_poller_del(cpufreq_config->frequency_check_poller);
+   cpufreq_config->frequency_check_poller = 
+     ecore_poller_add(ECORE_POLLER_CORE, cpufreq_config->poll_interval,
+                     _cpufreq_cb_check, NULL);
    e_config_save_queue();
 }
 
 static void
 _cpufreq_menu_normal(void *data, E_Menu *m, E_Menu_Item *mi)
 {
-   cpufreq_config->poll_time = 2.0;
-   ecore_timer_del(cpufreq_config->frequency_check_timer);
-   cpufreq_config->frequency_check_timer = ecore_timer_add(cpufreq_config->poll_time, _cpufreq_cb_check, NULL);
+   cpufreq_config->poll_interval = 32;
+   ecore_poller_del(cpufreq_config->frequency_check_poller);
+   cpufreq_config->frequency_check_poller = 
+     ecore_poller_add(ECORE_POLLER_CORE, cpufreq_config->poll_interval,
+                     _cpufreq_cb_check, NULL);
    e_config_save_queue();
 }
 
 static void
 _cpufreq_menu_slow(void *data, E_Menu *m, E_Menu_Item *mi)
 {
-   cpufreq_config->poll_time = 5.0;
-   ecore_timer_del(cpufreq_config->frequency_check_timer);
-   cpufreq_config->frequency_check_timer = ecore_timer_add(cpufreq_config->poll_time, _cpufreq_cb_check, NULL);
+   cpufreq_config->poll_interval = 64;
+   ecore_poller_del(cpufreq_config->frequency_check_poller);
+   cpufreq_config->frequency_check_poller = 
+     ecore_poller_add(ECORE_POLLER_CORE, cpufreq_config->poll_interval,
+                     _cpufreq_cb_check, NULL);
    e_config_save_queue();
 }
 
 static void
 _cpufreq_menu_very_slow(void *data, E_Menu *m, E_Menu_Item *mi)
 {
-   cpufreq_config->poll_time = 30.0;
-   ecore_timer_del(cpufreq_config->frequency_check_timer);
-   cpufreq_config->frequency_check_timer = ecore_timer_add(cpufreq_config->poll_time, _cpufreq_cb_check, NULL);
+   cpufreq_config->poll_interval = 256;
+   ecore_poller_del(cpufreq_config->frequency_check_poller);
+   cpufreq_config->frequency_check_poller = 
+     ecore_poller_add(ECORE_POLLER_CORE, cpufreq_config->poll_interval,
+                     _cpufreq_cb_check, NULL);
    e_config_save_queue();
 }
 
@@ -855,7 +865,7 @@ e_modapi_init(E_Module *m)
 #undef D
 #define T Config
 #define D conf_edd
-   E_CONFIG_VAL(D, T, poll_time, DOUBLE);
+   E_CONFIG_VAL(D, T, poll_interval, INT);
    E_CONFIG_VAL(D, T, restore_governor, INT);
    E_CONFIG_VAL(D, T, governor, STR);
    
@@ -863,17 +873,19 @@ e_modapi_init(E_Module *m)
    if (!cpufreq_config)
      {
        cpufreq_config = E_NEW(Config, 1);
-       cpufreq_config->poll_time = 2.0;
+       cpufreq_config->poll_interval = 32;
        cpufreq_config->restore_governor = 0;
        cpufreq_config->governor = NULL;
      }
-   E_CONFIG_LIMIT(cpufreq_config->poll_time, 0.5, 60.0);
+   E_CONFIG_LIMIT(cpufreq_config->poll_interval, 1, 1024);
    
    snprintf(buf, sizeof(buf), "%s/%s/freqset",
            e_module_dir_get(m), MODULE_ARCH);
    cpufreq_config->set_exe_path = strdup(buf);
-   cpufreq_config->frequency_check_timer = ecore_timer_add(cpufreq_config->poll_time,
-                                                  _cpufreq_cb_check, NULL);
+   cpufreq_config->frequency_check_poller = 
+     ecore_poller_add(ECORE_POLLER_CORE,
+                    cpufreq_config->poll_interval,
+                    _cpufreq_cb_check, NULL);
    cpufreq_config->status = _cpufreq_status_new();
 
    _cpufreq_status_check_available(cpufreq_config->status);
@@ -901,8 +913,8 @@ e_modapi_shutdown(E_Module *m)
 {
    e_gadcon_provider_unregister(&_gadcon_class);
    
-   if (cpufreq_config->frequency_check_timer)
-     ecore_timer_del(cpufreq_config->frequency_check_timer);
+   if (cpufreq_config->frequency_check_poller)
+     ecore_poller_del(cpufreq_config->frequency_check_poller);
    if (cpufreq_config->menu)
      {
        e_menu_post_deactivate_callback_set(cpufreq_config->menu, NULL, NULL);
index 53a1ce5..ca66f2a 100644 (file)
@@ -17,19 +17,19 @@ struct _Status
 struct _Config
 {
    /* saved * loaded config values */
-   double       poll_time;
-   int          restore_governor;
-   const char  *governor;
+   int           poll_interval;
+   int           restore_governor;
+   const char   *governor;
    /* just config state */
-   E_Module    *module;
-   Evas_List   *instances;
-   E_Menu      *menu;
-   E_Menu      *menu_poll;
-   E_Menu      *menu_governor;
-   E_Menu      *menu_frequency;
-   Status      *status;
-   char        *set_exe_path;
-   Ecore_Timer *frequency_check_timer;
+   E_Module     *module;
+   Evas_List    *instances;
+   E_Menu       *menu;
+   E_Menu       *menu_poll;
+   E_Menu       *menu_governor;
+   E_Menu       *menu_frequency;
+   Status       *status;
+   char         *set_exe_path;
+   Ecore_Poller *frequency_check_poller;
 };
 
 EAPI extern E_Module_Api e_modapi;
index 60ee4de..f347114 100644 (file)
@@ -81,6 +81,7 @@ main(int argc, char *argv[])
 #endif
 
    seteuid(-1);
+   return -1;
 }
 
 static int
index 31d53a4..d5e0663 100644 (file)
@@ -14,7 +14,7 @@ struct _E_Config_Dialog_Data
        int height;
        int act_height;
      } popup;
-   int drag_resist, flip_desk;
+   int drag_resist, flip_desk, show_desk_names;
    struct 
      {
        unsigned int drag, noplace, desk;
@@ -89,6 +89,7 @@ _fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata)
    cfdata->popup.urgent_show = pager_config->popup_urgent;
    cfdata->popup.urgent_stick = pager_config->popup_urgent_stick;
    cfdata->popup.urgent_speed = pager_config->popup_urgent_speed;
+   cfdata->show_desk_names = pager_config->show_desk_names;
    cfdata->popup.height = pager_config->popup_height;
    cfdata->popup.act_height = pager_config->popup_act_height;
    cfdata->drag_resist = pager_config->drag_resist;
@@ -115,6 +116,9 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
    ow = e_widget_check_add(evas, _("Flip desktop on mouse wheel"), 
                           &(cfdata->flip_desk));
    e_widget_framelist_object_append(of, ow);
+   ow = e_widget_check_add(evas, _("Show desktop names"), 
+                          &(cfdata->show_desk_names));
+   e_widget_framelist_object_append(of, ow);
    e_widget_list_object_append(o, of, 1, 1, 0.5);
 
    of = e_widget_framelist_add(evas, _("Popup Settings"), 0);
@@ -134,7 +138,9 @@ _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
 {
    pager_config->popup = cfdata->popup.show;
    pager_config->flip_desk = cfdata->flip_desk;
+   pager_config->show_desk_names = cfdata->show_desk_names;
    pager_config->popup_urgent = cfdata->popup.urgent_show;
+   /* FIXME: update gui with desk names */
    e_config_save_queue();
    return 1;
 }
@@ -149,41 +155,44 @@ _adv_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
    ow = e_widget_check_add(evas, _("Flip desktop on mouse wheel"), 
                           &(cfdata->flip_desk));
    e_widget_frametable_object_append(of, ow, 0, 0, 2, 1, 1, 0, 1, 0);
+   ow = e_widget_check_add(evas, _("Show desktop names"), 
+                          &(cfdata->show_desk_names));
+   e_widget_frametable_object_append(of, ow, 0, 1, 2, 1, 1, 0, 1, 0);
 
    ow = e_widget_label_add(evas, _("Select and Slide button"));
-   e_widget_frametable_object_append(of, ow, 0, 1, 1, 1, 1, 0, 1, 0);
+   e_widget_frametable_object_append(of, ow, 0, 2, 1, 1, 1, 0, 1, 0);
    ow = e_widget_button_add(evas, _("Click to set"), NULL, 
                            _grab_wnd_show, (void *)BUTTON_DRAG, cfdata);
    cfdata->gui.o_btn1 = ow;
-   e_widget_frametable_object_append(of, ow, 1, 1, 1, 1, 0, 0, 1, 0);
+   e_widget_frametable_object_append(of, ow, 1, 2, 1, 1, 0, 0, 1, 0);
 
    ow = e_widget_label_add(evas, _("Drag and Drop button"));
-   e_widget_frametable_object_append(of, ow, 0, 2, 1, 1, 1, 0, 1, 0);
+   e_widget_frametable_object_append(of, ow, 0, 3, 1, 1, 1, 0, 1, 0);
    ow = e_widget_button_add(evas, _("Click to set"), NULL, 
                            _grab_wnd_show, (void *)BUTTON_NOPLACE, cfdata);
    cfdata->gui.o_btn2 = ow;
-   e_widget_frametable_object_append(of, ow, 1, 2, 1, 1, 0, 0, 1, 0);
+   e_widget_frametable_object_append(of, ow, 1, 3, 1, 1, 0, 0, 1, 0);
 
    ow = e_widget_label_add(evas, _("Drag whole desktop"));
-   e_widget_frametable_object_append(of, ow, 0, 3, 1, 1, 1, 0, 1, 0);
+   e_widget_frametable_object_append(of, ow, 0, 4, 1, 1, 1, 0, 1, 0);
    ow = e_widget_button_add(evas, _("Click to set"), NULL, 
                            _grab_wnd_show, (void *)BUTTON_DESK, cfdata);
    cfdata->gui.o_btn3 = ow;
-   e_widget_frametable_object_append(of, ow, 1, 3, 1, 1, 0, 0, 1, 0);
+   e_widget_frametable_object_append(of, ow, 1, 4, 1, 1, 0, 0, 1, 0);
    _adv_update_btn_lbl(cfdata);
    
    /* TODO find better name */                                                                         
    ow = e_widget_label_add(evas, _("Keyaction popup height"));                                       
-   e_widget_frametable_object_append(of, ow, 0, 4, 1, 1, 1, 0, 1, 0);                                
+   e_widget_frametable_object_append(of, ow, 0, 5, 1, 1, 1, 0, 1, 0);                                
    ow = e_widget_slider_add(evas, 1, 0, _("%.0f px"), 20.0, 200.0, 1.0, 0, NULL,                     
                           &(cfdata->popup.act_height), 100);                                         
-   e_widget_frametable_object_append(of, ow, 1, 4, 1, 1, 1, 0, 1, 0);  
+   e_widget_frametable_object_append(of, ow, 1, 5, 1, 1, 1, 0, 1, 0);  
 
    ow = e_widget_label_add(evas, _("Resistance to dragging"));
-   e_widget_frametable_object_append(of, ow, 0, 5, 1, 1, 1, 0, 1, 0);
+   e_widget_frametable_object_append(of, ow, 0, 6, 1, 1, 1, 0, 1, 0);
    ow = e_widget_slider_add(evas, 1, 0, _("%.0f px"), 0.0, 10.0, 1.0, 0, NULL, 
                            &(cfdata->drag_resist), 100);
-   e_widget_frametable_object_append(of, ow, 1, 5, 1, 1, 1, 0, 1, 0);
+   e_widget_frametable_object_append(of, ow, 1, 6, 1, 1, 1, 0, 1, 0);
    e_widget_list_object_append(o, of, 1, 1, 0.5);
 
    of = e_widget_frametable_add(evas, _("Popup Settings"), 0);
@@ -228,12 +237,14 @@ _adv_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
    pager_config->popup_urgent = cfdata->popup.urgent_show;
    pager_config->popup_urgent_stick = cfdata->popup.urgent_stick;
    pager_config->popup_urgent_speed = cfdata->popup.urgent_speed;
+   pager_config->show_desk_names = cfdata->show_desk_names;
    pager_config->popup_height = cfdata->popup.height;
    pager_config->popup_act_height = cfdata->popup.act_height;
    pager_config->drag_resist = cfdata->drag_resist;
    pager_config->btn_drag = cfdata->btn.drag;
    pager_config->btn_noplace = cfdata->btn.noplace;
    pager_config->btn_desk = cfdata->btn.desk;
+   /* FIXME: update gui with desk names */
    e_config_save_queue();
    return 1;
 }
index c79f27f..feadc80 100644 (file)
@@ -118,6 +118,8 @@ static int _pager_cb_event_border_desk_set(void *data, int type, void *event);
 static int _pager_cb_event_border_stack(void *data, int type, void *event);
 static int _pager_cb_event_border_icon_change(void *data, int type, void *event);
 static int _pager_cb_event_border_urgent_change(void *data, int type, void *event);
+static int _pager_cb_event_border_focus_in(void *data, int type, void *event);
+static int _pager_cb_event_border_focus_out(void *data, int type, void *event);
 static int _pager_cb_event_border_property(void *data, int type, void *event);
 static int _pager_cb_event_zone_desk_count_set(void *data, int type, void *event);
 static int _pager_cb_event_desk_show(void *data, int type, void *event);
@@ -364,7 +366,8 @@ _pager_desk_new(Pager *p, E_Desk *desk, int xpos, int ypos)
    pd->o_desk = o;
    e_theme_edje_object_set(o, "base/theme/modules/pager",
                           "e/modules/pager/desk");
-   edje_object_part_text_set(o, "label", desk->name);
+   if (pager_config->show_desk_names)
+     edje_object_part_text_set(o, "e.text.label", desk->name);
    e_table_pack(p->o_table, o, xpos, ypos, 1, 1);
    e_table_pack_options_set(o, 1, 1, 1, 1, 0.5, 0.5, 0, 0, -1, -1);
    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _pager_desk_cb_mouse_down, pd);
@@ -378,7 +381,7 @@ _pager_desk_new(Pager *p, E_Desk *desk, int xpos, int ypos)
    pd->o_layout = o;
 
    e_layout_virtual_size_set(o, desk->zone->w, desk->zone->h);
-   edje_object_part_swallow(pd->o_desk, "items", pd->o_layout);
+   edje_object_part_swallow(pd->o_desk, "e.swallow.content", pd->o_layout);
    evas_object_show(o);
 
    bl = e_container_border_list_first(desk->zone->container);
@@ -606,7 +609,7 @@ _pager_window_new(Pager_Desk *pd, E_Border *border)
      {
        pw->o_icon = o;
        evas_object_show(o);
-       edje_object_part_swallow(pw->o_window, "icon", o);
+       edje_object_part_swallow(pw->o_window, "e.swallow.icon", o);
      }
 
    if (border->client.icccm.urgent)
@@ -716,14 +719,14 @@ _pager_popup_new(E_Zone *zone, int keyaction)
    pp->o_bg = edje_object_add(pp->popup->evas);
    e_theme_edje_object_set(pp->o_bg,
                           "base/theme/modules/pager",
-                          "e/widgets/pager/popup");
+                          "e/modules/pager/popup");
    desk = e_desk_current_get(zone);
    if (desk)
-     edje_object_part_text_set(pp->o_bg, "text", desk->name);
+     edje_object_part_text_set(pp->o_bg, "e.text.label", desk->name);
    evas_object_show(pp->o_bg);
 
    edje_extern_object_min_size_set(pp->pager->o_table, width, height);
-   edje_object_part_swallow(pp->o_bg, "pager", pp->pager->o_table);
+   edje_object_part_swallow(pp->o_bg, "e.swallow.content", pp->pager->o_table);
    edje_object_size_min_calc(pp->o_bg, &w, &h);
 
    evas_object_move(pp->o_bg, 0, 0);
@@ -1327,7 +1330,7 @@ _pager_cb_event_border_icon_change(void *data, int type, void *event)
                    {
                       pw->o_icon = o;
                       evas_object_show(o);
-                      edje_object_part_swallow(pw->o_window, "icon", o);
+                      edje_object_part_swallow(pw->o_window, "e.swallow.icon", o);
                    }
               }
          }
@@ -1427,6 +1430,110 @@ _pager_cb_event_border_urgent_change(void *data, int type, void *event)
 }
 
 static int
+_pager_cb_event_border_focus_in(void *data, int type, void *event)
+{
+   E_Event_Border_Focus_In *ev;
+   Evas_List *l, *l2;
+   Pager_Popup *pp;
+   E_Zone *zone;
+
+   ev = event;
+   zone = ev->border->zone;
+
+   for (l = pager_config->instances; l; l = l->next)
+     {
+       Instance *inst;
+
+       inst = l->data;
+       if (inst->pager->zone != zone) continue;
+       for (l2 = inst->pager->desks; l2; l2 = l2->next)
+         {
+            Pager_Desk *pd;
+            Pager_Win *pw;
+
+            pd = l2->data;
+            pw = _pager_desk_window_find(pd, ev->border);
+            if (pw)
+              {
+                 edje_object_signal_emit(pw->o_window,
+                                         "e,state,focused", "e");
+                 break;
+              }
+         }
+     }
+
+   pp = _pager_popup_find(zone);
+   if (!pp) return;
+   for (l = pp->pager->desks; l; l = l->next)
+     {
+       Pager_Desk *pd;
+       Pager_Win *pw;
+       
+       pd = l->data;
+       pw = _pager_desk_window_find(pd, ev->border);
+       if (pw)
+         {
+            edje_object_signal_emit(pw->o_window,
+                                    "e,state,focused", "e");
+            break;
+         }
+     }
+   return 1;
+}
+
+static int
+_pager_cb_event_border_focus_out(void *data, int type, void *event)
+{
+   E_Event_Border_Focus_Out *ev;
+   Evas_List *l, *l2;
+   Pager_Popup *pp;
+   E_Zone *zone;
+
+   ev = event;
+   zone = ev->border->zone;
+
+   for (l = pager_config->instances; l; l = l->next)
+     {
+       Instance *inst;
+
+       inst = l->data;
+       if (inst->pager->zone != zone) continue;
+       for (l2 = inst->pager->desks; l2; l2 = l2->next)
+         {
+            Pager_Desk *pd;
+            Pager_Win *pw;
+
+            pd = l2->data;
+            pw = _pager_desk_window_find(pd, ev->border);
+            if (pw)
+              {
+                 edje_object_signal_emit(pw->o_window,
+                                         "e,state,unfocused", "e");
+                 break;
+              }
+         }
+     }
+
+   pp = _pager_popup_find(zone);
+   if (!pp) return;
+   for (l = pp->pager->desks; l; l = l->next)
+     {
+       Pager_Desk *pd;
+       Pager_Win *pw;
+       
+       pd = l->data;
+       pw = _pager_desk_window_find(pd, ev->border);
+       if (pw)
+         {
+            edje_object_signal_emit(pw->o_window,
+                                    "e,state,unfocused", "e");
+            break;
+         }
+     }
+   return 1;
+}
+
+static int
 _pager_cb_event_border_property(void *data, int type, void *event)
 {
    E_Event_Border_Property *ev;
@@ -1574,10 +1681,15 @@ _pager_cb_event_desk_show(void *data, int type, void *event)
                                         _pager_popup_cb_timeout, pp);
 
             pd = _pager_desk_find(pp->pager, ev->desk);
-
-            if (pd) _pager_desk_select(pd);
-
-            edje_object_part_text_set(pp->o_bg, "text", ev->desk->name);
+            if (pd)
+              {
+                 _pager_desk_select(pd);
+                 edje_object_part_text_set(pp->o_bg, "e.text.label",
+                                           ev->desk->name);
+              }
+            ecore_timer_del(pp->timer);
+            pp->timer = ecore_timer_add(pager_config->popup_speed,
+                                        _pager_popup_cb_timeout, pp);
          }
      }
    return 1;
@@ -1597,8 +1709,11 @@ _pager_cb_event_desk_name_change(void *data, int type, void *event)
        p = l->data;
        if (p->zone != ev->desk->zone) continue;
        pd = _pager_desk_find(p, ev->desk);
-       if (pd)
-         edje_object_part_text_set(pd->o_desk, "label", ev->desk->name);
+       if (pager_config->show_desk_names)
+         {
+            if (pd)
+              edje_object_part_text_set(pd->o_desk, "e.text.label", ev->desk->name);
+         }
      }
    return 1;
 }
@@ -1781,7 +1896,7 @@ _pager_window_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_i
             if (oo)
               {
                  evas_object_show(oo);
-                 edje_object_part_swallow(o, "icon", oo);
+                 edje_object_part_swallow(o, "e.swallow.icon", oo);
               }
 
             e_drag_object_set(drag, o);
@@ -2164,7 +2279,7 @@ _pager_desk_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf
        /* and redraw is content */
        oo = e_layout_add(drag->evas);
        e_layout_virtual_size_set(oo, pd->pager->zone->w, pd->pager->zone->h);
-       edje_object_part_swallow(o, "items", oo);
+       edje_object_part_swallow(o, "e.swallow.content", oo);
        evas_object_show(oo);
 
        for (l = pd->wins; l; l = l->next)
@@ -2188,7 +2303,7 @@ _pager_desk_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf
             if ((o_icon = e_border_icon_add(pw->border, drag->evas)))
               {
                  evas_object_show(o_icon);
-                 edje_object_part_swallow(o, "icon", o_icon);
+                 edje_object_part_swallow(o, "e.swallow.icon", o_icon);
               }
          }
        e_drag_resize(drag, w, h);
@@ -2600,6 +2715,7 @@ e_modapi_init(E_Module *m)
    E_CONFIG_VAL(D, T, popup_urgent, UINT);
    E_CONFIG_VAL(D, T, popup_urgent_stick, UINT);
    E_CONFIG_VAL(D, T, popup_urgent_speed, DOUBLE);
+   E_CONFIG_VAL(D, T, show_desk_names, UINT);
    E_CONFIG_VAL(D, T, popup_height, INT);
    E_CONFIG_VAL(D, T, popup_act_height, INT);
    E_CONFIG_VAL(D, T, drag_resist, UINT);
@@ -2618,6 +2734,7 @@ e_modapi_init(E_Module *m)
        pager_config->popup_urgent = 0;
        pager_config->popup_urgent_stick = 0;
        pager_config->popup_urgent_speed = 1.5;
+       pager_config->show_desk_names = 1;
        pager_config->popup_height = 60;
        pager_config->popup_act_height = 60;
        pager_config->drag_resist = 3;
@@ -2631,6 +2748,7 @@ e_modapi_init(E_Module *m)
    E_CONFIG_LIMIT(pager_config->popup_urgent, 0, 1);
    E_CONFIG_LIMIT(pager_config->popup_urgent_stick, 0, 1);
    E_CONFIG_LIMIT(pager_config->popup_urgent_speed, 0.1, 10.0);
+   E_CONFIG_LIMIT(pager_config->show_desk_names, 0, 1);
    E_CONFIG_LIMIT(pager_config->popup_height, 20, 200);
    E_CONFIG_LIMIT(pager_config->popup_act_height, 20, 200);
    E_CONFIG_LIMIT(pager_config->drag_resist, 0, 50);
@@ -2677,6 +2795,14 @@ e_modapi_init(E_Module *m)
       (E_EVENT_BORDER_URGENT_CHANGE, _pager_cb_event_border_urgent_change, NULL));
    pager_config->handlers = evas_list_append
      (pager_config->handlers, ecore_event_handler_add
+      (E_EVENT_BORDER_FOCUS_IN,
+       _pager_cb_event_border_focus_in, NULL));
+   pager_config->handlers = evas_list_append
+     (pager_config->handlers, ecore_event_handler_add
+      (E_EVENT_BORDER_FOCUS_OUT,
+       _pager_cb_event_border_focus_out, NULL));
+   pager_config->handlers = evas_list_append
+     (pager_config->handlers, ecore_event_handler_add
       (E_EVENT_BORDER_PROPERTY, _pager_cb_event_border_property, NULL));
    pager_config->handlers = evas_list_append
      (pager_config->handlers, ecore_event_handler_add
index 53fdaf1..40f0301 100644 (file)
@@ -26,6 +26,7 @@ struct _Config
    unsigned int    popup_urgent;
    unsigned int    popup_urgent_stick;
    double          popup_urgent_speed;
+   unsigned int    show_desk_names;
    int             popup_act_height; /*keyaction popup */
    int             popup_height;    /* urgent/on-deskswitch popup*/
    unsigned int    drag_resist;
index 9a01d90..5b375ec 100644 (file)
@@ -25,5 +25,17 @@ module_la_LIBADD       = @e_libs@ @dlopen_libs@ @ECORE_TXT_LIBS@
 module_la_LDFLAGS      = -module -avoid-version
 module_la_DEPENDENCIES = $(top_builddir)/config.h
 
+tempgetdir = $(pkgdir)
+tempget_DATA = \
+tempget$(EXEEXT)
+
+x_mode = a=rx,u+x
+install-data-hook:
+       @chmod $(x_mode) $(DESTDIR)$(tempgetdir)/tempget$(EXEEXT) || true
+
+noinst_PROGRAMS        = tempget
+tempget_SOURCES        = tempget.c
+tempget_LDFLAGS        = @e_libs@
+
 uninstall:
        rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
index 52204bf..a9aeca6 100644 (file)
@@ -18,7 +18,7 @@
 struct _E_Config_Dialog_Data
 {
    int poll_method;
-   double poll_time;
+   int poll_interval;
    
    int unit_method;
    Unit units;
@@ -70,6 +70,7 @@ static void
 _fill_data(E_Config_Dialog_Data *cfdata) 
 {
    double      p;
+   int         pi;
    Ecore_List *therms;
    char       *name;
    char        path[PATH_MAX];
@@ -80,16 +81,16 @@ _fill_data(E_Config_Dialog_Data *cfdata)
    else 
      cfdata->unit_method = 1;
    
-   p = cfdata->inst->poll_time;
-   cfdata->poll_time = p;
-   if ((p >= 0) && (p <= 5)) 
-     cfdata->poll_method = 1; /* Fast */
-   else if ((p > 5) && (p <= 10)) 
-     cfdata->poll_method = 10; /* Normal */
-   else if ((p > 10) && (p <= 30)) 
-     cfdata->poll_method = 30; /* Slow */
-   else if (p > 30
-     cfdata->poll_method = 60; /* Very Slow */
+   pi = cfdata->inst->poll_interval;
+   cfdata->poll_interval = pi;
+   if ((pi >= 1) && (pi <= 64)) 
+     cfdata->poll_method = 4; /* Fast */
+   else if ((pi > 64) && (pi <= 128)) 
+     cfdata->poll_method = 128; /* Normal */
+   else if ((pi > 128) && (pi <= 256)) 
+     cfdata->poll_method = 256; /* Slow */
+   else if (pi > 256
+     cfdata->poll_method = 512; /* Very Slow */
    
    p = cfdata->inst->low;
    if (cfdata->units == FAHRENHEIT)
@@ -219,13 +220,13 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
    
    of = e_widget_framelist_add(evas, _("Check Interval"), 0);
    rg = e_widget_radio_group_new(&(cfdata->poll_method));
-   ob = e_widget_radio_add(evas, _("Fast"), 1, rg);
+   ob = e_widget_radio_add(evas, _("Fast"), 4, rg);
    e_widget_framelist_object_append(of, ob);
-   ob = e_widget_radio_add(evas, _("Normal"), 10, rg);
+   ob = e_widget_radio_add(evas, _("Normal"), 128, rg);
    e_widget_framelist_object_append(of, ob);
-   ob = e_widget_radio_add(evas, _("Slow"), 30, rg);
+   ob = e_widget_radio_add(evas, _("Slow"), 256, rg);
    e_widget_framelist_object_append(of, ob);
-   ob = e_widget_radio_add(evas, _("Very Slow"), 60, rg);
+   ob = e_widget_radio_add(evas, _("Very Slow"), 512, rg);
    e_widget_framelist_object_append(of, ob);
    e_widget_list_object_append(o, of, 1, 1, 0.5);
 
@@ -289,7 +290,7 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
      cfdata->inst->units = CELCIUS;    
    else 
      cfdata->inst->units = FAHRENHEIT;
-   cfdata->inst->poll_time = (double)cfdata->poll_method;
+   cfdata->inst->poll_interval = cfdata->poll_method;
    if (cfdata->inst->units == FAHRENHEIT)
      {
        cfdata->inst->low = CEL_2_FAR(cfdata->low_method);
@@ -340,7 +341,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
      }
 
    of = e_widget_framelist_add(evas, _("Check Interval"), 0);
-   ob = e_widget_slider_add(evas, 1, 0, _("%1.1f seconds"), 0.5, 1000.0, 0.5, 0, &(cfdata->poll_time), NULL, 200);
+   ob = e_widget_slider_add(evas, 1, 0, _("%1.0f ticks"), 1, 1024, 4, 0, NULL, &(cfdata->poll_interval), 200);
    e_widget_framelist_object_append(of, ob);
    e_widget_list_object_append(o, of, 1, 1, 0.5);
 
@@ -403,7 +404,7 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
      cfdata->inst->units = CELCIUS;    
    else 
      cfdata->inst->units = FAHRENHEIT;
-   cfdata->inst->poll_time = cfdata->poll_time;
+   cfdata->inst->poll_interval = cfdata->poll_interval;
    cfdata->inst->low = cfdata->low_temp;
    cfdata->inst->high = cfdata->high_temp;
    if (cfdata->inst->sensor_name)
index 75dd2db..4b63fe6 100644 (file)
@@ -36,10 +36,10 @@ static const E_Gadcon_Client_Class _gadcon_class =
 /**/
 /* actual module specifics */
 
+static int _temperature_cb_exe_data(void *data, int type, void *event);
+static int _temperature_cb_exe_del(void *data, int type, void *event);
 static void _temperature_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
 static void _temperature_face_cb_post_menu(void *data, E_Menu *m);
-static void _temperature_sensor_init(Config_Face *inst);
-static int  _temperature_cb_check(void *data);
 static void _temperature_face_level_set(Config_Face *inst, double level);
 static void _temperature_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
 
@@ -59,23 +59,23 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
    Evas_Object *o;
    E_Gadcon_Client *gcc;
    Config_Face *inst;
+   char buf[PATH_MAX];
 
    inst = evas_hash_find(temperature_config->faces, id);
    if (!inst)
      {
        inst = E_NEW(Config_Face, 1);
        inst->id = evas_stringshare_add(id);
-       inst->poll_time = 10.0;
+       inst->poll_interval = 128;
        inst->low = 30;
        inst->high = 80;
        inst->sensor_type = SENSOR_TYPE_NONE;
        inst->sensor_name = NULL;
-       inst->sensor_path = NULL;
        inst->units = CELCIUS;
        temperature_config->faces = evas_hash_direct_add(temperature_config->faces, inst->id, inst);
      }
    if (!inst->id) evas_stringshare_add(id);
-   E_CONFIG_LIMIT(inst->poll_time, 0.5, 1000.0);
+   E_CONFIG_LIMIT(inst->poll_interval, 1, 1024);
    E_CONFIG_LIMIT(inst->low, 0, 100);
    E_CONFIG_LIMIT(inst->high, 0, 220);
    E_CONFIG_LIMIT(inst->units, CELCIUS, FAHRENHEIT);
@@ -91,14 +91,27 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
    inst->o_temp = o;
    inst->module = temperature_config->module;
    inst->have_temp = -1;
-   inst->temperature_check_timer = 
-     ecore_timer_add(inst->poll_time, _temperature_cb_check, inst);
+   snprintf(buf, sizeof(buf),
+           "%s/%s/tempget %i \"%s\" %i", 
+           e_module_dir_get(temperature_config->module), MODULE_ARCH, 
+           inst->sensor_type,
+           (inst->sensor_name != NULL ? inst->sensor_name : "(null)"),
+           inst->poll_interval);
+   inst->tempget_exe = ecore_exe_pipe_run(buf, 
+                                         ECORE_EXE_PIPE_READ | 
+                                         ECORE_EXE_PIPE_READ_LINE_BUFFERED,
+                                         inst);
+   inst->tempget_data_handler = 
+     ecore_event_handler_add(ECORE_EXE_EVENT_DATA,
+                            _temperature_cb_exe_data,
+                            inst);
+   inst->tempget_del_handler = 
+     ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
+                            _temperature_cb_exe_del,
+                            inst);
    
    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
                                  _temperature_face_cb_mouse_down, inst);
-   _temperature_sensor_init(inst);
-   _temperature_cb_check(inst);
    return gcc;
 }
 
@@ -108,8 +121,22 @@ _gc_shutdown(E_Gadcon_Client *gcc)
    Config_Face *inst;
    
    inst = gcc->data;
-   if (inst->temperature_check_timer) ecore_timer_del(inst->temperature_check_timer);
-   inst->temperature_check_timer = NULL;
+   if (inst->tempget_exe)
+     {
+       ecore_exe_terminate(inst->tempget_exe);
+       ecore_exe_free(inst->tempget_exe);
+       inst->tempget_exe = NULL;
+     }
+   if (inst->tempget_data_handler)
+     {
+       ecore_event_handler_del(inst->tempget_data_handler);
+       inst->tempget_data_handler = NULL;
+     }
+   if (inst->tempget_del_handler)
+     {
+       ecore_event_handler_del(inst->tempget_del_handler);
+       inst->tempget_del_handler = NULL;
+     }
    if (inst->o_temp) evas_object_del(inst->o_temp);
    inst->o_temp = NULL;
    if (inst->config_dialog) e_object_del(E_OBJECT(inst->config_dialog));
@@ -157,12 +184,11 @@ _gc_id_new(void)
 
    inst = E_NEW(Config_Face, 1);
    inst->id = evas_stringshare_add(id);
-   inst->poll_time = 10.0;
+   inst->poll_interval = 128;
    inst->low = 30;
    inst->high = 80;
    inst->sensor_type = SENSOR_TYPE_NONE;
    inst->sensor_name = NULL;
-   inst->sensor_path = NULL;
    inst->units = CELCIUS;
    temperature_config->faces = evas_hash_direct_add(temperature_config->faces, inst->id, inst);
    return inst->id;
@@ -178,7 +204,6 @@ _gc_id_del(const char *id)
      {
        temperature_config->faces = evas_hash_del(temperature_config->faces, id, inst);
        if (inst->sensor_name) evas_stringshare_del(inst->sensor_name);
-       if (inst->sensor_path) evas_stringshare_del(inst->sensor_path);
        free(inst);
      }
 }
@@ -188,6 +213,83 @@ _gc_id_del(const char *id)
 
 /***************************************************************************/
 /**/
+static int
+_temperature_cb_exe_data(void *data, int type, void *event)
+{    
+   Ecore_Exe_Event_Data *ev;
+   Config_Face *inst;
+   int temp;
+   
+   ev = event;
+   inst = data;
+   if (ev->exe != inst->tempget_exe) return 1;
+   temp = -999;
+   if ((ev->lines) && (ev->lines[0].line))
+     {
+       int i;
+       
+       for (i = 0; ev->lines[i].line; i++)
+         {
+            if (!strcmp(ev->lines[i].line, "ERROR"))
+              temp = -999;
+            else
+              temp = atoi(ev->lines[i].line);
+         }
+     }
+   if (temp != -999)
+     {
+       char *utf8;
+       char buf[256];
+
+       if (inst->units == FAHRENHEIT)
+         temp = (temp * 9.0 / 5.0) + 32;
+       
+       if (inst->have_temp != 1)
+         {
+            /* enable therm object */
+            edje_object_signal_emit(inst->o_temp, "e,state,known", "");
+            inst->have_temp = 1;
+         }
+
+       if (inst->units == FAHRENHEIT) 
+         snprintf(buf, sizeof(buf), "%i°F", temp);
+       else
+         snprintf(buf, sizeof(buf), "%i°C", temp);  
+       utf8 = ecore_txt_convert("iso-8859-1", "utf-8", buf);
+       
+        _temperature_face_level_set(inst,
+                                   (double)(temp - inst->low) /
+                                   (double)(inst->high - inst->low));
+       edje_object_part_text_set(inst->o_temp, "e.text.reading", utf8);
+       free(utf8);
+     }
+   else
+     {
+       if (inst->have_temp != 0)
+         {
+            /* disable therm object */
+            edje_object_signal_emit(inst->o_temp, "e,state,unknown", "");
+            edje_object_part_text_set(inst->o_temp, "e.text.reading", "N/A");
+            _temperature_face_level_set(inst, 0.5);
+            inst->have_temp = 0;
+         }
+     }
+   return 0;
+}
+
+static int
+_temperature_cb_exe_del(void *data, int type, void *event)
+{
+   Ecore_Exe_Event_Del *ev;
+   Config_Face *inst;
+   
+   ev = event;
+   inst = data;
+   if (ev->exe != inst->tempget_exe) return 1;
+   inst->tempget_exe = NULL;
+   return 0;
+}
+
 static void
 _temperature_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
 {
@@ -237,309 +339,6 @@ _temperature_face_cb_post_menu(void *data, E_Menu *m)
 }
 
 static void
-_temperature_sensor_init(Config_Face *inst)
-{
-   Ecore_List *therms;
-   char        path[PATH_MAX];
-#ifdef __FreeBSD__
-   int         len;
-#endif
-
-   if ((!inst->sensor_type) || (!inst->sensor_name))
-     {
-       if (inst->sensor_name) evas_stringshare_del(inst->sensor_name);
-       if (inst->sensor_path) evas_stringshare_del(inst->sensor_path);
-       inst->sensor_path = NULL;
-#ifdef __FreeBSD__
-       /* TODO: FreeBSD can also have more temperature sensors! */
-       inst->sensor_type = SENSOR_TYPE_FREEBSD;
-       inst->sensor_name = evas_stringshare_add("tz0");
-#else  
-       therms = ecore_file_ls("/proc/acpi/thermal_zone");
-       if ((therms) && (!ecore_list_empty_is(therms)))
-         {
-            char *name;
-
-            name = ecore_list_next(therms);
-            inst->sensor_type = SENSOR_TYPE_LINUX_ACPI;
-            inst->sensor_name = evas_stringshare_add(name);
-
-            ecore_list_destroy(therms);
-         }
-       else
-         {
-            if (therms) ecore_list_destroy(therms);
-
-            if (ecore_file_exists("/proc/omnibook/temperature"))
-              {
-                 inst->sensor_type = SENSOR_TYPE_OMNIBOOK;
-                 inst->sensor_name = evas_stringshare_add("dummy");
-              }
-            else if (ecore_file_exists("/sys/devices/temperatures/sensor1_temperature"))
-              {
-                 inst->sensor_type = SENSOR_TYPE_LINUX_PBOOK;
-                 inst->sensor_name = evas_stringshare_add("dummy");
-              }
-            else if (ecore_file_exists("/sys/devices/temperatures/cpu_temperature"))
-              {
-                 inst->sensor_type = SENSOR_TYPE_LINUX_MACMINI;
-                 inst->sensor_name = evas_stringshare_add("dummy");
-              }
-            else if (ecore_file_exists("/sys/devices/platform/coretemp.0/temp1_input"))
-              {
-                 inst->sensor_type = SENSOR_TYPE_LINUX_INTELCORETEMP;
-                 inst->sensor_name = evas_stringshare_add("dummy");
-              }
-            else
-              {
-                  therms = temperature_get_i2c_files();
-                 if (therms)
-                   {
-                      char *name;
-
-                      if ((name = ecore_list_next(therms)))
-                        {
-                           if (ecore_file_exists(name))
-                             {
-                                int len;
-
-                                sprintf(path, "%s", ecore_file_file_get(name));
-                                len = strlen(path);
-                                if (len > 6)
-                                  path[len - 6] = '\0';
-                                inst->sensor_type = SENSOR_TYPE_LINUX_I2C;
-                                inst->sensor_path = evas_stringshare_add(name);
-                                inst->sensor_name = evas_stringshare_add(path);
-                             }
-                        }
-                      ecore_list_destroy(therms);
-                   }
-              }
-         }
-#endif
-     }
-   if ((inst->sensor_type) &&
-       (inst->sensor_name) && 
-       (!inst->sensor_path))
-     {
-       switch (inst->sensor_type)
-         {
-          case SENSOR_TYPE_NONE:
-             break;
-          case SENSOR_TYPE_FREEBSD:
-#ifdef __FreeBSD__
-             snprintf(path, sizeof(path), "hw.acpi.thermal.%s.temperature",
-                      inst->sensor_name);
-             inst->sensor_path = evas_stringshare_add(path);
-
-             len = 5;
-             sysctlnametomib(inst->sensor_path, inst->mib, &len);
-#endif
-             break;
-          case SENSOR_TYPE_OMNIBOOK:
-             inst->sensor_path = evas_stringshare_add("/proc/omnibook/temperature");
-             break;
-          case SENSOR_TYPE_LINUX_MACMINI:
-                 inst->sensor_path = evas_stringshare_add("/sys/devices/temperatures/cpu_temperature");
-             break;
-          case SENSOR_TYPE_LINUX_PBOOK:
-                 inst->sensor_path = evas_stringshare_add("/sys/devices/temperatures/sensor1_temperature");
-             break;
-          case SENSOR_TYPE_LINUX_INTELCORETEMP:
-                 inst->sensor_path = evas_stringshare_add("/sys/devices/platform/coretemp.0/temp1_input");
-             break;
-          case SENSOR_TYPE_LINUX_I2C:
-             therms = ecore_file_ls("/sys/bus/i2c/devices");
-             if (therms)
-               {
-                  char *name;
-
-                  while ((name = ecore_list_next(therms)))
-                    {
-                       sprintf(path, "/sys/bus/i2c/devices/%s/%s_input",
-                             name, inst->sensor_name);
-                       if (ecore_file_exists(path))
-                         {
-                            inst->sensor_path = evas_stringshare_add(path);
-                            /* We really only care about the first one for the default. */
-                            break;
-                         }
-                    }
-                  ecore_list_destroy(therms);
-               }
-             break;
-          case SENSOR_TYPE_LINUX_ACPI:
-             snprintf(path, sizeof(path), "/proc/acpi/thermal_zone/%s/temperature",
-                      inst->sensor_name);
-             inst->sensor_path = evas_stringshare_add(path);
-             break;
-         }
-     }
-}
-
-static int
-_temperature_cb_check(void *data)
-{
-   FILE *f;
-   int ret = 0;
-   Config_Face *inst;
-   int temp = 0;
-   char buf[4096];
-#ifdef __FreeBSD__
-   int len;
-#endif
-
-   inst = data;
-
-   /* TODO: Make standard parser. Seems to be two types of temperature string:
-    * - Somename: <temp> C
-    * - <temp>
-    */
-   switch (inst->sensor_type)
-     {
-      case SENSOR_TYPE_NONE:
-        /* TODO: Slow down timer? */
-        break;
-      case SENSOR_TYPE_FREEBSD:
-#ifdef __FreeBSD__
-        len = sizeof(temp);
-        if (sysctl(inst->mib, 5, &temp, &len, NULL, 0) != -1)
-          {
-             temp = (temp - 2732) / 10;
-             ret = 1;
-          }
-        else
-          goto error;
-#endif
-        break;
-      case SENSOR_TYPE_OMNIBOOK:
-        f = fopen(inst->sensor_path, "r");
-        if (f) 
-          {
-             char dummy[4096];
-
-             fgets(buf, sizeof(buf), f); buf[sizeof(buf) - 1] = 0;
-             if (sscanf(buf, "%s %s %i", dummy, dummy, &temp) == 3)
-               ret = 1;
-             else
-               goto error;
-             fclose(f);
-          }
-        else
-          goto error;
-        break;
-      case SENSOR_TYPE_LINUX_MACMINI:
-      case SENSOR_TYPE_LINUX_PBOOK:
-        f = fopen(inst->sensor_path, "rb");
-        if (f)
-          {
-             fgets(buf, sizeof(buf), f); buf[sizeof(buf) - 1] = 0;
-             if (sscanf(buf, "%i", &temp) == 1)
-               ret = 1;
-             else
-               goto error;
-             fclose(f);
-          }
-        else
-          goto error;
-        break;
-      case SENSOR_TYPE_LINUX_INTELCORETEMP:
-      case SENSOR_TYPE_LINUX_I2C:
-        f = fopen(inst->sensor_path, "r");
-        if (f)
-          {
-             fgets(buf, sizeof(buf), f);
-             buf[sizeof(buf) - 1] = 0;
-
-             /* actuallty read the temp */
-             if (sscanf(buf, "%i", &temp) == 1)
-               ret = 1;
-             else
-               goto error;
-             /* Hack for temp */
-             temp = temp / 1000;
-             fclose(f);
-          }
-        else
-          goto error;
-        break;
-      case SENSOR_TYPE_LINUX_ACPI:
-        f = fopen(inst->sensor_path, "r");
-        if (f)
-          {
-             char *p, *q;
-             fgets(buf, sizeof(buf), f); buf[sizeof(buf) - 1] = 0;
-             fclose(f);
-             p = strchr(buf, ':');
-             if (p)
-               {
-                  p++;
-                  while (*p == ' ') p++;
-                  q = strchr(p, ' ');
-                  if (q) *q = 0;
-                  temp = atoi(p);
-                  ret = 1;
-               }
-             else
-               goto error;
-          }
-        else
-          goto error;
-        break;
-     }
-
-   if (inst->units == FAHRENHEIT)
-     temp = (temp * 9.0 / 5.0) + 32;
-
-   if (ret)
-     {
-       char *utf8;
-
-       if (inst->have_temp != 1)
-         {
-            /* enable therm object */
-            edje_object_signal_emit(inst->o_temp, "e,state,known", "");
-            inst->have_temp = 1;
-         }
-
-       if (inst->units == FAHRENHEIT) 
-         snprintf(buf, sizeof(buf), "%i°F", temp);
-       else
-         snprintf(buf, sizeof(buf), "%i°C", temp);  
-       utf8 = ecore_txt_convert("iso-8859-1", "utf-8", buf);
-
-        _temperature_face_level_set(inst,
-                                   (double)(temp - inst->low) /
-                                   (double)(inst->high - inst->low));
-       edje_object_part_text_set(inst->o_temp, "e.text.reading", utf8);
-       free(utf8);
-     }
-   else
-     {
-       if (inst->have_temp != 0)
-         {
-            /* disable therm object */
-            edje_object_signal_emit(inst->o_temp, "e,state,unknown", "");
-            edje_object_part_text_set(inst->o_temp, "e.text.reading", "NO TEMP");
-            _temperature_face_level_set(inst, 0.5);
-            inst->have_temp = 0;
-         }
-     }
-   return 1;
-   
-error:
-   /* TODO: Error count? Might be a temporary problem */
-   /* TODO: Error dialog */
-   /* TODO: This should be further up, so that it will affect the gadcon */
-   inst->sensor_type = SENSOR_TYPE_NONE;
-   if (inst->sensor_name) evas_stringshare_del(inst->sensor_name);
-   inst->sensor_name = NULL;
-   if (inst->sensor_path) evas_stringshare_del(inst->sensor_path);
-   inst->sensor_path = NULL;
-   return 1;
-}
-
-static void
 _temperature_face_level_set(Config_Face *inst, double level)
 {
    Edje_Message_Float msg;
@@ -568,7 +367,6 @@ _temperature_face_shutdown(Evas_Hash *hash, const char *key, void *hdata, void *
    inst = hdata;
 
    if (inst->sensor_name) evas_stringshare_del(inst->sensor_name);
-   if (inst->sensor_path) evas_stringshare_del(inst->sensor_path);
    if (inst->id) evas_stringshare_del(inst->id);
    free(inst);
    return 1;
@@ -591,15 +389,21 @@ _temperature_face_id_max(Evas_Hash *hash, const char *key, void *hdata, void *fd
 void 
 temperature_face_update_config(Config_Face *inst)
 {
-   if (inst->sensor_path)
-     evas_stringshare_del(inst->sensor_path);
-   inst->sensor_path = NULL;
-
-   _temperature_sensor_init(inst);
-
-   if (inst->temperature_check_timer) ecore_timer_del(inst->temperature_check_timer);
-   inst->temperature_check_timer = 
-     ecore_timer_add(inst->poll_time, _temperature_cb_check, inst);
+   char buf[PATH_MAX];
+   
+   ecore_exe_terminate(inst->tempget_exe);
+   ecore_exe_free(inst->tempget_exe);
+   inst->tempget_exe = NULL;
+   snprintf(buf, sizeof(buf),
+           "%s/%s/tempget %i \"%s\" %i", 
+           e_module_dir_get(temperature_config->module), MODULE_ARCH, 
+           inst->sensor_type,
+           (inst->sensor_name != NULL ? inst->sensor_name : "(null)"),
+           inst->poll_interval);
+   inst->tempget_exe = ecore_exe_pipe_run(buf, 
+                                         ECORE_EXE_PIPE_READ | 
+                                         ECORE_EXE_PIPE_READ_LINE_BUFFERED,
+                                         inst);
 }
 
 Ecore_List *
@@ -673,7 +477,7 @@ e_modapi_init(E_Module *m)
 #define T Config_Face
 #define D conf_face_edd
    E_CONFIG_VAL(D, T, id, STR);
-   E_CONFIG_VAL(D, T, poll_time, DOUBLE);
+   E_CONFIG_VAL(D, T, poll_interval, INT);
    E_CONFIG_VAL(D, T, low, INT);
    E_CONFIG_VAL(D, T, high, INT);
    E_CONFIG_VAL(D, T, sensor_type, INT);
index e3c6603..87c49e8 100644 (file)
@@ -29,11 +29,10 @@ struct _Config_Face
 {
    const char      *id;
    /* saved * loaded config values */
-   double           poll_time;
+   int              poll_interval;
    int              low, high;
-   Sensor_Type      sensor_type;
+   int              sensor_type;
    const char      *sensor_name;
-   const char      *sensor_path;
    Unit             units;
    /* config state */
    E_Gadcon_Client *gcc;
@@ -43,7 +42,11 @@ struct _Config_Face
 
    E_Config_Dialog *config_dialog;
    E_Menu          *menu;
-   Ecore_Timer     *temperature_check_timer;
+   Ecore_Exe       *tempget_exe;
+   Ecore_Event_Handler *tempget_data_handler;
+   Ecore_Event_Handler *tempget_del_handler;
+   
+//   Ecore_Poller    *temperature_check_poller;
    unsigned char    have_temp;
 #ifdef __FreeBSD__
    int              mib[5];