commit c0e9489

Michael Forney  ·  2018-11-10 21:04:09 +0000 UTC
parent 93ef48f
launch: Let window manager deal with WAYLAND_DISPLAY
2 files changed,  +7, -7
+5, -2
 1@@ -249,13 +249,16 @@ quit(void *data, uint32_t time, uint32_t value, uint32_t state)
 2 int
 3 main(int argc, char *argv[])
 4 {
 5-	display = wl_display_create();
 6+	const char *socket;
 7 
 8+	display = wl_display_create();
 9 	if (!display)
10 		return EXIT_FAILURE;
11 
12-	if (wl_display_add_socket(display, NULL) != 0)
13+	socket = wl_display_add_socket_auto(display);
14+	if (!socket)
15 		return EXIT_FAILURE;
16+	setenv("WAYLAND_DISPLAY", socket, 1);
17 
18 	if (!swc_initialize(display, NULL, &manager))
19 		return EXIT_FAILURE;
+2, -5
 1@@ -79,7 +79,7 @@ die(const char *format, ...);
 2 
 3 static void __attribute__((noreturn)) usage(const char *name)
 4 {
 5-	fprintf(stderr, "usage: %s [-n] [-s socket] [-t tty] [--] server [args...]\n", name);
 6+	fprintf(stderr, "usage: %s [-n] [-t tty] [--] server [args...]\n", name);
 7 	exit(2);
 8 }
 9 
10@@ -431,14 +431,11 @@ main(int argc, char *argv[])
11 	sigset_t set;
12 	posix_spawnattr_t attr;
13 
14-	while ((option = getopt(argc, argv, "ns:t:")) != -1) {
15+	while ((option = getopt(argc, argv, "nt:")) != -1) {
16 		switch (option) {
17 		case 'n':
18 			nflag = true;
19 			break;
20-		case 's':
21-			setenv("WAYLAND_DISPLAY", optarg, true);
22-			break;
23 		case 't':
24 			vt = optarg;
25 			break;