commit 2b48f436ef0032ef2d395208be5a64fa97bbd5b8
parent d91e336c23b7bdae3cb7c93f3d645c965062c8e1
Author: Sophie <info@soophie.de>
Date: Sat, 22 Mar 2025 10:24:29 +0000
feat: Extended teleterm fetch params
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/libterm.h b/src/libterm.h
@@ -32,7 +32,7 @@ typedef enum {
} term_keycode_t;
typedef void (*term_dispatch_fn_t)(int fd, term_code_t code, void *data, size_t len);
-typedef void *(*term_fetch_fn_t)(int fd, term_code_t code, size_t len);
+typedef void *(*term_fetch_fn_t)(int fd, term_code_t code, void *data, size_t len, size_t ret_len);
typedef struct {
struct termios termios;
@@ -179,7 +179,7 @@ void term_flush(term_t *self) {
int term_read_cursor(term_t *self, size_t *rows, size_t *cols) {
if (self->teleterm_mode) {
- void *data = self->fetch(self->fd, TERM_CODE_CURSOR_READ, 2 * sizeof(size_t));
+ void *data = self->fetch(self->fd, TERM_CODE_CURSOR_READ, NULL, 0, 2 * sizeof(size_t));
if (data) {
size_t *tuple = (size_t *) data;
*rows = tuple[0];
@@ -215,7 +215,7 @@ int term_read_cursor(term_t *self, size_t *rows, size_t *cols) {
int term_read_window(term_t *self, size_t *rows, size_t *cols) {
if (self->teleterm_mode) {
- void *data = self->fetch(self->fd, TERM_CODE_WINDOW_READ, 2 * sizeof(size_t));
+ void *data = self->fetch(self->fd, TERM_CODE_WINDOW_READ, NULL, 0, 2 * sizeof(size_t));
if (data) {
size_t *tuple = (size_t *) data;
*rows = tuple[0];
@@ -241,7 +241,7 @@ int term_read_window(term_t *self, size_t *rows, size_t *cols) {
int term_read_key(term_t *self) {
if (self->teleterm_mode) {
- void *data = self->fetch(self->fd, TERM_CODE_KEY_READ, sizeof(int));
+ void *data = self->fetch(self->fd, TERM_CODE_KEY_READ, NULL, 0, sizeof(int));
if (data) {
int *single = (int *) data;
int key = *single;
@@ -321,7 +321,7 @@ int term_read_key(term_t *self) {
int term_poll_key(term_t *self, int timeout_ms) {
if (self->teleterm_mode) {
- void *data = self->fetch(self->fd, TERM_CODE_KEY_POLL, sizeof(int));
+ void *data = self->fetch(self->fd, TERM_CODE_KEY_POLL, &timeout_ms, sizeof(timeout_ms), sizeof(int));
if (data) {
int *single = (int *) data;
int key = *single;