forked from enlightenment/enlightenment
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
This commit is contained in:
parent
b0fcdf1759
commit
9432836d30
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue