hide <ncursesw/ncurses.h> behind ncrswrap.*

isolate ct_dims implementation to dims.*
This commit is contained in:
Emile Clark-Boman 2025-09-13 12:44:58 +10:00
parent 1dd5dd79c8
commit b04f0b4aa3
8 changed files with 142 additions and 113 deletions

View file

@ -1,8 +1,11 @@
#ifndef CURSETREE_NCRSWRAP_H
#define CURSETREE_NCRSWRAP_H
/* libncurses with wide-character support. */
#include <ncursesw/ncurses.h>
#include "dims.h"
# ifndef __NCURSES_H
typedef struct _win_st WINDOW;
# endif /* __NCURSES_H */
enum crs_termmode {
/* tty cbreak mode */
@ -15,13 +18,22 @@ enum crs_termmode {
TMODE_NORAW,
};
#define termsize(width, height) (width=COLS); (height=LINES)
int termmode(const enum crs_termmode mode);
void termsize(int *const width, int *const height);
void init_ncurses(void);
WINDOW *new_window(const int x, const int y, const int width, const int height);
WINDOW *root_window(void);
WINDOW *new_window_fs(void);
void destroy_window(WINDOW *);
#define winpos(win, x, y) (x = winposx(win), y = winposy(win))
#define winsize(win, width, height) (width = winwidth(win), height=winheight(win))
int winposx(WINDOW *const);
int winposy(WINDOW *const);
int winwidth(WINDOW *const);
int winheight(WINDOW *const);
struct ct_dims *windims(WINDOW *win);
int resizemv_window(const int x, const int y, const int width, const int height,
WINDOW *const win);