Subject: Re: [devuan-dev] bug#857: Patch

From: tempforever <[email-masked]>
Date: Sun, 9 Nov 2025 15:52:44 -0500

Alternate patch for #857: slim creates a blank window when auto_login is set
Also included is fix for https://dev1galaxy.org/viewtopic.php?id=7501 :
slim crashes when no monitor is plugged in.
Thanks to Eeqmcsq for debugging and finding the source of these issues!

diff --git a/app.cpp b/app.cpp
index d378793..6b0d8de 100644
--- a/app.cpp
+++ b/app.cpp
@@ -454,7 +454,7 @@ void App::Run()
 			try {
 				pam.check_acct();
 #endif
-			Login();
+			Login(true);
 #ifdef USE_PAM
 			}
 			catch(PAM::Auth_Exception& e){
@@ -648,7 +648,7 @@ int App::GetServerPID()
 }

-void App::Login()
+void App::Login(bool autologin)
 {
 	struct passwd *pw;
 	pid_t pid;
@@ -790,6 +790,10 @@ void App::Login()
 			if ( system(sessStart.c_str()) < 0 )
 				logStream << APPNAME << ": Failed to run sessionstart_cmd" << endl;
 		}
+		if( autologin )
+		{
+			LoginPanel->ClosePanel();
+		}
 		Su.Login(loginCommand.c_str(), mcookie.c_str());
 		_exit(OK_EXIT);
 	}
diff --git a/app.h b/app.h
index 7453e34..529ec89 100644
--- a/app.h
+++ b/app.h
@@ -14,6 +14,7 @@
 #define _APP_H_
 
 #include <X11/Xlib.h>
+#include <string>
 
 #ifdef USE_PAM
 #include "PAM.h"
@@ -44,7 +45,7 @@ public:
 	bool isServerStarted();
 
 private:
-	void Login();
+	void Login(bool autologin=false);
 	void Reboot();
 	void Halt();
 	void Suspend();
diff --git a/panel.cpp b/panel.cpp
index 7268706..79f8e03 100644
--- a/panel.cpp
+++ b/panel.cpp
@@ -947,8 +947,10 @@ Rectangle Panel::GetPrimaryViewport()
 
 	result.x = crtc_info->x;
 	result.y = crtc_info->y;
-	result.width = crtc_info->width;
-	result.height = crtc_info->height;
+	// set default value of 1024x768 if monitorless
+	// see https://dev1galaxy.org/viewtopic.php?id=7501
+	result.width = (crtc_info->width == 0 ? 1024 : crtc_info->width);
+	result.height = (crtc_info->height == 0 ? 768 : crtc_info->height);
 
 	XRRFreeCrtcInfo(crtc_info);
 	XRRFreeOutputInfo(primary_info);