diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2019-06-04 11:52:50 +0100 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2019-06-04 11:58:46 +0100 |
commit | 9432836d30b9b5cd8feed8dd9e06e3e2c2ed5a8f (patch) | |
tree | 310da45dce3353f8e0f0b37e3f4cde2f878736d7 | |
parent | b0fcdf175913a4bb59a12d840156deaf21ef7781 (diff) | |
download | enlightenment-9432836d30b9b5cd8feed8dd9e06e3e2c2ed5a8f.tar.gz |
e wl halt/reboot/logout restart fix - dont restart
so when e was e.g. shutting down the system it'd sometimes - or all
the time, restart and not shut down. this fixes that. e was being sent
a HUP signal while doing this causing e to go "ooh HUP - i shall
restart" which si what daemons without a controlling tty do with
signals commonly. this isn't what we want from e though in this case,
so delay itby a bit and ignore if we're in the process of logging
out/halting etc.
this really only affects wayland mode.
@fix
-rw-r--r-- | src/bin/e_main.c | 13 | ||||
-rw-r--r-- | src/bin/e_sys.c | 18 | ||||
-rw-r--r-- | src/bin/e_sys.h | 1 |
3 files changed, 30 insertions, 2 deletions
diff --git a/src/bin/e_main.c b/src/bin/e_main.c index 55dffed003..fc9f2322c2 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -1317,10 +1317,21 @@ _e_main_cb_signal_exit(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev return ECORE_CALLBACK_RENEW; } +static Ecore_Timer *hup_timer = NULL; + +static Eina_Bool +_cb_hup_timer(void *data EINA_UNUSED) +{ + hup_timer = NULL; + if (!e_sys_on_the_way_out_get()) e_sys_action_do(E_SYS_RESTART, NULL); + return EINA_FALSE; +} + static Eina_Bool _e_main_cb_signal_hup(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev EINA_UNUSED) { - e_sys_action_do(E_SYS_RESTART, NULL); + if (hup_timer) ecore_timer_del(hup_timer); + hup_timer = ecore_timer_add(0.5, _cb_hup_timer, NULL); return ECORE_CALLBACK_RENEW; } diff --git a/src/bin/e_sys.c b/src/bin/e_sys.c index 5dc7754cce..27157a3620 100644 --- a/src/bin/e_sys.c +++ b/src/bin/e_sys.c @@ -64,6 +64,8 @@ static Ecore_Timer *_e_sys_screensaver_unignore_timer = NULL; static double resume_backlight; +static Eina_Bool on_the_way_out = EINA_FALSE; + E_API int E_EVENT_SYS_SUSPEND = -1; E_API int E_EVENT_SYS_HIBERNATE = -1; E_API int E_EVENT_SYS_RESUME = -1; @@ -298,6 +300,10 @@ _e_sys_systemd_signal_prepare_shutdown(void *data EINA_UNUSED, const Eldbus_Mess if (!eldbus_message_arguments_get(msg, "b", &b)) return; printf("SSS: systemd said to prepare for shutdown! bool=%i @%1.8f\n", (int)b, ecore_time_get()); + if (b) + { + if (!e_sys_on_the_way_out_get()) e_sys_action_do(E_SYS_LOGOUT, NULL); + } } static void @@ -441,14 +447,18 @@ e_sys_action_do(E_Sys_Action a, char *param) case E_SYS_RESTART: case E_SYS_EXIT_NOW: case E_SYS_LOGOUT: + case E_SYS_HALT_NOW: + on_the_way_out = EINA_TRUE; + EINA_FALLTHROUGH; + case E_SYS_SUSPEND: case E_SYS_HIBERNATE: - case E_SYS_HALT_NOW: ret = _e_sys_action_do(a, param, EINA_FALSE); break; case E_SYS_HALT: case E_SYS_REBOOT: + on_the_way_out = EINA_TRUE; if (!e_util_immortal_check()) ret = _e_sys_action_do(a, param, EINA_FALSE); break; @@ -522,6 +532,12 @@ e_sys_con_extra_action_list_get(void) return extra_actions; } +E_API Eina_Bool +e_sys_on_the_way_out_get(void) +{ + return on_the_way_out; +} + static void _e_sys_systemd_inhibit_cb(void *data EINA_UNUSED, const Eldbus_Message *m, Eldbus_Pending *p EINA_UNUSED) { diff --git a/src/bin/e_sys.h b/src/bin/e_sys.h index 6b85c0f212..a096a371b0 100644 --- a/src/bin/e_sys.h +++ b/src/bin/e_sys.h @@ -47,6 +47,7 @@ E_API E_Sys_Con_Action *e_sys_con_extra_action_register(const char *label, const void *data); E_API void e_sys_con_extra_action_unregister(E_Sys_Con_Action *sca); E_API const Eina_List *e_sys_con_extra_action_list_get(void); +E_API Eina_Bool e_sys_on_the_way_out_get(void); #endif #endif |