Package: wdm
Version: 1.28-2.2
Severity: wishlist

hi,

the attached patch against 1.28-2.2 adds 2 options/actions, so that user
can suspend to RAM/disk from wdm's panel - a long standing TODO in my 
personal list.
wdm-config defaults are for commands from hibernate pkg.


thanx
-- 
paolo

-- 
 paolo
 
 GPG/PGP id:0x3A47DE45  - B5F9 AAA0 44BD 2B63 81E0  971F C6C0 0B87 3A47 DE45
 - 9/11: the outrageous deception & coverup: http://journalof911studies.com -
diff -urN wdm-1.28/debian/changelog wdm-1.28-2.3/debian/changelog
--- wdm-1.28/debian/changelog   2008-12-12 10:27:25.000000000 +0100
+++ wdm-1.28-2.3/debian/changelog       2008-12-11 21:30:39.000000000 +0100
@@ -1,3 +1,9 @@
+wdm (1.28-2.3) unstable; urgency=low
+
+  * add suspend2{Ram,Disk}
+
+ -- amsis <am...@localhosy>  Thu, 11 Dec 2008 21:30:31 +0100
+
 wdm (1.28-2.2) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -urN wdm-1.28/debian/config/wdm-config 
wdm-1.28-2.3/debian/config/wdm-config
--- wdm-1.28/debian/config/wdm-config   2008-12-12 10:27:25.000000000 +0100
+++ wdm-1.28-2.3/debian/config/wdm-config       2008-12-12 00:52:35.000000000 
+0100
@@ -39,6 +39,8 @@
 ! DisplayManager*wdmWm:         twm:wmaker:afterstep
 DisplayManager*wdmReboot:       /sbin/reboot
 DisplayManager*wdmHalt:         /sbin/halt
+DisplayManager*suspend2Ram:    /usr/sbin/hibernate-ram
+DisplayManager*suspend2Disk:   /usr/sbin/hibernate-disk
 DisplayManager*wdmVerify:       true
 DisplayManager*wdmRoot:         true
 DisplayManager*wdmAnimations:   true
diff -urN wdm-1.28/src/wdm/Greet.c wdm-1.28-2.3/src/wdm/Greet.c
--- wdm-1.28/src/wdm/Greet.c    2005-03-26 14:57:04.000000000 +0100
+++ wdm-1.28-2.3/src/wdm/Greet.c        2008-12-11 23:24:44.000000000 +0100
@@ -125,6 +125,8 @@
 extern char *wdmBg;
 extern char *wdmReboot;
 extern char *wdmHalt;
+extern char *wdmSuspend2Disk;
+extern char *wdmSuspend2Ram;
 extern int   wdmRoot;
 extern int   wdmVerify;
 extern int   wdmAnimations;
@@ -305,6 +307,14 @@
                 readstring(pipe_filedes[0], exitArg);
                 code = 4;
            break;
+           case 5:      /*suspend2ram*/
+                readstring(pipe_filedes[0], exitArg);
+                code = 5;
+           break;
+           case 6:      /*suspend2disk*/
+                readstring(pipe_filedes[0], exitArg);
+                code = 6;
+           break;
            default:     /*????*/
                 WDMError("Bad extension code from external program: %i\n",
                                code);
@@ -382,6 +392,7 @@
                         SessionExit (d, UNMANAGE_DISPLAY, FALSE);
                    break;
                    case 4:              /* exit */
+#ifdef WITH_EXITLOGIN
                         CloseGreet (pid);
                         WDMDebug("UNMANAGE_DISPLAY\n");
                         WDMInfo("%s exit(%s) by %s\n",
@@ -392,6 +403,15 @@
                         WDMDebug ("Killing parent process %d\n", getppid());
                         kill (getppid(), SIGINT);
 #endif
+#endif
+                   break;
+                   case 5:              /* s2r */
+                        WDMInfo("suspend2ram(%s) by %s\n", exitArg, name);
+                        system(wdmSuspend2Ram);
+                   break;
+                   case 6:              /* s2d */
+                        WDMInfo("suspend2disk(%s) by %s\n", exitArg, name);
+                        system(wdmSuspend2Disk);
                    break;
                 }
             }
diff -urN wdm-1.28/src/wdm/resource.c wdm-1.28-2.3/src/wdm/resource.c
--- wdm-1.28/src/wdm/resource.c 2005-03-26 14:57:04.000000000 +0100
+++ wdm-1.28-2.3/src/wdm/resource.c     2008-12-11 20:36:20.000000000 +0100
@@ -77,6 +77,8 @@
 char   *wdmDefaultPasswd;      /* points to optional default passwd */
 char   *wdmBg;                 /* pixmap or color(s) for background */
 char   *wdmReboot;             /* command for Reboot */
+char   *wdmSuspend2Disk;       /* command to hibernate on disk */
+char   *wdmSuspend2Ram;        /* command to hibernate in RAM aka standby */
 char   *wdmHalt;               /* command to Halt */
 int_resource   wdmVerify;      /* if true, require name & password for Exit */
                                /* reboot or halt */
@@ -274,6 +276,10 @@
                                ""} ,
 { "wdmLogin",  "WdmLogin",     DM_STRING,      &wdmLogin,
                                DEF_WDMLOGIN} ,
+{ "wdmSuspend2Disk",   "WdmSuspend2Disk",      DM_STRING,      
+               &wdmSuspend2Disk,       "s2disk"} ,
+{ "wdmSuspend2Ram",    "WdmSuspend2Ram",       DM_STRING,      
+               &wdmSuspend2Ram,        "s2ram"} ,
 { "wdmReboot", "WdmReboot",    DM_STRING,      &wdmReboot,
                                "reboot"} ,
 { "wdmHalt",   "WdmHalt",      DM_STRING,      &wdmHalt,
diff -urN wdm-1.28/src/wdmLogin/config.c wdm-1.28-2.3/src/wdmLogin/config.c
--- wdm-1.28/src/wdmLogin/config.c      2005-03-26 14:57:04.000000000 +0100
+++ wdm-1.28-2.3/src/wdmLogin/config.c  2008-12-12 01:04:35.000000000 +0100
@@ -27,7 +27,7 @@
 
 static Bool WDMCheckPLGeometry(WMPropList *pl, void *def, void *target);
 
-static WMRect default_geometry = {{INT_MIN, INT_MIN}, {530, 240}};
+static WMRect default_geometry = {{INT_MIN, INT_MIN}, {554, 240}};
 
 static WDMDictionaryStruct wdmLogin_config_struct[] = 
 {
diff -urN wdm-1.28/src/wdmLogin/Login.c wdm-1.28-2.3/src/wdmLogin/Login.c
--- wdm-1.28/src/wdmLogin/Login.c       2005-03-26 14:57:04.000000000 +0100
+++ wdm-1.28-2.3/src/wdmLogin/Login.c   2008-12-12 02:25:49.000000000 +0100
@@ -114,14 +114,20 @@
 static char *ExitStr[] = { N_("Login"), N_("Reboot"), N_("Halt"),
 #ifdef WITH_EXITLOGIN
        N_("ExitLogin"),
+#else
+       N_("---------"),
 #endif
+        N_("Suspend to RAM"), N_("Suspend to disk"),
        NULL };
 
 static char *ExitFailStr[] = { N_("Login failed"), N_("Reboot failed"),
        N_("Halt failed"),
 #ifdef WITH_EXITLOGIN
        N_("ExitLogin failed"),
+#else
+       N_("--------- failed"),
 #endif
+       N_("Suspend to RAM failed"), N_("Suspend to disk failed"),
        NULL };
 
 static int WmOptionCode = 0;
@@ -502,10 +508,16 @@
        }
 
        init_namefield("");
-       if(OptionCode == 0)
-               PrintInfoMsg(panel, _("validating"));
-       else
-               PrintInfoMsg(panel, _("exiting"));
+       WDMDebug("%s: OptionCode=%c\n", __FUNCTION__, OptionCode);
+       switch (OptionCode) {
+         case 0: PrintInfoMsg(panel, _("validating"));
+               break;
+         case 4:
+         case 5: PrintInfoMsg(panel, _("suspending ..."));
+               break;
+         default: PrintInfoMsg(panel, _("exiting"));
+               break;
+       }
 
        OutputAuth(LoginName, LoginPswd);
 }
@@ -536,7 +548,16 @@
                LoginPswd = WMGetTextFieldText(panel->entryText);
                WMSetTextFieldText(panel->entryText, "");
        }
-       PrintInfoMsg(panel, _("exiting"));
+       WDMDebug("%s: OptionCode=%c\n", __FUNCTION__, OptionCode);
+       switch (OptionCode) {
+         case 0: PrintInfoMsg(panel, _("validating"));
+               break;
+         case 4:
+         case 5: PrintInfoMsg(panel, _("suspending ..."));
+               break;
+         default: PrintInfoMsg(panel, _("exiting"));
+               break;
+       }
        OutputAuth(LoginName, LoginPswd);
 }
 
@@ -843,11 +864,11 @@
        WMSetFrameTitlePosition(panel->exitF, WTPAtTop);
        WMSetFrameTitle(panel->exitF, _("Options"));
        WMMoveWidget(panel->exitF, 134, 178);
-       WMResizeWidget(panel->exitF, 98, 45);
+       WMResizeWidget(panel->exitF, 122, 45);
 
        panel->exitBtn = WMCreatePopUpButton(panel->exitF);
        WMMoveWidget(panel->exitBtn, 4, 15);
-       WMResizeWidget(panel->exitBtn, 90, 25);
+       WMResizeWidget(panel->exitBtn, 114, 25);
        WMSetPopUpButtonAction(panel->exitBtn, (WMAction *) changeOption,
                               panel);
        i = 0;

Reply via email to