diff options
author | okan | 2017-12-22 21:27:45 +0000 |
---|---|---|
committer | okan | 2017-12-22 21:27:45 +0000 |
commit | a0782497be9368c549a411839af14cc7cbf774dd (patch) | |
tree | 672350ec50e5f44bca954ebf446ab07c99e52dd2 /calmwm.c | |
parent | 456e85bd7fa9cca94b23f98acd6f612cc15ee5e0 (diff) | |
download | cwm-a0782497be9368c549a411839af14cc7cbf774dd.tar.gz |
Return the connection number for the display.
Diffstat (limited to 'calmwm.c')
-rw-r--r-- | calmwm.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: calmwm.c,v 1.101 2017/12/22 21:21:44 okan Exp $ + * $OpenBSD: calmwm.c,v 1.102 2017/12/22 21:27:45 okan Exp $ */ #include <sys/types.h> @@ -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 |