|
ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
|
🖥️ Terminal rendering, TTY management, and frame output More...
Files | |
| file | display.c |
| 💻 Client terminal display: TTY detection, frame rendering, and interactive/stdout output routing | |
| file | display.h |
| ascii-chat Client Display Management Interface | |
Functions | |
| int | display_init () |
| Initialize what is necessary to display ascii frames. | |
| bool | display_has_tty () |
| Check if display has TTY capability. | |
| void | display_full_reset () |
| Perform full display reset. | |
| void | display_reset_for_new_connection () |
| Reset display state for new connection. | |
| void | display_disable_logging_for_first_frame () |
| Disable terminal logging for first frame. | |
| void | display_render_frame (const char *frame_data, bool is_snapshot_frame) |
| Render ASCII frame to display. | |
| void | display_cleanup () |
| Cleanup display subsystem. | |
Variables | |
| tty_info_t | g_tty_info = {-1, NULL, false} |
| Global TTY information structure. | |
🖥️ Terminal rendering, TTY management, and frame output
The terminal display subsystem manages terminal initialization, ASCII frame rendering, TTY capability detection, and terminal cleanup.
Implementation: src/client/display.c, src/client/display.h
Problem: Log messages corrupt first frame display
Solution:
| void display_cleanup | ( | ) |
#include <display.c>
Cleanup display subsystem.
Performs graceful cleanup of display resources and terminal state. Restores terminal to original state and closes owned file descriptors.
Definition at line 385 of file display.c.
References ascii_write_destroy(), tty_info_t::fd, g_tty_info, tty_info_t::owns_fd, and platform_close().
| void display_disable_logging_for_first_frame | ( | ) |
#include <display.c>
Disable terminal logging for first frame.
Disables terminal logging before clearing the display for the first frame to prevent log output from interfering with ASCII display.
Call this before clearing the display for the first frame to prevent log output from interfering with ASCII display.
Definition at line 327 of file display.c.
References log_set_terminal_output().
| void display_full_reset | ( | ) |
#include <display.c>
Perform full display reset.
Executes complete terminal reset sequence for clean display state. Safe to call multiple times and handles mode-specific behavior.
Definition at line 301 of file display.c.
References tty_info_t::fd, g_tty_info, and should_exit().
Referenced by client_main(), and server_connection_lost().
| bool display_has_tty | ( | ) |
| int display_init | ( | ) |
#include <display.c>
Initialize what is necessary to display ascii frames.
Initialize display subsystem.
Performs TTY detection, terminal configuration, and ASCII rendering initialization. Must be called once during client startup.
Initialization Steps:
Definition at line 265 of file display.c.
References ascii_write_init(), tty_info_t::fd, g_tty_info, and platform_isatty().
| void display_render_frame | ( | const char * | frame_data, |
| bool | is_snapshot_frame | ||
| ) |
#include <display.c>
Render ASCII frame to display.
Render ASCII frame to display
Handles frame rendering with appropriate output routing based on display mode and snapshot requirements. Manages TTY vs redirect output and snapshot timing coordination.
Rendering Logic:
| frame_data | ASCII frame data to render |
| is_snapshot_frame | Whether this is the final snapshot frame |
| frame_data | ASCII frame data to render |
| is_snapshot_frame | Whether this is the final snapshot frame |
Definition at line 353 of file display.c.
References ERROR_INVALID_PARAM, GET_OPTION, and SET_ERRNO.
| void display_reset_for_new_connection | ( | ) |
#include <display.c>
Reset display state for new connection.
Resets the first frame tracking flag to prepare for a new connection. Call this when starting a new connection to reset first frame tracking.
Call this when starting a new connection to reset first frame tracking.
Definition at line 315 of file display.c.
Referenced by protocol_start_connection().
| tty_info_t g_tty_info = {-1, NULL, false} |
#include <display.c>
Global TTY information structure.
Use tty_info_t from platform abstraction
Maintains information about the terminal/TTY device for interactive output. Contains file descriptor, device path, and validity status. Initialized during display subsystem startup.
Definition at line 102 of file display.c.
Referenced by display_cleanup(), display_full_reset(), and display_init().