commit 44bda01
Michael Forney
·
2015-03-24 07:00:16 +0000 UTC
parent f61ca83
launch: Send activation message when already on the target VT In this case, a VT_ACTIVATE call won't trigger the acquire signal, causing the VT to be stuck in graphics mode with the keyboard off and the compositor to think it is not active. Fixes #21.
1 files changed,
+23,
-11
+23,
-11
1@@ -164,6 +164,24 @@ void __attribute__((noreturn,format(printf,1,2)))
2 exit(EXIT_FAILURE);
3 }
4
5+static void activate(void)
6+{
7+ struct swc_launch_event event = { .type = SWC_LAUNCH_EVENT_ACTIVATE };
8+
9+ start_devices();
10+ send(launcher.socket, &event, sizeof event, 0);
11+ launcher.active = true;
12+}
13+
14+static void deactivate(void)
15+{
16+ struct swc_launch_event event = { .type = SWC_LAUNCH_EVENT_DEACTIVATE };
17+
18+ send(launcher.socket, &event, sizeof event, 0);
19+ stop_devices(true);
20+ launcher.active = false;
21+}
22+
23 static void handle_chld(int signal)
24 {
25 int status;
26@@ -176,22 +194,14 @@ static void handle_chld(int signal)
27
28 static void handle_usr1(int signal)
29 {
30- struct swc_launch_event event = { .type = SWC_LAUNCH_EVENT_DEACTIVATE };
31-
32- send(launcher.socket, &event, sizeof event, 0);
33- stop_devices(true);
34+ deactivate();
35 ioctl(launcher.tty_fd, VT_RELDISP, 1);
36- launcher.active = false;
37 }
38
39 static void handle_usr2(int signal)
40 {
41- struct swc_launch_event event = { .type = SWC_LAUNCH_EVENT_ACTIVATE };
42-
43 ioctl(launcher.tty_fd, VT_RELDISP, VT_ACKACQ);
44- start_devices();
45- send(launcher.socket, &event, sizeof event, 0);
46- launcher.active = true;
47+ activate();
48 }
49
50 static void forward_signal(int signal)
51@@ -392,7 +402,9 @@ static void setup_tty(int fd)
52 goto error1;
53 }
54
55- if (!nflag)
56+ if (vt == original_vt_state.vt)
57+ activate();
58+ else if (!nflag)
59 {
60 if (ioctl(fd, VT_ACTIVATE, vt) == -1)
61 {