desklock - pass lock state info to e_start to lock on crash restart
is e crashes, catches it and restarts while locked you end up unlocked. this lets enlightenment_start know this lock down state and it sets an env var to ensure locking happens on restart after recovery.
This commit is contained in:
parent
6de4f5aa59
commit
851acc7ff7
|
@ -81,7 +81,7 @@ e_desklock_shutdown(void)
|
|||
if (!x_fatal)
|
||||
e_desklock_hide();
|
||||
|
||||
if (waslocked) e_util_env_set("E_DESKLOCK_LOCKED", "locked");
|
||||
// if (waslocked) e_util_env_set("E_DESKLOCK_LOCKED", "locked");
|
||||
|
||||
ecore_event_handler_del(_e_desklock_run_handler);
|
||||
_e_desklock_run_handler = NULL;
|
||||
|
@ -353,8 +353,7 @@ e_desklock_show(Eina_Bool suspend)
|
|||
ev->suspend = suspend;
|
||||
ecore_event_add(E_EVENT_DESKLOCK, ev, NULL, NULL);
|
||||
|
||||
e_util_env_set("E_DESKLOCK_UNLOCKED", NULL);
|
||||
e_util_env_set("E_DESKLOCK_LOCKED", "locked");
|
||||
if (getenv("E_START_MANAGER")) kill(getppid(), SIGUSR2);
|
||||
_e_desklock_state = EINA_TRUE;
|
||||
e_bindings_disabled_set(1);
|
||||
e_screensaver_update();
|
||||
|
@ -457,8 +456,7 @@ e_desklock_hide(void)
|
|||
|
||||
_e_desklock_autolock_time = 0.0;
|
||||
}
|
||||
e_util_env_set("E_DESKLOCK_LOCKED", "freefreefree");
|
||||
e_util_env_set("E_DESKLOCK_UNLOCKED", "happened");
|
||||
if (getenv("E_START_MANAGER")) kill(getppid(), SIGHUP);
|
||||
}
|
||||
|
||||
E_API Eina_Bool
|
||||
|
|
|
@ -818,7 +818,7 @@ main(int argc, char **argv)
|
|||
TS("E_Desklock Init Done");
|
||||
_e_main_shutdown_push(e_desklock_shutdown);
|
||||
|
||||
if (waslocked || (locked && ((!after_restart) || (!getenv("E_DESKLOCK_UNLOCKED")))))
|
||||
if (waslocked || (locked && ((!after_restart))))
|
||||
{
|
||||
e_desklock_show(EINA_TRUE);
|
||||
e_screensaver_update();
|
||||
|
|
|
@ -275,6 +275,32 @@ _sigusr1(int x EINA_UNUSED, siginfo_t *info EINA_UNUSED, void *data EINA_UNUSED)
|
|||
sigaction(SIGUSR1, &action, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_sigusr2(int x EINA_UNUSED, siginfo_t *info EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
struct sigaction action;
|
||||
|
||||
putenv("E_DESKLOCK_LOCKED=locked");
|
||||
|
||||
action.sa_sigaction = _sigusr2;
|
||||
action.sa_flags = SA_RESETHAND;
|
||||
sigemptyset(&action.sa_mask);
|
||||
sigaction(SIGUSR2, &action, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_sighup(int x EINA_UNUSED, siginfo_t *info EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
struct sigaction action;
|
||||
|
||||
putenv("E_DESKLOCK_LOCKED=no");
|
||||
|
||||
action.sa_sigaction = _sighup;
|
||||
action.sa_flags = SA_RESETHAND;
|
||||
sigemptyset(&action.sa_mask);
|
||||
sigaction(SIGHUP, &action, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_print_usage(const char *hstr)
|
||||
{
|
||||
|
@ -540,6 +566,18 @@ main(int argc, char **argv)
|
|||
sigemptyset(&action.sa_mask);
|
||||
sigaction(SIGUSR1, &action, NULL);
|
||||
|
||||
/* Setup USR2 to go into "lock down" mode */
|
||||
action.sa_sigaction = _sigusr2;
|
||||
action.sa_flags = SA_RESETHAND;
|
||||
sigemptyset(&action.sa_mask);
|
||||
sigaction(SIGUSR2, &action, NULL);
|
||||
|
||||
/* Setup HUP to go exit "lock down" mode */
|
||||
action.sa_sigaction = _sighup;
|
||||
action.sa_flags = SA_RESETHAND;
|
||||
sigemptyset(&action.sa_mask);
|
||||
sigaction(SIGHUP, &action, NULL);
|
||||
|
||||
eina_init();
|
||||
|
||||
/* reexcute myself with dbus-launch if dbus-launch is not running yet */
|
||||
|
@ -559,6 +597,7 @@ main(int argc, char **argv)
|
|||
prefix_determine(argv[0]);
|
||||
|
||||
env_set("E_START", argv[0]);
|
||||
env_set("E_START_MANAGER", "1");
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue