window->vt_number = get_active_vt ();
if (readlink ("/proc/self/fd/0", tty_name, sizeof (tty_name) - 1) < 0)
- return false;
+ {
+ ply_trace ("could not read tty name of fd 0");
+ return false;
+ }
window->tty_name = strdup (tty_name);
}
window->tty_fd = open (window->tty_name, O_RDWR | O_NOCTTY);
if (window->tty_fd < 0)
- return false;
+ {
+ ply_trace ("could not open %s : %m", window->tty_name);
+ return false;
+ }
if (!ply_window_set_unbuffered_input (window))
ply_trace ("window '%s' will be line buffered", window->tty_name);
{
window->is_open = false;
+ ply_trace ("restoring color palette");
ply_window_restore_color_palette (window);
if (ply_frame_buffer_device_is_open (window->frame_buffer))
- ply_frame_buffer_close (window->frame_buffer);
+ {
+ ply_trace ("closing frame buffer");
+ ply_frame_buffer_close (window->frame_buffer);
+ }
if (window->tty_fd_watch != NULL)
{
+ ply_trace ("stop watching tty fd");
ply_event_loop_stop_watching_fd (window->loop, window->tty_fd_watch);
window->tty_fd_watch = NULL;
}
if (window->loop != NULL)
- ply_event_loop_stop_watching_signal (window->loop, SIGWINCH);
+ {
+ ply_trace ("stop watching SIGWINCH signal");
+ ply_event_loop_stop_watching_signal (window->loop, SIGWINCH);
+ }
+ ply_trace ("setting buffered input");
ply_window_set_buffered_input (window);
close (window->tty_fd);
{
ply_list_node_t *node;
+ ply_trace ("checking for open windows");
+
node = ply_list_get_first_node (state->windows);
while (node != NULL)
{
window = ply_list_node_get_data (node);
if (ply_window_is_open (window))
- return true;
+ {
+ int fd;
+ const char *name;
+
+ fd = ply_window_get_tty_fd (window);
+
+ if (fd >= 0)
+ name = ttyname (fd);
+ else
+ name = NULL;
+
+ ply_trace ("window %s%sis open",
+ name != NULL? name : "",
+ name != NULL? " " : "");
+ return true;
+ }
node = next_node;
}
static void
quit_splash (state_t *state)
{
+ ply_trace ("quiting splash");
if (state->boot_splash != NULL)
{
+ ply_trace ("freeing splash");
ply_boot_splash_free (state->boot_splash);
state->boot_splash = NULL;
}