From 5883b17072003d34b95294fade9c81b216965092 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Fri, 31 Aug 2018 15:46:55 -0400 Subject: session-worker: clear VT before jumping to it If we're going to jump to a new VT we should make sure it's free of residual console text. That way if there's flicker the user will be less likely to notice it. This commit sends a clear screen escape sequence to the tty before jumping to it. --- daemon/gdm-session-worker.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c index bcddc948..3fde9cbc 100644 --- a/daemon/gdm-session-worker.c +++ b/daemon/gdm-session-worker.c @@ -975,6 +975,13 @@ jump_to_vt (GdmSessionWorker *worker, active_vt_tty_fd = open ("/dev/tty0", O_RDWR | O_NOCTTY); if (worker->priv->session_tty_fd != -1) { + static const char *clear_screen_escape_sequence = "\33[H\33[2J"; + + /* let's make sure the new VT is clear */ + write (worker->priv->session_tty_fd, + clear_screen_escape_sequence, + sizeof (clear_screen_escape_sequence)); + fd = worker->priv->session_tty_fd; g_debug ("GdmSessionWorker: first setting graphics mode to prevent flicker"); -- cgit v1.2.1