e22087
From e0e098f6b1240979f7da473f8966cd8043bce576 Mon Sep 17 00:00:00 2001
e22087
From: Ray Strode <rstrode@redhat.com>
e22087
Date: Thu, 6 Mar 2014 10:02:21 -0500
e22087
Subject: [PATCH] main: call update_display when splash is shown
e22087
e22087
we need to call update display any time a splash is shown,
e22087
because there may be a pending password request.
e22087
e22087
The code attempted to do this in show_splash, but did it before
e22087
the splash was assigned to running state, so function was a noop.
e22087
e22087
This commit moves it a little later in code after the splash is
e22087
properly assigned.
e22087
---
e22087
 src/main.c | 4 +++-
e22087
 1 file changed, 3 insertions(+), 1 deletion(-)
e22087
e22087
diff --git a/src/main.c b/src/main.c
e22087
index ccb8b63..fb91bf2 100644
e22087
--- a/src/main.c
e22087
+++ b/src/main.c
e22087
@@ -294,60 +294,61 @@ load_settings (state_t     *state,
e22087
           ply_trace ("Splash delay is set to %lf", state->splash_delay);
e22087
           state->splash_delay = atof (delay_string);
e22087
         }
e22087
     }
e22087
 
e22087
   settings_loaded = true;
e22087
 out:
e22087
   ply_key_file_free (key_file);
e22087
 
e22087
   return settings_loaded;
e22087
 }
e22087
 
e22087
 static void
e22087
 show_detailed_splash (state_t *state)
e22087
 {
e22087
   ply_boot_splash_t *splash;
e22087
 
e22087
   if (state->boot_splash != NULL)
e22087
     return;
e22087
 
e22087
   ply_trace ("Showing detailed splash screen");
e22087
   splash = show_theme (state, NULL);
e22087
 
e22087
   if (splash == NULL)
e22087
     {
e22087
       ply_trace ("Could not start detailed splash screen, this could be a problem.");
e22087
       return;
e22087
     }
e22087
 
e22087
   state->boot_splash = splash;
e22087
+  update_display (state);
e22087
 }
e22087
 
e22087
 static const char *
e22087
 command_line_get_string_after_prefix (const char *command_line,
e22087
                                       const char *prefix)
e22087
 {
e22087
   char *argument;
e22087
 
e22087
   argument = strstr (command_line, prefix);
e22087
 
e22087
   if (argument == NULL)
e22087
     return NULL;
e22087
 
e22087
   if (argument == command_line ||
e22087
       argument[-1] == ' ')
e22087
     return argument + strlen (prefix);
e22087
 
e22087
   return NULL;
e22087
 }
e22087
 
e22087
 static bool
e22087
 command_line_has_argument (const char *command_line,
e22087
                            const char *argument)
e22087
 {
e22087
     const char *string;
e22087
 
e22087
     string = command_line_get_string_after_prefix (command_line, argument);
e22087
 
e22087
     if (string == NULL)
e22087
       return false;
e22087
@@ -450,60 +451,62 @@ show_default_splash (state_t *state)
e22087
     {
e22087
       ply_trace ("Trying distribution default splash");
e22087
       state->boot_splash = show_theme (state, state->distribution_default_splash_path);
e22087
     }
e22087
 
e22087
   if (state->boot_splash == NULL)
e22087
     {
e22087
       ply_trace ("Trying old scheme for default splash");
e22087
       state->boot_splash = show_theme (state, PLYMOUTH_THEME_PATH "default.plymouth");
e22087
     }
e22087
 
e22087
   if (state->boot_splash == NULL)
e22087
     {
e22087
       ply_trace ("Could not start default splash screen,"
e22087
                  "showing text splash screen");
e22087
       state->boot_splash = show_theme (state, PLYMOUTH_THEME_PATH "text/text.plymouth");
e22087
     }
e22087
 
e22087
   if (state->boot_splash == NULL)
e22087
     {
e22087
       ply_trace ("Could not start text splash screen,"
e22087
                  "showing built-in splash screen");
e22087
       state->boot_splash = show_theme (state, NULL);
e22087
     }
e22087
 
e22087
   if (state->boot_splash == NULL)
e22087
     {
e22087
       ply_error ("plymouthd: could not start boot splash: %m");
e22087
       return;
e22087
     }
e22087
+
e22087
+  update_display (state);
e22087
 }
e22087
 
e22087
 static void
e22087
 cancel_pending_delayed_show (state_t *state)
e22087
 {
e22087
   if (isnan (state->splash_delay))
e22087
     return;
e22087
 
e22087
   ply_event_loop_stop_watching_for_timeout (state->loop,
e22087
                                             (ply_event_loop_timeout_handler_t)
e22087
                                             show_splash,
e22087
                                             state);
e22087
   state->splash_delay = NAN;
e22087
 }
e22087
 
e22087
 static void
e22087
 on_ask_for_password (state_t      *state,
e22087
                      const char   *prompt,
e22087
                      ply_trigger_t *answer)
e22087
 {
e22087
   ply_entry_trigger_t *entry_trigger;
e22087
 
e22087
   if (state->boot_splash == NULL)
e22087
     {
e22087
       /* Waiting to be shown, boot splash will
e22087
        * arrive shortly so just sit tight
e22087
        */
e22087
       if (state->is_shown)
e22087
         {
e22087
           bool has_open_seats;
e22087
@@ -1671,61 +1674,60 @@ show_theme (state_t           *state,
e22087
     splash = load_theme (state, theme_path);
e22087
   else
e22087
     splash = load_built_in_theme (state);
e22087
 
e22087
   if (splash == NULL)
e22087
     return NULL;
e22087
 
e22087
   attach_splash_to_seats (state, splash);
e22087
   ply_device_manager_activate_renderers (state->device_manager);
e22087
 
e22087
   if (state->mode == PLY_MODE_SHUTDOWN)
e22087
     splash_mode = PLY_BOOT_SPLASH_MODE_SHUTDOWN;
e22087
   else
e22087
     splash_mode = PLY_BOOT_SPLASH_MODE_BOOT_UP;
e22087
 
e22087
   if (!ply_boot_splash_show (splash, splash_mode))
e22087
     {
e22087
       ply_save_errno ();
e22087
       ply_boot_splash_free (splash);
e22087
       ply_restore_errno ();
e22087
       return NULL;
e22087
     }
e22087
 
e22087
 #ifdef PLY_ENABLE_SYSTEMD_INTEGRATION
e22087
   if (state->is_attached)
e22087
     tell_systemd_to_print_details (state);
e22087
 #endif
e22087
 
e22087
   ply_device_manager_activate_keyboards (state->device_manager);
e22087
   show_messages (state);
e22087
-  update_display (state);
e22087
 
e22087
   return splash;
e22087
 }
e22087
 
e22087
 static bool
e22087
 attach_to_running_session (state_t *state)
e22087
 {
e22087
   ply_terminal_session_t *session;
e22087
   ply_terminal_session_flags_t flags;
e22087
   bool should_be_redirected;
e22087
 
e22087
   flags = 0;
e22087
 
e22087
   should_be_redirected = !state->no_boot_log;
e22087
 
e22087
   if (should_be_redirected)
e22087
     flags |= PLY_TERMINAL_SESSION_FLAGS_REDIRECT_CONSOLE;
e22087
 
e22087
  if (state->session == NULL)
e22087
    {
e22087
      ply_trace ("creating new terminal session");
e22087
      session = ply_terminal_session_new (NULL);
e22087
 
e22087
      ply_terminal_session_attach_to_event_loop (session, state->loop);
e22087
    }
e22087
  else
e22087
    {
e22087
      session = state->session;
e22087
      ply_trace ("session already created");
e22087
    }
e22087
-- 
e22087
1.8.3.1
e22087