discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=ac809440e92389309c69588f16712bf5be95490e

commit ac809440e92389309c69588f16712bf5be95490e
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Fri Jan 15 19:25:25 2016 -0500

    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
---
 src/bin/e_desklock.c | 39 +++++++++++++++++++++++++++++++++++++++
 src/bin/e_desklock.h |  1 +
 2 files changed, 40 insertions(+)

diff --git a/src/bin/e_desklock.c b/src/bin/e_desklock.c
index 0b8a458..d291835 100644
--- a/src/bin/e_desklock.c
+++ b/src/bin/e_desklock.c
@@ -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();
diff --git a/src/bin/e_desklock.h b/src/bin/e_desklock.h
index 5dfeaef..0af3932 100644
--- a/src/bin/e_desklock.h
+++ b/src/bin/e_desklock.h
@@ -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);

-- 


Reply via email to