diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-05-29 22:34:19 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-05-29 22:34:19 +0200 |
commit | 87d8b0ceb349e101b693cf43336a98647f4b92dc (patch) | |
tree | 6089767f348807710d59c326e6e062b904e85668 /client/term_linux.c | |
parent | 2c591a5e97ad9f354844d3d2b04a4190f9c6fc1f (diff) |
garbage ui functions + janky status bar
Diffstat (limited to 'client/term_linux.c')
-rw-r--r-- | client/term_linux.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/client/term_linux.c b/client/term_linux.c new file mode 100644 index 0000000..2a88d6c --- /dev/null +++ b/client/term_linux.c @@ -0,0 +1,29 @@ +#ifdef W2_HOST_LINUX + +#include <fcntl.h> +#include <unistd.h> +#include <termios.h> +#include <sys/ioctl.h> + +#include "term.h" +#include "ui.h" + +void w2_term_raw_mode() { + fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK); + struct termios term; + tcgetattr(STDIN_FILENO, &term); + term.c_lflag &= ~(ECHO | ICANON); + term.c_cc[VTIME] = 0; + term.c_cc[VMIN] = 1; + tcsetattr(STDIN_FILENO, 0, &term); +} + +void w2_term_props() { + struct winsize window; + ioctl(STDOUT_FILENO, TIOCGWINSZ, &window); + + g_w2_ui_canvas.width = window.ws_col; + g_w2_ui_canvas.height = window.ws_row; +} + +#endif |