From 381e62b9128123d12294df4aeae5430cd62349e9 Mon Sep 17 00:00:00 2001 From: dam Date: Wed, 3 Jan 2024 17:38:38 +0000 Subject: Starting to implement windows specific procedures. --- TUI/unix.jai | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'TUI/unix.jai') diff --git a/TUI/unix.jai b/TUI/unix.jai index a35c2dc..dd53921 100644 --- a/TUI/unix.jai +++ b/TUI/unix.jai @@ -1,8 +1,8 @@ #scope_file #import "Atomics"; -#import "POSIX"; #import "System"; +#import "POSIX"; // Required to do unlocking input. libc :: #system_library "libc"; @@ -204,7 +204,6 @@ //////////////////////////////////////////////////////////////////////////////// // Resize detection -was_resized : bool; resize_handler :: (signal_code : s32) #c_call { new_context : Context; @@ -232,11 +231,6 @@ restore_resize_handler :: () { #scope_export -OS_flush_input :: inline () { - TCIFLUSH :: 0; // TODO Is this always zero in all systems? - tcflush(STDIN_FILENO, TCIFLUSH); -} - OS_prepare_terminal :: () { tcgetattr(STDIN_FILENO, *initial_tio_mode); // TODO Log error using `log()` from jai/modules/Basic/Print.jai ? raw_tio_mode = initial_tio_mode; @@ -258,6 +252,11 @@ OS_reset_terminal :: () { tcsetattr(STDIN_FILENO, 0, *initial_tio_mode); // TODO Log on error. } +OS_flush_input :: inline () { + TCIFLUSH :: 0; // TODO Is this always zero in all systems? + tcflush(STDIN_FILENO, TCIFLUSH); +} + OS_read_input :: (buffer: *u8, bytes_to_read: s64) -> bytes_read: s64, error: bool = false, error_message: string = "" { bytes_read := read(STDIN_FILENO, buffer, xx bytes_to_read); if bytes_read < 0 { -- cgit v1.2.3