Subject: slim 1.4.1 auto_login window bug

From: tempforever <[email-masked]>
Date: Sat, 24 Aug 2024 20:14:09 -0400

Package: slim
Version: 1.4.1-1devuan1

devuan: excalibur

/etc/slim.conf setting:
auto_login yes

Upon slim start / auto login, a blank window is created, filling up the
desktop screen.  This does not happen with auto_login disabled.  I found
the issue in panel.cpp, the end of the file:

|// As we're only using one monitor, which is only part of the root
window, // replace Root with a viewport window Root =
XCreateSimpleWindow ( Dpy, RealRoot, result.x, result.y, result.width,
result.height, 0, 0, 0); XMapWindow(Dpy, Root); XFlush(Dpy); If those
lines are commented out, the blank window is not created even with
auto_login enabled. I don't know if that will cause a different issue,
though. I only have 1 monitor on that computer for now, I have not
tested with multiple monitors. Maybe someone who actually knows what
they are doing can fix this? |

---

From: Mark Hindley <[email-masked]>
Date: Tue, 26 Aug 2025 15:15:56 +0100

Control: tags -1 help

Thanks.

The lines you have highlighted[1] were added upstream in version 1.4.1. I know
Rob has had health issues and is no longer active.

I have no means to check the wider effects of this change.
We need some help to test what they might be.

Mark

[1]  https://git.devuan.org/devuan/slim/src/branch/suites/unstable/panel.cpp#L957

---

From: Mark Hindley <[email-masked]>
Date: Tue, 26 Aug 2025 15:39:21 +0100

On Tue, Aug 26, 2025 at 03:15:56PM +0100, Mark Hindley wrote:
> The lines you have highlighted[1] were added upstream in version 1.4.1.

Specifically added in this svn commit:

  https://sourceforge.net/p/slim-fork/code/61/

Mark

---

From: tempforever <[email-masked]>
Date: Wed, 27 Aug 2025 12:22:34 -0400

# See attachment
diff --git a/app.h b/app.h
index 7453e34..a32dcb0 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"
diff --git a/panel.cpp b/panel.cpp
index 7268706..e5f6c57 100644
--- a/panel.cpp
+++ b/panel.cpp
@@ -956,10 +956,10 @@ Rectangle Panel::GetPrimaryViewport()
 
 	// As we're only using one monitor, which is only part of the root window,
 	// replace Root with a viewport window
-	Root = XCreateSimpleWindow ( Dpy, RealRoot, 
-					result.x, result.y, result.width, result.height, 0, 0, 0);
-	XMapWindow(Dpy, Root);
-	XFlush(Dpy);
+//	Root = XCreateSimpleWindow ( Dpy, RealRoot, 
+//					result.x, result.y, result.width, result.height, 0, 0, 0);
+//	XMapWindow(Dpy, Root);
+//	XFlush(Dpy);
 
 	return result;
 }

---

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);