seat: Add VT cleanup on switch to empty VT

VTs were being cleaned up the active client of a VT went away, or if we
were acking a kernel VT switch request. However, no cleanup was done if
the user had reqested a session switch to a different VT.

Duplicate the VT cleanup to the VT switch condition.
This commit is contained in:
Kenny Levinsen 2020-08-03 02:55:07 +02:00
parent 250adee852
commit 98a4a4ff67

View file

@ -547,6 +547,13 @@ int seat_activate(struct seat *seat) {
// If we're asked to do a simple VT switch, do that // If we're asked to do a simple VT switch, do that
if (seat->next_vt > 0) { if (seat->next_vt > 0) {
log_info("executing VT switch"); log_info("executing VT switch");
if (seat->curttyfd != -1) {
terminal_set_process_switching(seat->curttyfd, false);
terminal_set_keyboard(seat->curttyfd, true);
terminal_set_graphics(seat->curttyfd, false);
close(seat->curttyfd);
seat->curttyfd = -1;
}
terminal_switch_vt(ttyfd, seat->next_vt); terminal_switch_vt(ttyfd, seat->next_vt);
seat->next_vt = 0; seat->next_vt = 0;
close(ttyfd); close(ttyfd);