aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2020-09-22 00:59:48 +0200
committerKenny Levinsen <kl@kl.wtf>2020-09-22 01:14:24 +0200
commitba4c4226595598f6e3f9712eed6c04c49b7399e5 (patch)
tree2668075c89e17aa1f4d6d15c96679a1a314de64d
parent521d95349f6aced729192054e24cd04757f4f2ad (diff)
seat: Use current VT for switch and ack
-rw-r--r--seatd/seat.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/seatd/seat.c b/seatd/seat.c
index d11ca5a..16935cf 100644
--- a/seatd/seat.c
+++ b/seatd/seat.c
@@ -87,8 +87,8 @@ static void vt_close(struct seat *seat) {
seat->cur_ttyfd = -1;
}
-static int vt_switch(int vt) {
- int ttyfd = terminal_open(0);
+static int vt_switch(struct seat *seat, int vt) {
+ int ttyfd = terminal_open(seat->cur_vt);
if (ttyfd == -1) {
log_errorf("could not open terminal: %s", strerror(errno));
return -1;
@@ -99,8 +99,8 @@ static int vt_switch(int vt) {
return 0;
}
-static int vt_ack(void) {
- int tty0fd = terminal_open(0);
+static int vt_ack(struct seat *seat) {
+ int tty0fd = terminal_open(seat->cur_vt);
if (tty0fd == -1) {
log_errorf("unable to open tty0: %s", strerror(errno));
return -1;
@@ -575,7 +575,7 @@ int seat_set_next_session(struct client *client, int session) {
if (seat->vt_bound) {
log_infof("switching to VT %d from %d", session, seat->cur_vt);
- if (vt_switch(session) == -1) {
+ if (vt_switch(seat, session) == -1) {
log_error("could not switch VT");
return -1;
}
@@ -625,13 +625,14 @@ int seat_prepare_vt_switch(struct seat *seat) {
log_debug("VT switch request on non VT-bound seat, ignoring");
return -1;
}
+ seat_update_vt(seat);
log_debug("acking VT switch");
if (seat->active_client != NULL) {
seat_disable_client(seat->active_client);
}
- vt_ack();
+ vt_ack(seat);
seat->cur_vt = -1;
return 0;
}