commit 7988f10

Michael Forney  ·  2014-12-25 08:57:07 +0000 UTC
parent 6a2570e
launch: Add -n flag to start compositor without switching to its VT
2 files changed,  +22, -11
+19, -11
 1@@ -74,13 +74,15 @@ static struct
 2     long console_mode;
 3 } original_vt_state;
 4 
 5+static bool nflag;
 6+
 7 static void __attribute__((noreturn,format(printf,1,2)))
 8     die(const char * format, ...);
 9 
10 static void __attribute__((noreturn)) usage(const char * name)
11 {
12-    fprintf(stderr, "Usage: %s [-s <server-socket>] [-t <tty-device>] [--] "
13-                    "<server> [server arguments...]\n", name);
14+    fprintf(stderr, "Usage: %s [-n] [-s <server-socket>] [-t <tty-device>] "
15+                    "[--] <server> [server arguments...]\n", name);
16     exit(EXIT_FAILURE);
17 }
18 
19@@ -388,16 +390,19 @@ static void setup_tty(int fd)
20         goto error1;
21     }
22 
23-    if (ioctl(fd, VT_ACTIVATE, vt) == -1)
24+    if (!nflag)
25     {
26-        perror("Could not activate VT");
27-        goto error2;
28-    }
29+        if (ioctl(fd, VT_ACTIVATE, vt) == -1)
30+        {
31+            perror("Could not activate VT");
32+            goto error2;
33+        }
34 
35-    if (ioctl(fd, VT_WAITACTIVE, vt) == -1)
36-    {
37-        perror("Could not wait for VT to become active");
38-        goto error2;
39+        if (ioctl(fd, VT_WAITACTIVE, vt) == -1)
40+        {
41+            perror("Could not wait for VT to become active");
42+            goto error2;
43+        }
44     }
45 
46     original_vt_state.altered = true;
47@@ -422,10 +427,13 @@ int main(int argc, char * argv[])
48     struct sigaction action = { 0 };
49     sigset_t set;
50 
51-    while ((option = getopt(argc, argv, "s:t:")) != -1)
52+    while ((option = getopt(argc, argv, "ns:t:")) != -1)
53     {
54         switch (option)
55         {
56+            case 'n':
57+                nflag = true;
58+                break;
59             case 's':
60                 setenv("WAYLAND_DISPLAY", optarg, true);
61                 break;
+3, -0
 1@@ -371,6 +371,9 @@ bool initialize_libinput(const char * seat_name)
 2         goto error2;
 3     }
 4 
 5+    if (!swc.active)
 6+        libinput_suspend(seat.libinput);
 7+
 8     return true;
 9 
10   error2: