]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
When using input devices, set the VT keyboard state with KDSKBMODE so that the VT...
authornerdopolis <bluescreen_avenger@verizon.net>
Fri, 8 Dec 2023 15:31:41 +0000 (10:31 -0500)
committernerdopolis <bluescreen_avenger@verizon.net>
Sat, 9 Dec 2023 02:11:18 +0000 (21:11 -0500)
src/libply-splash-core/ply-terminal.c
src/libply-splash-core/ply-terminal.h
src/plugins/renderers/drm/plugin.c
src/plugins/renderers/frame-buffer/plugin.c

index f3fbcebbd13a2bb96ab5847c19de8ba8f60585d1..51280bc0f30c59eb7e0e477774b84c822390e1f1 100644 (file)
@@ -103,6 +103,7 @@ struct _ply_terminal
         uint32_t             is_open : 1;
         uint32_t             is_active : 1;
         uint32_t             is_unbuffered : 1;
+        uint32_t             is_disabled : 1;
         uint32_t             is_watching_for_vt_changes : 1;
         uint32_t             should_ignore_mode_changes : 1;
 };
@@ -240,6 +241,11 @@ ply_terminal_set_unbuffered_input (ply_terminal_t *terminal)
 
         ply_terminal_unlock (terminal);
 
+        terminal->is_disabled = false;
+
+        if (ply_terminal_is_vt (terminal))
+                ioctl (terminal->fd, KDSKBMODE, K_UNICODE);
+
         tcgetattr (terminal->fd, &term_attributes);
 
         if (!terminal->original_term_attributes_saved) {
@@ -270,6 +276,11 @@ ply_terminal_set_buffered_input (ply_terminal_t *terminal)
 {
         struct termios term_attributes;
 
+        terminal->is_disabled = false;
+
+        if (ply_terminal_is_vt (terminal))
+                ioctl (terminal->fd, KDSKBMODE, K_UNICODE);
+
         if (!terminal->is_unbuffered)
                 return true;
 
@@ -310,6 +321,17 @@ ply_terminal_set_buffered_input (ply_terminal_t *terminal)
         return true;
 }
 
+bool
+ply_terminal_set_disabled_input (ply_terminal_t *terminal)
+{
+        terminal->is_disabled = true;
+
+        if (ply_terminal_is_vt (terminal))
+                ioctl (terminal->fd, KDSKBMODE, K_OFF);
+
+        return true;
+}
+
 void
 ply_terminal_write (ply_terminal_t *terminal,
                     const char     *format,
@@ -369,6 +391,11 @@ on_tty_input (ply_terminal_t *terminal)
 {
         ply_list_node_t *node;
 
+        if (terminal->is_disabled) {
+                ply_terminal_flush_input (terminal);
+                return;
+        }
+
         node = ply_list_get_first_node (terminal->input_closures);
         while (node != NULL) {
                 ply_terminal_input_closure_t *closure;
index 14d75d1315ced4eff4e189f4b313e8c4cbe6ab09..8536f4a93a43113058420d892d40d2d02edecafd 100644 (file)
@@ -70,6 +70,7 @@ void ply_terminal_reset_colors (ply_terminal_t *terminal);
 
 bool ply_terminal_set_unbuffered_input (ply_terminal_t *terminal);
 bool ply_terminal_set_buffered_input (ply_terminal_t *terminal);
+bool ply_terminal_set_disabled_input (ply_terminal_t *terminal);
 bool ply_terminal_refresh_geometry (ply_terminal_t *terminal);
 
 __attribute__((__format__ (__printf__, 2, 3)))
index a410be07cd392b4974ae9c7dcef139326e89552c..043d024a7d03c394133ff05177cf285bed0732bb 100644 (file)
@@ -1719,7 +1719,12 @@ flush_head (ply_renderer_backend_t *backend,
 
         if (backend->terminal != NULL) {
                 ply_terminal_set_mode (backend->terminal, PLY_TERMINAL_MODE_GRAPHICS);
-                ply_terminal_set_unbuffered_input (backend->terminal);
+
+                if (using_input_device (&backend->input_source)) {
+                        ply_terminal_set_disabled_input (backend->terminal);
+                } else {
+                        ply_terminal_set_unbuffered_input (backend->terminal);
+                }
         }
         pixel_buffer = head->pixel_buffer;
         updated_region = ply_pixel_buffer_get_updated_areas (pixel_buffer);
index 149c3333fe9ec3c24a48b2f36d9198e8eb63756b..2141990adf7c5843763da59bf04a178ac86dd7d6 100644 (file)
@@ -590,7 +590,12 @@ flush_head (ply_renderer_backend_t *backend,
 
         if (backend->terminal != NULL) {
                 ply_terminal_set_mode (backend->terminal, PLY_TERMINAL_MODE_GRAPHICS);
-                ply_terminal_set_unbuffered_input (backend->terminal);
+
+                if (using_input_device (&backend->input_source)) {
+                        ply_terminal_set_disabled_input (backend->terminal);
+                } else {
+                        ply_terminal_set_unbuffered_input (backend->terminal);
+                }
         }
         pixel_buffer = head->pixel_buffer;
         updated_region = ply_pixel_buffer_get_updated_areas (pixel_buffer);