aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-07-14 18:44:22 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-07-28 16:05:48 -0400
commit7cba1a3bf4da7a1c5ef3f9c2ce1c84864974da1b (patch)
tree9798720d244683c122f2dd5011f8b414174ecd75
parentrename clock+time module event handler lists (diff)
downloadenlightenment-7cba1a3bf4da7a1c5ef3f9c2ce1c84864974da1b.tar.gz
disable clock+time gadget updating during dpms
-rw-r--r--src/modules/clock/e_mod_main.c16
-rw-r--r--src/modules/time/clock.c11
-rw-r--r--src/modules/time/clock.h1
-rw-r--r--src/modules/time/time.c32
4 files changed, 52 insertions, 8 deletions
diff --git a/src/modules/clock/e_mod_main.c b/src/modules/clock/e_mod_main.c
index b602ff51b..9011238a0 100644
--- a/src/modules/clock/e_mod_main.c
+++ b/src/modules/clock/e_mod_main.c
@@ -839,6 +839,20 @@ _clock_time_update(void *d EINA_UNUSED, int type EINA_UNUSED, void *event EINA_U
return ECORE_CALLBACK_PASS_ON;
}
+static Eina_Bool
+_clock_screensaver_on()
+{
+ E_FREE_FUNC(update_today, ecore_timer_del);
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_clock_screensaver_off()
+{
+ if (clock_instances) _update_today_timer(NULL);
+ return ECORE_CALLBACK_RENEW;
+}
+
/* module setup */
E_API E_Module_Api e_modapi =
{
@@ -901,6 +915,8 @@ e_modapi_init(E_Module *m)
E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_SELF_RENAME, _clock_eio_update, NULL);
E_LIST_HANDLER_APPEND(handlers, E_EVENT_SYS_RESUME, _clock_time_update, NULL);
E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_SYSTEM_TIMEDATE_CHANGED, _clock_time_update, NULL);
+ E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_ON, _clock_screensaver_on, NULL);
+ E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_OFF, _clock_screensaver_off, NULL);
e_gadcon_provider_register(&_gadcon_class);
diff --git a/src/modules/time/clock.c b/src/modules/time/clock.c
index ba322b177..99f3618ce 100644
--- a/src/modules/time/clock.c
+++ b/src/modules/time/clock.c
@@ -522,3 +522,14 @@ time_config_update(Config_Item *ci)
E_FREE_FUNC(clock_timer, ecore_timer_del);
e_config_save_queue();
}
+
+EINTERN void
+clock_timer_set(Eina_Bool set)
+{
+ if (set)
+ {
+ if (clock_instances) _clock_timer(NULL);
+ }
+ else
+ E_FREE_FUNC(clock_timer, ecore_timer_del);
+}
diff --git a/src/modules/time/clock.h b/src/modules/time/clock.h
index 912aa730a..0058eaf8e 100644
--- a/src/modules/time/clock.h
+++ b/src/modules/time/clock.h
@@ -86,6 +86,7 @@ EINTERN void digital_clock_wizard(E_Gadget_Wizard_End_Cb cb, void *data);
EINTERN void analog_clock_wizard(E_Gadget_Wizard_End_Cb cb, void *data);
EINTERN void clock_popup_new(Instance *inst);
EINTERN void time_config_update(Config_Item *ci);
+EINTERN void clock_timer_set(Eina_Bool set);
extern Config *time_config;
extern Eina_List *clock_instances;
diff --git a/src/modules/time/time.c b/src/modules/time/time.c
index 81253e438..cf29d213b 100644
--- a/src/modules/time/time.c
+++ b/src/modules/time/time.c
@@ -323,6 +323,20 @@ _clock_eio_error(void *d EINA_UNUSED, int type EINA_UNUSED, void *event)
return ECORE_CALLBACK_PASS_ON;
}
+static Eina_Bool
+_clock_screensaver_on()
+{
+ clock_timer_set(0);
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_clock_screensaver_off()
+{
+ clock_timer_set(1);
+ return ECORE_CALLBACK_RENEW;
+}
+
EINTERN void
time_init(void)
{
@@ -333,14 +347,16 @@ time_init(void)
if (ecore_file_is_dir("/etc"))
clock_tzetc_monitor = eio_monitor_add("/etc");
- E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_ERROR, _clock_eio_error, NULL);
- E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_FILE_CREATED, _clock_eio_update, NULL);
- E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_FILE_MODIFIED, _clock_eio_update, NULL);
- E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_FILE_DELETED, _clock_eio_update, NULL);
- E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_SELF_DELETED, _clock_eio_update, NULL);
- E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_SELF_RENAME, _clock_eio_update, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_SYS_RESUME, _clock_time_update, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_SYSTEM_TIMEDATE_CHANGED, _clock_time_update, NULL);
+ E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_ERROR, _clock_eio_error, NULL);
+ E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_FILE_CREATED, _clock_eio_update, NULL);
+ E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_FILE_MODIFIED, _clock_eio_update, NULL);
+ E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_FILE_DELETED, _clock_eio_update, NULL);
+ E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_SELF_DELETED, _clock_eio_update, NULL);
+ E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_SELF_RENAME, _clock_eio_update, NULL);
+ E_LIST_HANDLER_APPEND(handlers, E_EVENT_SYS_RESUME, _clock_time_update, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_SYSTEM_TIMEDATE_CHANGED, _clock_time_update, NULL);
+ E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_ON, _clock_screensaver_on, NULL);
+ E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_OFF, _clock_screensaver_off, NULL);
_update_today_timer(NULL);
}