On 12/17/2006 19:55, Ravenlock wrote:
On 12/17/2006 10:00, Ravenlock wrote:
Hello,

Hoping for comments on the attached patch.

The patch will add "Advanced" features to the Configuration Panel -> Screen -> Screen Lock panel. You can choose to override the "Lock Screen" functionality of E, and/or the E Screensaver with a "Custom Screensaver" which can be any executable you choose.


A slight update.

The only notable changes:
  1)  I've changed the config dialog to use minutes in stead of seconds.
  2)  Changed the range from 10 min max (600 seconds) to 90 minutes max.
  3)  bumped the E_CONFIG_FILE_GENERATION from 0x105 to 0x106


Final update until/unless there is some feedback. There may be no interest in this though I find it useful.

Notable changes:
   1) IPC code in place
   2) Fixed memory leak wrt _e_config_free()

Regards.

Because of the E_CONFIG_FILE_GENERATION bump... please backup your E config dir (just in case). I had something odd happen in the last 24hrs (lost my config), and I'd hate for my patch to be responsible.

I changed the max timeout because, while I feel 10 min is an appropriate timeout (for me)... seems a bit restrictive. So I up'd it a bit.

Regards.

This is handy (I think). There have been some issues with PAM, while this is no fix for that... it does offer a suitable workaround. Especially for those of us who would choose to use things like xscreensaver in the first place.

Yes, you can say "well just disable E's" and configure xscreensaver. But it was annoying to me that I could not "reconfigure" the lock function to use <insert_fav_screensaver_here>. And this makes the E interface feel a little more consistent, in the sense that now I can use the menu "Lock Scree" option, or keybindings to activate the screensaver app of my choosing.

So, you can get a little creative with it. If you keep xscreensaver up and running , you might choose to use 'xscreensaver-command -lock' as your custom saver. This will lock the screen when you tell it to (using xscreensaver). Or (using the also attached script)... you could not run xscreensaver as a daemon, choose to use E's screensaver, override it using the new custom option, and allow E to manage the timer which starts xscreensaver.

The GUI changes I've made are a bit suspect as there are conditional compilations (ifdef HAVE_PAM) that may affect the location of GUI components. if some who does not HAVE_PAM could comment, that would be great too.

Anyway,  I was hoping someone could give it a try and comment.


------------------------------------------------------------------------

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


------------------------------------------------------------------------

_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel




--
Regards,
  Ravenlock
Index: e17/apps/e/src/bin/e_config.c
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_config.c,v
retrieving revision 1.218
diff -u -r1.218 e_config.c
--- e17/apps/e/src/bin/e_config.c       17 Dec 2006 11:24:59 -0000      1.218
+++ e17/apps/e/src/bin/e_config.c       18 Dec 2006 07:35:51 -0000
@@ -478,6 +478,8 @@
    E_CONFIG_VAL(D, T, desklock_use_timeout, INT);
    E_CONFIG_VAL(D, T, desklock_timeout, DOUBLE);
    E_CONFIG_VAL(D, T, desklock_disable_screensaver, INT);
+   E_CONFIG_VAL(D, T, desklock_use_custom_screensaver, INT);
+   E_CONFIG_VAL(D, T, desklock_custom_screensaver_cmd, STR);
    E_CONFIG_VAL(D, T, display_res_restore, INT);
    E_CONFIG_VAL(D, T, display_res_width, INT);
    E_CONFIG_VAL(D, T, display_res_height, INT);
@@ -1282,6 +1284,12 @@
    e_config->remember_internal_windows = 1;
    IFCFGEND;
    
+     
+   IFCFG(0x00106);
+   e_config->desklock_use_custom_screensaver = 0;
+   e_config->desklock_custom_screensaver_cmd = NULL;     
+   IFCFGEND;
+     
 #if 0 /* example of new config */
    IFCFG(0x0090); /* the version # where this value(s) was introduced */
    e_config->new_value = 10; /* set the value(s) */
@@ -1366,8 +1374,9 @@
    E_CONFIG_LIMIT(e_config->desklock_login_box_zone, -2, 1000);
    E_CONFIG_LIMIT(e_config->desklock_autolock, 0, 1);
    E_CONFIG_LIMIT(e_config->desklock_use_timeout, 0, 1);
