void ply_terminal_watch_for_vt_changes (ply_terminal_t *terminal) { assert (terminal != NULL); struct vt_mode mode = { 0 }; if (terminal->fd < 0) return; if (!ply_terminal_is_vt (terminal)) return; if (terminal->is_watching_for_vt_changes) return; mode.mode = VT_PROCESS; mode.relsig = SIGUSR1; mode.acqsig = SIGUSR2; if (ioctl (terminal->fd, VT_SETMODE, &mode) < 0) return; ply_event_loop_watch_signal (terminal->loop, SIGUSR1, (ply_event_handler_t) on_leave_vt, terminal); ply_event_loop_watch_signal (terminal->loop, SIGUSR2, (ply_event_handler_t) on_enter_vt, terminal); terminal->is_watching_for_vt_changes = true; }
static bool show_splash_screen (ply_boot_splash_plugin_t *plugin, ply_event_loop_t *loop, ply_buffer_t *boot_buffer, ply_boot_splash_mode_t mode) { assert (plugin != NULL); if (ply_list_get_length (plugin->displays) == 0) { ply_trace ("no pixel displays"); return false; } plugin->loop = loop; plugin->mode = mode; ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t) detach_from_event_loop, plugin); ply_event_loop_watch_signal (plugin->loop, SIGINT, (ply_event_handler_t) on_interrupt, plugin); ply_trace ("starting boot animation"); return start_animation (plugin); }
static bool show_splash_screen (ply_boot_splash_plugin_t *plugin, ply_event_loop_t *loop, ply_buffer_t *boot_buffer, ply_boot_splash_mode_t mode) { assert (plugin != NULL); plugin->loop = loop; plugin->mode = mode; ply_trace ("loading lock image"); if (!ply_image_load (plugin->lock_image)) return false; ply_trace ("loading box image"); if (!ply_image_load (plugin->box_image)) return false; if (plugin->corner_image != NULL) { ply_trace ("loading corner image"); if (!ply_image_load (plugin->corner_image)) { ply_image_free (plugin->corner_image); plugin->corner_image = NULL; } } if (!load_views (plugin)) { ply_trace ("couldn't load views"); return false; } ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t) detach_from_event_loop, plugin); ply_event_loop_watch_signal (plugin->loop, SIGINT, (ply_event_handler_t) on_interrupt, plugin); ply_trace ("starting boot animation"); start_progress_animation (plugin); plugin->is_visible = true; return true; }
bool ply_terminal_open (ply_terminal_t *terminal) { ply_terminal_open_result_t open_result; assert (terminal != NULL); if (terminal->is_open) { ply_trace ("terminal %s is already open", terminal->name); return true; } ply_trace ("trying to open terminal '%s'", terminal->name); open_result = ply_terminal_open_device (terminal); if (open_result != PLY_TERMINAL_OPEN_RESULT_SUCCESS) { ply_trace ("could not open %s : %m", terminal->name); return false; } ply_terminal_refresh_geometry (terminal); ply_terminal_look_up_color_palette (terminal); ply_terminal_save_color_palette (terminal); ply_event_loop_watch_signal (terminal->loop, SIGWINCH, (ply_event_handler_t) ply_terminal_refresh_geometry, terminal); if (ply_terminal_is_vt (terminal)) { ply_terminal_watch_for_vt_changes (terminal); if (get_active_vt (terminal) == terminal->vt_number) terminal->is_active = true; else terminal->is_active = false; } terminal->is_open = true; return true; }