From 7cca71bc959235a2e9c441adb5654e3b4b9f6671 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 11 Jan 2013 14:54:30 +0000 Subject: [PATCH] add fallback timeout for system actions; now that comp is mandatory we have to account for the possibility that themes can fail to send correct signals, leading to the screen going black and nothing happening SVN revision: 82639 --- ChangeLog | 1 + NEWS | 1 + src/bin/e_comp.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/ChangeLog b/ChangeLog index 251b2d676..1f94aaced 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ * fixed bug where backlight settings would try to update dummy backlight devices * added focus-out color class and functionality to default theme * added options and functionality for "fast" composite effects + * added fallback timer for system actions 2013-01-10 Carsten Haitzler diff --git a/NEWS b/NEWS index 95b4cc2a8..0b61d4a4d 100644 --- a/NEWS +++ b/NEWS @@ -65,6 +65,7 @@ Improvements: * config submenu now sets "config" category * composite settings dialog is now accessible from Settings menu * added focus-out color class and functionality to default theme + * added fallback timer for system actions Fixes: * Force check changed upon confirmation dialog closure for engine settings. diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c index 14d22d2b5..1a0eb6194 100644 --- a/src/bin/e_comp.c +++ b/src/bin/e_comp.c @@ -6,6 +6,7 @@ #include "e_comp_wl.h" #endif +#define ACTION_TIMEOUT 30.0 #define OVER_FLOW 1 ////////////////////////////////////////////////////////////////////////// @@ -166,6 +167,8 @@ static E_Comp_Config *conf = NULL; static E_Config_DD *conf_edd = NULL; static E_Config_DD *conf_match_edd = NULL; +static Ecore_Timer *action_timeout = NULL; + static Eina_Inlist *cfg_opts = NULL; ////////////////////////////////////////////////////////////////////////// @@ -4001,6 +4004,47 @@ _e_comp_sys_done_cb(void *data, Evas_Object *obj, const char *sig, const char *s { edje_object_signal_callback_del(obj, sig, src, _e_comp_sys_done_cb); e_sys_action_raw_do((E_Sys_Action)(long)data, NULL); + E_FN_DEL(ecore_timer_del, action_timeout); +} + +static Eina_Bool +_e_comp_sys_action_timeout(void *data) +{ + Eina_List *l, *ll; + E_Comp *c; + E_Comp_Zone *cz; + E_Sys_Action a = (long)(intptr_t)data; + const char *sig = NULL; + + switch (a) + { + case E_SYS_LOGOUT: + sig = "e,state,sys,logout,done"; + break; + case E_SYS_HALT: + sig = "e,state,sys,halt,done"; + break; + case E_SYS_REBOOT: + sig = "e,state,sys,reboot,done"; + break; + case E_SYS_SUSPEND: + sig = "e,state,sys,suspend,done"; + break; + case E_SYS_HIBERNATE: + sig = "e,state,sys,hibernate,done"; + break; + default: + break; + } + E_FN_DEL(ecore_timer_del, action_timeout); + if (sig) + { + EINA_LIST_FOREACH(compositors, l, c) + EINA_LIST_FOREACH(c->zones, ll, cz) + edje_object_signal_callback_del(cz->over, sig, "e", _e_comp_sys_done_cb); + } + e_sys_action_raw_do(a, NULL); + return EINA_FALSE; } static void @@ -4028,6 +4072,8 @@ _e_comp_sys_emit_cb_wait(E_Sys_Action a, const char *sig, const char *rep, Eina_ first = EINA_FALSE; } } + if (action_timeout) ecore_timer_del(action_timeout); + action_timeout = ecore_timer_add(ACTION_TIMEOUT, (Ecore_Task_Cb)_e_comp_sys_action_timeout, (intptr_t*)(long)a); } static void @@ -4409,6 +4455,7 @@ EINTERN int e_comp_shutdown(void) { if (!compositors) return 1; + E_FN_DEL(ecore_timer_del, action_timeout); E_FREE_LIST(compositors, _e_comp_del); E_FREE_LIST(handlers, ecore_event_handler_del);