summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2017-12-22 21:27:45 +0000
committerokan <okan>2017-12-22 21:27:45 +0000
commitdfaf44c0acfbe9a1f30b7ed5d830b257cbbb70db (patch)
tree59f671695a65f7bdd060c9f8cf8e0631240f7a43
parentc5d03b0853b8b2c5e3c6cb1ed95b7339e11e5fad (diff)
downloadcwm-dfaf44c0acfbe9a1f30b7ed5d830b257cbbb70db.tar.gz
cwm-dfaf44c0acfbe9a1f30b7ed5d830b257cbbb70db.tar.xz
cwm-dfaf44c0acfbe9a1f30b7ed5d830b257cbbb70db.zip
Return the connection number for the display.
-rw-r--r--calmwm.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/calmwm.c b/calmwm.c
index 21e55bc..fb8c9a9 100644
--- a/calmwm.c
+++ b/calmwm.c
@@ -46,7 +46,7 @@ volatile sig_atomic_t	 cwm_status;
 
 static void	sighdlr(int);
 static int	x_errorhandler(Display *, XErrorEvent *);
-static void	x_init(const char *);
+static int	x_init(const char *);
 static void	x_teardown(void);
 static int	x_wmerrorhandler(Display *, XErrorEvent *);
 
@@ -55,7 +55,7 @@ main(int argc, char **argv)
 {
 	const char	*conf_file = NULL;
 	char		*conf_path, *display_name = NULL;
-	int		 ch;
+	int		 ch, xfd;
 	struct passwd	*pw;
 
 	if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
@@ -108,7 +108,7 @@ main(int argc, char **argv)
 		warnx("config file %s has errors", conf_path);
 	free(conf_path);
 
-	x_init(display_name);
+	xfd = x_init(display_name);
 	cwm_status = CWM_RUNNING;
 
 	if (pledge("stdio rpath proc exec", NULL) == -1)
@@ -123,7 +123,7 @@ main(int argc, char **argv)
 	return(0);
 }
 
-static void
+static int
 x_init(const char *dpyname)
 {
 	int	i;
@@ -143,6 +143,8 @@ x_init(const char *dpyname)
 
 	for (i = 0; i < ScreenCount(X_Dpy); i++)
 		screen_init(i);
+	
+	return ConnectionNumber(X_Dpy);
 }
 
 static void