-   E_CONFIG_LIMIT(e_config->desklock_timeout, 1.0, 600.0);
+   E_CONFIG_LIMIT(e_config->desklock_timeout, 1.0, 5400.0);
    E_CONFIG_LIMIT(e_config->desklock_disable_screensaver, 0, 1);
+   E_CONFIG_LIMIT(e_config->desklock_use_custom_screensaver, 0, 1);
    E_CONFIG_LIMIT(e_config->display_res_restore, 0, 1);
    E_CONFIG_LIMIT(e_config->display_res_width, 1, 8192);
    E_CONFIG_LIMIT(e_config->display_res_height, 1, 8192);
@@ -1966,6 +1975,7 @@
        if (e_config->wallpaper_import_last_dev) 
evas_stringshare_del(e_config->wallpaper_import_last_dev);
        if (e_config->wallpaper_import_last_path) 
evas_stringshare_del(e_config->wallpaper_import_last_path);
        if (e_config->theme_default_border_style) 
evas_stringshare_del(e_config->theme_default_border_style);
+   if (e_config->desklock_custom_screensaver_cmd) 
evas_stringshare_del(e_config->desklock_custom_screensaver_cmd);
        E_FREE(e_config);
      }
 }
Index: e17/apps/e/src/bin/e_config.h
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_config.h,v
retrieving revision 1.136
diff -u -r1.136 e_config.h
--- e17/apps/e/src/bin/e_config.h       17 Dec 2006 16:14:11 -0000      1.136
+++ e17/apps/e/src/bin/e_config.h       18 Dec 2006 07:35:51 -0000
@@ -52,7 +52,7 @@
 /* increment this whenever a new set of config values are added but the users
  * config doesn't need to be wiped - simply new values need to be put in
  */
-#define E_CONFIG_FILE_GENERATION 0x0105
+#define E_CONFIG_FILE_GENERATION 0x0106
 #define E_CONFIG_FILE_VERSION    ((E_CONFIG_FILE_EPOCH << 16) | 
E_CONFIG_FILE_GENERATION)
 
 #define E_EVAS_ENGINE_DEFAULT      0
@@ -231,7 +231,9 @@
    int         desklock_use_timeout; // GUI
    double      desklock_timeout; // GUI
    int         desklock_disable_screensaver; // GUI
-
+   int         desklock_use_custom_screensaver; //GUI
+   const char *desklock_custom_screensaver_cmd; // GUI
+   
    int         display_res_restore; // GUI
    int         display_res_width; // GUI
    int         display_res_height; // GUI
Index: e17/apps/e/src/bin/e_desklock.c
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_desklock.c,v
retrieving revision 1.28
diff -u -r1.28 e_desklock.c
--- e17/apps/e/src/bin/e_desklock.c     21 Oct 2006 02:32:13 -0000      1.28
+++ e17/apps/e/src/bin/e_desklock.c     18 Dec 2006 07:35:52 -0000
@@ -49,6 +49,8 @@
 static Ecore_Event_Handler *_e_desklock_exit_handler = NULL;
 static pid_t                _e_desklock_child_pid = -1;
 #endif
+static Ecore_Exe *_e_custom_saver_exe = NULL;
+static Ecore_Event_Handler *_e_custom_saver_exe_handler = NULL;
 
 /***********************************************************************/
 
@@ -57,6 +59,7 @@
 static int _e_desklock_cb_mouse_up(void *data, int type, void *event);
 static int _e_desklock_cb_mouse_wheel(void *data, int type, void *event);
 static int _e_desklock_cb_mouse_move(void *data, int type, void *event);
+static int _e_desklock_cb_custom_saver_exit(void *data, int type, void *event);
 
 static void _e_desklock_passwd_update();
 static void _e_desklock_backspace();
@@ -87,7 +90,7 @@
 
    if (e_config->desklock_background)
        e_filereg_register(e_config->desklock_background);
-
+   
    return 1;
 }
 
@@ -110,7 +113,18 @@
    E_Zone                *current_zone;
    int                   zone_counter;
    int                   total_zone_num;
-
+   
+   if (_e_custom_saver_exe) return 0;
+   if (e_config->desklock_use_custom_screensaver)
+   {
+      _e_custom_saver_exe_handler = 
ecore_event_handler_add(ECORE_EXE_EVENT_DEL, 
+                                                
_e_desklock_cb_custom_saver_exit, 
+                                                NULL);
+      _e_custom_saver_exe = 
ecore_exe_run(e_config->desklock_custom_screensaver_cmd, NULL);
+    
+      return 1;
+   }      
+   
    if (edd) return 0;
    
 #ifdef HAVE_PAM
