]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[terminal] move terminal opening into renderers/plugins
authorScott James Remnant <scott@ubuntu.com>
Thu, 18 Mar 2010 04:45:01 +0000 (04:45 +0000)
committerScott James Remnant <scott@ubuntu.com>
Thu, 18 Mar 2010 20:01:30 +0000 (20:01 +0000)
Move the responsibility to actually open the terminal to the renderers
and text/details plugin, this allows the X11 renderer to not actually
open the terminal - and thus not crash the X server.

src/main.c
src/plugins/renderers/drm/plugin.c
src/plugins/renderers/frame-buffer/plugin.c
src/plugins/splash/details/plugin.c
src/plugins/splash/text/plugin.c

index 35c287f522c02a86d5b702925660f885f704ab91..7c67c76d6b4e9af6b6176bb8499f34fb2bbd5e93 100644 (file)
@@ -1004,22 +1004,12 @@ static void
 add_display_and_keyboard_for_terminal (state_t    *state,
                                        const char *tty_name)
 {
-  ply_terminal_t *terminal;
   ply_text_display_t *display;
   ply_keyboard_t *keyboard;
 
   ply_trace ("adding display and keyboard for %s", tty_name);
 
-  terminal = ply_terminal_new (tty_name);
-
-  if (!ply_terminal_open (terminal))
-    {
-      ply_trace ("could not open terminal '%s': %m", tty_name);
-      ply_terminal_free (terminal);
-      return;
-    }
-
-  state->terminal = terminal;
+  state->terminal = ply_terminal_new (tty_name);
 
   ply_terminal_activate_vt (state->terminal);
 
@@ -1071,13 +1061,6 @@ add_default_displays_and_keyboard (state_t *state)
 
   terminal = ply_terminal_new (state->default_tty);
 
-  if (!ply_terminal_open (terminal))
-    {
-      ply_trace ("could not open terminal '%s': %m", state->default_tty);
-      ply_terminal_free (terminal);
-      return;
-    }
-
   renderer = ply_renderer_new (NULL, terminal);
 
   if (!ply_renderer_open (renderer))
index 21d727dad8ce9813d33e4c68e0b02d40cf131e48..f4e3ddedc38af702e670452b68f295f561711d70 100644 (file)
@@ -496,6 +496,12 @@ open_device (ply_renderer_backend_t *backend)
   if (!load_driver (backend))
     return false;
 
+  if (!ply_terminal_open (backend->terminal))
+    {
+      ply_trace ("could not open terminal: %m");
+      return false;
+    }
+
   ply_terminal_watch_for_active_vt_change (backend->terminal,
                                            (ply_terminal_active_vt_changed_handler_t)
                                            on_active_vt_changed,
index 3152bf73c8f952532c28cb096bb1097ab04a9048..62ce3da1c518f9630c5a87257a1d409ab9d9362e 100644 (file)
@@ -343,6 +343,12 @@ open_device (ply_renderer_backend_t *backend)
       return false;
     }
 
+  if (!ply_terminal_open (backend->terminal))
+    {
+      ply_trace ("could not open terminal: %m");
+      return false;
+    }
+
   ply_terminal_watch_for_active_vt_change (backend->terminal,
                                            (ply_terminal_active_vt_changed_handler_t)
                                            on_active_vt_changed,
index 47dbbad218c57fcf469f60b060587dfc23e8bffd..d6980cf03fd6e0aa091d01ec827a92bfcc944c6d 100644 (file)
@@ -197,9 +197,13 @@ add_text_display (ply_boot_splash_plugin_t *plugin,
                   ply_text_display_t       *display)
 {
   view_t *view;
+  ply_terminal_t *terminal;
 
   view = view_new (plugin, display);
 
+  terminal = ply_text_display_get_terminal (view->display);
+  ply_terminal_open (terminal);
+
   ply_list_append_data (plugin->views, view);
 }
 
index 61dafa969002f8c3aa0aca68324aea56d3656fc5..228e27101ffdfe28bba4d2b2099097948d0363f6 100644 (file)
@@ -479,9 +479,13 @@ add_text_display (ply_boot_splash_plugin_t *plugin,
                   ply_text_display_t       *display)
 {
   view_t *view;
+  ply_terminal_t *terminal;
 
   view = view_new (plugin, display);
 
+  terminal = ply_text_display_get_terminal (view->display);
+  ply_terminal_open (terminal);
+
   ply_text_display_set_draw_handler (view->display,
                                      (ply_text_display_draw_handler_t)
                                      on_draw, view);