forked from enlightenment/enlightenment
desklock - add explicit manually invoked api and a blocking api
this is so parts of e (moduels etc.) could block a lock for some reason and differentiate between an automatic lock and a manually invoked one.
This commit is contained in:
parent
959b041e12
commit
cbe3858b15
|
@ -2543,7 +2543,7 @@ ACT_FN_GO(desk_lock, EINA_UNUSED)
|
|||
|
||||
zone = _e_actions_zone_get(obj);
|
||||
if (zone)*/
|
||||
e_desklock_show(EINA_FALSE);
|
||||
e_desklock_show_manual(EINA_FALSE);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
|
|
@ -35,6 +35,10 @@ static Eina_List *desklock_ifaces = NULL;
|
|||
static E_Desklock_Interface *current_iface = NULL;
|
||||
static Eina_Bool demo = EINA_FALSE;
|
||||
|
||||
static Eina_Bool _e_desklock_want = EINA_FALSE;
|
||||
static int _e_desklock_block = 0;
|
||||
static Eina_Bool desklock_manual = EINA_FALSE;
|
||||
|
||||
/***********************************************************************/
|
||||
static Eina_Bool _e_desklock_cb_custom_desklock_exit(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
|
||||
static Eina_Bool _e_desklock_cb_idle_poller(void *data EINA_UNUSED);
|
||||
|
@ -237,8 +241,8 @@ e_desklock_demo(void)
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
E_API int
|
||||
e_desklock_show(Eina_Bool suspend)
|
||||
static int
|
||||
_desklock_show_internal(Eina_Bool suspend)
|
||||
{
|
||||
const Eina_List *l;
|
||||
E_Event_Desklock *ev;
|
||||
|
@ -372,8 +376,16 @@ fail:
|
|||
return 0;
|
||||
}
|
||||
|
||||
E_API void
|
||||
e_desklock_hide(void)
|
||||
E_API int
|
||||
e_desklock_show(Eina_Bool suspend)
|
||||
{
|
||||
_e_desklock_want = EINA_TRUE;
|
||||
if ((_e_desklock_block > 0) && (!desklock_manual)) return;
|
||||
return _desklock_show_internal(suspend);
|
||||
}
|
||||
|
||||
static void
|
||||
_desklock_hide_internal(void)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Event_Desklock *ev;
|
||||
|
@ -458,12 +470,60 @@ e_desklock_hide(void)
|
|||
if (getenv("E_START_MANAGER")) kill(getppid(), SIGHUP);
|
||||
}
|
||||
|
||||
E_API int
|
||||
e_desklock_show_manual(Eina_Bool suspend)
|
||||
{
|
||||
desklock_manual = EINA_TRUE;
|
||||
return e_desklock_show(suspend);
|
||||
}
|
||||
|
||||
E_API Eina_Bool
|
||||
e_desklock_manual_get(void)
|
||||
{
|
||||
return desklock_manual;
|
||||
}
|
||||
|
||||
E_API void
|
||||
e_desklock_hide(void)
|
||||
{
|
||||
desklock_manual = EINA_FALSE;
|
||||
_e_desklock_want = EINA_FALSE;
|
||||
_desklock_hide_internal();
|
||||
}
|
||||
|
||||
E_API Eina_Bool
|
||||
e_desklock_state_get(void)
|
||||
{
|
||||
return _e_desklock_state;
|
||||
}
|
||||
|
||||
E_API void
|
||||
e_desklock_block(void)
|
||||
{
|
||||
_e_desklock_block++;
|
||||
if (_e_desklock_block == 1)
|
||||
{
|
||||
if (!desklock_manual)
|
||||
{
|
||||
if (_e_desklock_state) _desklock_hide_internal();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
E_API void
|
||||
e_desklock_unblock(void)
|
||||
{
|
||||
_e_desklock_block--;
|
||||
if (_e_desklock_block == 0)
|
||||
{
|
||||
if (_e_desklock_want) e_desklock_show(EINA_FALSE);
|
||||
}
|
||||
else if (_e_desklock_block < 0)
|
||||
{
|
||||
ERR("desklock block going below zero");
|
||||
}
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_e_desklock_cb_custom_desklock_exit(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
||||
{
|
||||
|
|
|
@ -49,9 +49,14 @@ EINTERN int e_desklock_shutdown(void);
|
|||
E_API Eina_Bool e_desklock_demo(void);
|
||||
E_API int e_desklock_show(Eina_Bool suspend);
|
||||
E_API int e_desklock_show_autolocked(void);
|
||||
E_API int e_desklock_show_manual(Eina_Bool suspend);
|
||||
E_API Eina_Bool e_desklock_manual_get(void);
|
||||
E_API void e_desklock_hide(void);
|
||||
E_API Eina_Bool e_desklock_state_get(void);
|
||||
|
||||
E_API void e_desklock_block(void);
|
||||
E_API void e_desklock_unblock(void);
|
||||
|
||||
E_API void e_desklock_interface_append(E_Desklock_Interface *iface);
|
||||
E_API void e_desklock_interface_remove(E_Desklock_Interface *iface);
|
||||
EINTERN E_Desklock_Interface *e_desklock_interface_current_get(void);
|
||||
|
|
|
@ -820,7 +820,7 @@ main(int argc, char **argv)
|
|||
|
||||
if (waslocked || (locked && ((!after_restart))))
|
||||
{
|
||||
e_desklock_show(EINA_TRUE);
|
||||
e_desklock_show_manual(EINA_TRUE);
|
||||
e_screensaver_update();
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ cb_desktop_lock(const Eldbus_Service_Interface *iface EINA_UNUSED,
|
|||
const Eldbus_Message *msg)
|
||||
{
|
||||
DBG("desklock requested");
|
||||
e_desklock_show(EINA_FALSE);
|
||||
e_desklock_show_manual(EINA_FALSE);
|
||||
return eldbus_message_method_return_new(msg);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue