add function for creating a demo version of the lockscreen

this provides a simple way to (pre)view the current lockscreen without
fully locking down the compositor
This commit is contained in:
Mike Blumenkrantz 2016-01-15 19:25:25 -05:00
parent de59970690
commit ac809440e9
2 changed files with 40 additions and 0 deletions

View File

@ -32,6 +32,7 @@ static Eina_List *block_rects = NULL;
static Eina_List *desklock_ifaces = NULL;
static E_Desklock_Interface *current_iface = NULL;
static Eina_Bool demo = EINA_FALSE;
/***********************************************************************/
static Eina_Bool _e_desklock_cb_custom_desklock_exit(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
@ -210,6 +211,26 @@ e_desklock_show_autolocked(void)
return e_desklock_show(EINA_FALSE);
}
E_API Eina_Bool
e_desklock_demo(void)
{
E_Desklock_Interface *iface;
Eina_List *l;
if (e_desklock_is_external()) return EINA_FALSE;
EINA_LIST_REVERSE_FOREACH(desklock_ifaces, l, iface)
{
if (iface->show())
{
demo = iface->active = EINA_TRUE;
current_iface = iface;
e_comp_shape_queue();
return EINA_TRUE;
}
}
return EINA_FALSE;
}
E_API int
e_desklock_show(Eina_Bool suspend)
{
@ -283,6 +304,14 @@ e_desklock_show(Eina_Bool suspend)
if (e_config->xkb.lock_layout)
e_xkb_layout_set(e_config->xkb.lock_layout);
if (demo)
{
if (current_iface->hide)
current_iface->hide();
current_iface->active = demo = EINA_FALSE;
current_iface = NULL;
}
{
E_Desklock_Interface *iface;
Eina_Bool success = EINA_TRUE;
@ -336,6 +365,16 @@ e_desklock_hide(void)
E_Event_Desklock *ev;
E_Desklock_Hide_Cb hide_cb;
if (demo && current_iface)
{
if (current_iface->hide)
current_iface->hide();
demo = current_iface->active = EINA_FALSE;
current_iface = NULL;
return;
}
demo = EINA_FALSE;
if ((!_e_desklock_state) && (!_e_custom_desklock_exe)) return;
e_comp_override_del();

View File

@ -42,6 +42,7 @@ struct _E_Event_Desklock
EINTERN int e_desklock_init(void);
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 void e_desklock_hide(void);