]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[terminal] only support vt-like operations on VTs
authorScott James Remnant <scott@ubuntu.com>
Thu, 18 Mar 2010 04:10:48 +0000 (04:10 +0000)
committerScott James Remnant <scott@ubuntu.com>
Thu, 18 Mar 2010 19:56:46 +0000 (19:56 +0000)
Now we can simply test whether a terminal is virtual or not, add
a guard in the mode and vt change functions that ensure they only
operate on virtual terminals.

src/libply-splash-core/ply-terminal.c
src/libply-splash-core/ply-text-display.c

index a4a9e766f3bcfe2ae29388363b59d47979404fbf..b9d5a5754c224c821bee60e60b91d4b14da7a7b6 100644 (file)
@@ -388,6 +388,9 @@ ply_terminal_watch_for_vt_changes (ply_terminal_t *terminal)
   if (terminal->fd < 0)
     return;
 
+  if (!ply_terminal_is_vt (terminal))
+    return;
+
   if (terminal->is_watching_for_vt_changes)
     return;
 
@@ -416,6 +419,9 @@ ply_terminal_stop_watching_for_vt_changes (ply_terminal_t *terminal)
 {
   struct vt_mode mode = { 0 };
 
+  if (!ply_terminal_is_vt (terminal))
+    return;
+
   if (!terminal->is_watching_for_vt_changes)
     return;
 
@@ -495,7 +501,10 @@ ply_terminal_open (ply_terminal_t *terminal)
                                ply_terminal_look_up_geometry,
                                terminal);
 
-  ply_terminal_watch_for_vt_changes (terminal);
+  if (ply_terminal_is_vt (terminal))
+    {
+      ply_terminal_watch_for_vt_changes (terminal);
+    }
 
   terminal->is_open = true;
 
@@ -616,6 +625,9 @@ ply_terminal_set_mode (ply_terminal_t     *terminal,
   assert (terminal != NULL);
   assert (mode == PLY_TERMINAL_MODE_TEXT || mode == PLY_TERMINAL_MODE_GRAPHICS);
 
+  if (!ply_terminal_is_vt (terminal))
+    return;
+
   if (terminal->should_ignore_mode_changes)
     return;
 
@@ -637,6 +649,9 @@ void
 ply_terminal_ignore_mode_changes (ply_terminal_t *terminal,
                                   bool            should_ignore)
 {
+  if (!ply_terminal_is_vt (terminal))
+    return;
+
   terminal->should_ignore_mode_changes = should_ignore;
 }
 
@@ -737,6 +752,9 @@ ply_terminal_watch_for_active_vt_change (ply_terminal_t *terminal,
 {
   ply_terminal_active_vt_changed_closure_t *closure;
 
+  if (!ply_terminal_is_vt (terminal))
+    return;
+
   closure = calloc (1, sizeof (*closure));
   closure->handler = active_vt_changed_handler;
   closure->user_data = user_data;
@@ -751,6 +769,9 @@ ply_terminal_stop_watching_for_active_vt_change (ply_terminal_t *terminal,
 {
   ply_list_node_t *node;
 
+  if (!ply_terminal_is_vt (terminal))
+    return;
+
   node = ply_list_get_first_node (terminal->vt_change_closures);
   while (node != NULL)
     {
index cdf78dcd224ce55e6ae76f1d8617fb1bb3852eb7..69d652b2ea19a4049425114f4e03f4597f79a62e 100644 (file)
@@ -249,7 +249,7 @@ ply_text_display_write (ply_text_display_t *display,
   vasprintf (&string, format, args);
   va_end (args);
 
-  if (ply_terminal_get_vt_number (display->terminal) > 0)
+  if (ply_terminal_is_vt (display->terminal))
     ply_terminal_set_mode (display->terminal, PLY_TERMINAL_MODE_TEXT);
   write (fd, string, strlen (string));
   free (string);