@@ -323,8 +337,14 @@
 {
    E_Desklock_Popup_Data       *edp;
    
-   if (!edd) return;
+   if ((!edd) && (!_e_custom_saver_exe)) return;
 
+   if (e_config->desklock_use_custom_screensaver)
+   {
+      _e_custom_saver_exe = NULL;
+      return;
+   }
+   
    if (edd->elock_grab_break_wnd)
      ecore_x_window_show(edd->elock_grab_break_wnd);
    while (edd->elock_wnd_list)
@@ -735,3 +755,22 @@
    return strdup("localhost");
 }
 #endif
+
+static int
+_e_desklock_cb_custom_saver_exit(void *data, int type, void *event)
+{
+   Ecore_Exe_Event_Del *ev;
+  
+   ev = event;
+   if (ev->exe != _e_custom_saver_exe) return 1;
+   
+   if (ev->exit_code != 0)
+   {
+             /* do something profound here... like notify someone */
+   }
+   else
+      e_desklock_hide();
+   
+
+   return 0;
+}
Index: e17/apps/e/src/bin/e_int_config_desklock.c
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_int_config_desklock.c,v
retrieving revision 1.43
diff -u -r1.43 e_int_config_desklock.c
--- e17/apps/e/src/bin/e_int_config_desklock.c  14 Dec 2006 19:42:21 -0000      
1.43
+++ e17/apps/e/src/bin/e_int_config_desklock.c  18 Dec 2006 07:35:52 -0000
@@ -65,6 +65,9 @@
    int specific_lb_zone; // local variable
    int specific_lb_zone_backup; // used to have smart iface
    
+   int use_custom_screensaver;
+   char *custom_screensaver_cmd;
+   
    int zone_count; // local variable;
 
    int bg_mode; // config
@@ -294,7 +297,7 @@
    
    cfdata->autolock = e_config->desklock_autolock;
    cfdata->use_timeout = e_config->desklock_use_timeout;
-   cfdata->timeout = e_config->desklock_timeout;
+   cfdata->timeout = e_config->desklock_timeout / 60;
    
    /* should be taken from e_config */
    //cfdata->login_box_on_zone = -1;
@@ -351,6 +354,10 @@
    cfdata->auth_method = e_config->desklock_auth_method;
 #endif
    
+   cfdata->use_custom_screensaver = e_config->desklock_use_custom_screensaver;
+   if (e_config->desklock_custom_screensaver_cmd)
+      cfdata->custom_screensaver_cmd = 
strdup(e_config->desklock_custom_screensaver_cmd);
+     
    //vertical_lb_align = e_config->desklock_login
 }
 
@@ -389,7 +396,7 @@
    e_config->desklock_personal_passwd = 
evas_stringshare_add(cfdata->desklock_passwd_cp);
    e_config->desklock_autolock = cfdata->autolock;
    e_config->desklock_use_timeout = cfdata->use_timeout;
-   e_config->desklock_timeout = cfdata->timeout;
+   e_config->desklock_timeout = cfdata->timeout * 60;
 #ifdef HAVE_PAM
    e_config->desklock_auth_method = cfdata->auth_method;
 #endif
@@ -465,8 +472,8 @@
    ob = e_widget_label_add(evas, _("Time until screensaver starts"));
    e_widget_disabled_set(ob, !ecore_x_screensaver_event_available_get());
    e_widget_framelist_object_append(of, ob);
-   ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"),
-                           1.0, 600.0,
+   ob = e_widget_slider_add(evas, 1, 0, _("%1.0f minutes"),
+                           1.0, 90.0,
                            1.0, 0, &(cfdata->timeout), NULL,
                            200);
    e_widget_framelist_object_append(of, ob);
@@ -515,7 +522,7 @@
 
    e_config->desklock_autolock = cfdata->autolock;
    e_config->desklock_use_timeout = cfdata->use_timeout;
-   e_config->desklock_timeout = cfdata->timeout;
+   e_config->desklock_timeout = cfdata->timeout * 60;
 #ifdef HAVE_PAM
    e_config->desklock_auth_method = cfdata->auth_method;
 #endif
