From 1a66f5d069e4ccb600186918f716323aa7bae052 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Tue, 17 Jan 2023 22:49:31 +0100 Subject: add tctl and list --- lib/tctl/tctl.c | 18 ++++++++++++++++++ lib/tctl/tctl.h | 14 ++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 lib/tctl/tctl.c create mode 100644 lib/tctl/tctl.h (limited to 'lib/tctl') diff --git a/lib/tctl/tctl.c b/lib/tctl/tctl.c new file mode 100644 index 0000000..54034f4 --- /dev/null +++ b/lib/tctl/tctl.c @@ -0,0 +1,18 @@ +#include "tctl.h" +#include "../sys/ioctl.h" + +#define GET_WIN_SIZE 0x5413 +#define SET_WIN_SIZE 0x5414 + +window_size_t tctl_get_window_size() +{ + window_size_t ws; + ioctl(0, GET_WIN_SIZE, &ws); + return ws; +} + + +void tctl_set_window_size(window_size_t size) +{ + ioctl(0, SET_WIN_SIZE, &size); +} diff --git a/lib/tctl/tctl.h b/lib/tctl/tctl.h new file mode 100644 index 0000000..d106818 --- /dev/null +++ b/lib/tctl/tctl.h @@ -0,0 +1,14 @@ +#ifndef TCTL_H +#define TCTL_H + +typedef struct { + unsigned short int height; + unsigned short int width; + unsigned short int ws_xpixel; + unsigned short int ws_ypixel; +} window_size_t; + +window_size_t tctl_get_window_size(); +void tctl_set_window_size(window_size_t size); + +#endif -- cgit v1.2.3-70-g09d2