@@ -523,6 +530,14 @@
    if (e_config->desklock_use_timeout)
      ecore_x_screensaver_timeout_set(e_config->desklock_timeout);
    
+   e_config->desklock_use_custom_screensaver = cfdata->use_custom_screensaver;
+   if (cfdata->custom_screensaver_cmd) 
+      {
+   if (e_config->desklock_custom_screensaver_cmd)
+          evas_stringshare_del(e_config->desklock_custom_screensaver_cmd);
+   e_config->desklock_custom_screensaver_cmd = 
evas_stringshare_add(cfdata->custom_screensaver_cmd);
+      }
+   
    e_config_save_queue();
    return 1;
 }
@@ -764,7 +779,7 @@
    
    e_widget_disabled_set(of, !ecore_x_screensaver_event_available_get());
    
-   ob = e_widget_check_add(evas, _("Enable screensaver"), 
&(cfdata->use_timeout));
+   ob = e_widget_check_add(evas, _("Enable X screensaver"), 
&(cfdata->use_timeout));
    e_widget_disabled_set(ob, !ecore_x_screensaver_event_available_get());
    e_widget_framelist_object_append(of, ob);
    
@@ -775,8 +790,8 @@
    ob = e_widget_label_add(evas, _("Time until screensaver starts"));
    e_widget_disabled_set(ob, !ecore_x_screensaver_event_available_get());
    e_widget_framelist_object_append(of, ob);
-   ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"),
-                           1.0, 600.0,
+   ob = e_widget_slider_add(evas, 1, 0, _("%1.0f minutes"),
+                           1.0, 90.0,
                            1.0, 0, &(cfdata->timeout), NULL,
                            100);
    e_widget_framelist_object_append(of, ob);
@@ -785,6 +800,23 @@
 #else
    e_widget_table_object_append(ot, of, 1, 2, 1, 1 ,1 ,1 ,1 ,1);
 #endif
+
+   /* 
+    * Allow Custom Screen Saver
+    *   Useful, for example, for those of us who prefer
+    *   to use things like xscreensaver, kscreesaver, etc...
+    */
+   of = e_widget_framelist_add(evas, _("Custom Screensaver"), 0);
+   ob = e_widget_check_add(evas, _("Use custom screensaver (Overrides X 
screensaver and desklock)"), 
+                           &(cfdata->use_custom_screensaver));
+   e_widget_framelist_object_append(of, ob);
+   ob = e_widget_entry_add(evas, &(cfdata->custom_screensaver_cmd));
+   e_widget_framelist_object_append(of, ob);
+#ifdef HAVE_PAM
+   e_widget_table_object_append(ot, of, 0, 4, 2, 1, 1, 1, 1, 1);
+#else
+   e_widget_table_object_append(ot, of, 0, 4, 2, 1, 1, 1, 1, 1);
+#endif
    
    e_dialog_resizable_set(cfd->dia, 0);
    return ot;
Index: e17/apps/e/src/bin/e_ipc_handlers.h
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_ipc_handlers.h,v
retrieving revision 1.140
diff -u -r1.140 e_ipc_handlers.h
--- e17/apps/e/src/bin/e_ipc_handlers.h 17 Dec 2006 11:24:59 -0000      1.140
+++ e17/apps/e/src/bin/e_ipc_handlers.h 18 Dec 2006 07:36:01 -0000
@@ -7750,3 +7750,83 @@
    END_INT;
 #endif
 #undef HDL
+
+/****************************************************************************/
+#define HDL E_IPC_OP_DESKLOCK_USE_CUSTOM_SCREENSAVER_SET
+#if (TYPE == E_REMOTE_OPTIONS)
+   OP("-desklock-use-custom-screensaver-set", 1, "Set whether a custom 
screensaver will be utilized", 0, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+   REQ_INT(atoi(params[0]), HDL);
+#elif (TYPE == E_WM_IN)
+   START_INT(policy, HDL);
+   e_config->desklock_use_custom_screensaver = policy;
+   E_CONFIG_LIMIT(e_config->desklock_use_custom_screensaver, 0, 1);
+   SAVE;
+   END_INT;
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+
+/****************************************************************************/
+#define HDL E_IPC_OP_DESKLOCK_USE_CUSTOM_SCREENSAVER_GET
+#if (TYPE == E_REMOTE_OPTIONS)
+   OP("-desklock-use-custom-screensaver-get", 0, "Get whether a custom screen 
saver is being used", 1, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+   REQ_NULL(HDL);
+#elif (TYPE == E_WM_IN)
+   SEND_INT(e_config->desklock_use_custom_screensaver, 
E_IPC_OP_DESKLOCK_USE_CUSTOM_SCREENSAVER_GET_REPLY, HDL);
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+
+/****************************************************************************/
+#define HDL E_IPC_OP_DESKLOCK_USE_CUSTOM_SCREENSAVER_GET_REPLY
+#if (TYPE == E_REMOTE_OPTIONS)
+#elif (TYPE == E_REMOTE_OUT)
+#elif (TYPE == E_WM_IN)
+#elif (TYPE == E_REMOTE_IN)
+   START_INT(val, HDL);
+   printf("REPLY: POLICY=%d\n", val);
+   END_INT;
+#endif
+#undef HDL
+
+/****************************************************************************/
+#define HDL E_IPC_OP_DESKLOCK_CUSTOM_SCREENSAVER_CMD_SET
+#if (TYPE == E_REMOTE_OPTIONS)
+   OP("-desklock-custom-screensaver-cmd-set", 1, "Set the current custom 
screensaver command to OPT1", 0, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+   REQ_STRING(params[0], HDL);
+#elif (TYPE == E_WM_IN)
+   STRING(s, HDL);
+   if (e_config->desklock_custom_screensaver_cmd)
+          evas_stringshare_del(e_config->desklock_custom_screensaver_cmd);
+   e_config->desklock_custom_screensaver_cmd = evas_stringshare_add(s);   
+   END_STRING(s);
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+
+/****************************************************************************/
+#define HDL E_IPC_OP_DESKLOCK_CUSTOM_SCREENSAVER_CMD_GET
+#if (TYPE == E_REMOTE_OPTIONS)
+   OP("-desklock-custom-screensaver-cmd-get", 0, "Get the current custom 
screensaver command", 1, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+   REQ_NULL(HDL);
+#elif (TYPE == E_WM_IN)
+   SEND_STRING(e_config->desklock_custom_screensaver_cmd, 
E_IPC_OP_PROFILE_GET_REPLY, HDL);
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+     
+/****************************************************************************/
+#define HDL E_IPC_OP_DESKLOCK_CUSTOM_SCREENSAVER_CMD_GET_REPLY
+#if (TYPE == E_REMOTE_OPTIONS)
+#elif (TYPE == E_REMOTE_OUT)
+#elif (TYPE == E_WM_IN)
+#elif (TYPE == E_REMOTE_IN)
+   STRING(s, HDL);
+   printf("REPLY: \"%s\"\n", s);
+   END_STRING(s);
+#endif
+#undef HDL
Index: e17/apps/e/src/bin/e_ipc_handlers_list.h
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_ipc_handlers_list.h,v
retrieving revision 1.52
diff -u -r1.52 e_ipc_handlers_list.h
--- e17/apps/e/src/bin/e_ipc_handlers_list.h    16 Dec 2006 21:28:46 -0000      
1.52
+++ e17/apps/e/src/bin/e_ipc_handlers_list.h    18 Dec 2006 07:36:02 -0000
@@ -408,3 +408,10 @@
 #define E_IPC_OP_REMEMBER_INTERNAL_WINDOWS_SET 372
 #define E_IPC_OP_REMEMBER_INTERNAL_WINDOWS_GET 373
 #define E_IPC_OP_REMEMBER_INTERNAL_WINDOWS_GET_REPLY 374
+
+#define E_IPC_OP_DESKLOCK_USE_CUSTOM_SCREENSAVER_SET 375
+#define E_IPC_OP_DESKLOCK_USE_CUSTOM_SCREENSAVER_GET 376
+#define E_IPC_OP_DESKLOCK_USE_CUSTOM_SCREENSAVER_GET_REPLY 377
+#define E_IPC_OP_DESKLOCK_CUSTOM_SCREENSAVER_CMD_SET 378
+#define E_IPC_OP_DESKLOCK_CUSTOM_SCREENSAVER_CMD_GET 379
+#define E_IPC_OP_DESKLOCK_CUSTOM_SCREENSAVER_CMD_GET_REPLY 380
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to