Notcurses 3.0.13
a blingful library for TUIs and character graphics
Loading...
Searching...
No Matches
in.h
Go to the documentation of this file.
1#ifndef NOTCURSES_IN
2#define NOTCURSES_IN
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8// internal header, not installed
9
10#include <stdio.h>
11
12struct tinfo;
13struct inputctx;
14struct ncsharedstats;
15
16int init_inputlayer(struct tinfo* ti, FILE* infp, int lmargin, int tmargin,
17 int rmargin, int bmargin, struct ncsharedstats* stats,
18 unsigned drain, int linesigs_enabled)
19 __attribute__ ((nonnull (1, 2, 7)));
20
21int stop_inputlayer(struct tinfo* ti);
22
23int inputready_fd(const struct inputctx* ictx)
24 __attribute__ ((nonnull (1)));
25
26// allow another source provide raw input for distribution to client code.
27// drops input if there is no room in appropriate output queue.
28int ncinput_shovel(struct inputctx* ictx, const void* buf, int len)
29 __attribute__ ((nonnull (1, 2)));
30
31typedef enum {
32 TERMINAL_UNKNOWN, // no useful information from queries; use termname
33 // the very limited linux VGA/serial console, or possibly the (deprecated,
34 // pixel-drawable, RGBA8888) linux framebuffer console. *not* fbterm.
35 TERMINAL_LINUX, // ioctl()s
36 // the linux KMS/DRM console, *not* kmscon, but DRM direct dumb buffers
37 TERMINAL_LINUXDRM, // ioctl()s
38 TERMINAL_XTERM, // XTVERSION == 'XTerm(ver)'
39 TERMINAL_VTE, // TDA: "~VTE"
40 TERMINAL_KITTY, // XTGETTCAP['TN'] == 'xterm-kitty'
41 TERMINAL_FOOT, // TDA: "\EP!|464f4f54\E\\"
42 TERMINAL_MLTERM, // XTGETTCAP['TN'] == 'mlterm'
43 TERMINAL_TMUX, // XTVERSION == "tmux ver"
44 TERMINAL_GNUSCREEN, // SDA: "83;ver;0c"
45 TERMINAL_WEZTERM, // XTVERSION == 'WezTerm *'
46 TERMINAL_ALACRITTY, // can't be detected; match TERM+SDA
47 TERMINAL_CONTOUR, // XTVERSION == 'contour ver'
48 TERMINAL_ITERM, // XTVERSION == 'iTerm2 [ver]'
49 TERMINAL_TERMINOLOGY, // TDA: "~~TY"
50 TERMINAL_APPLE, // Terminal.App, determined by TERM_PROGRAM + macOS
51 TERMINAL_RXVT, // rxvt/urxvt, determined by TERM + UNIX
52 TERMINAL_MSTERMINAL, // Microsoft Windows Terminal
53 TERMINAL_MINTTY, // XTVERSION == 'mintty ver' MinTTY (Cygwin, MSYS2)
54 TERMINAL_KONSOLE, // TDA: "~KDE" (7e4b4445)
56
57// after spawning the input layer, send initial queries to the terminal. its
58// responses will be built up herein. it's dangerous to go alone! take this!
60 int cursory; // cursor location, -1 for none
61 int cursorx; // cursor location, -1 for none
62 unsigned appsync_supported; // is application-synchronized mode supported?
63 queried_terminals_e qterm; // determined terminal
64 unsigned kitty_graphics; // kitty graphics supported
65 uint32_t bg; // default background
66 uint32_t fg; // default foreground
67 bool got_bg; // have we read default background?
68 bool got_fg; // have we read default foreground?
69 bool rgb; // was RGB DirectColor advertised?
70 bool rectangular_edits; // were rectangular edits advertised?
71 int pixx; // screen geometry in pixels
72 int pixy; // screen geometry in pixels
73 int dimx; // screen geometry in cells
74 int dimy; // screen geometry in cells
75 // these next three might be set even if there is no actual Sixel support
76 // (see e.g. XTerm prior to 370). we determine whether there is Sixel
77 // support by checking the DA1 attributes, and scrub them if necessary.
78 int color_registers; // sixel color registers
79 int sixely; // maximum sixel height
80 int sixelx; // maximum sixel width
81 char* version; // version string, heap-allocated
82 unsigned kbdlevel; // enabled kitty keyboard functions
83 ncpalette palette; // palette entries
84 int maxpaletteread; // maximum palette index read
85 bool pixelmice; // have we pixel-based mice events?
86 char* hpa; // control sequence for hpa via XTGETTCAP
87};
88
89// Blocking call. Waits until the input thread has processed all responses to
90// our initial queries, and returns them.
92 __attribute__ ((nonnull (1)));
93
94int get_cursor_location(struct inputctx* ictx, const char* u7, unsigned* y, unsigned* x)
95 __attribute__ ((nonnull (1, 2)));
96
97#ifdef __cplusplus
98}
99#endif
100
101#endif
__attribute__((nonnull(1, 2))) static inline int egcpool_stash(egcpool *pool
int inputready_fd(const struct inputctx *ictx) __attribute__((nonnull(1)))
int ncinput_shovel(struct inputctx *ictx, const void *buf, int len) __attribute__((nonnull(1
int get_cursor_location(struct inputctx *ictx, const char *u7, unsigned *y, unsigned *x) __attribute__((nonnull(1
int init_inputlayer(struct tinfo *ti, FILE *infp, int lmargin, int tmargin, int rmargin, int bmargin, struct ncsharedstats *stats, unsigned drain, int linesigs_enabled) __attribute__((nonnull(1
struct initial_responses * inputlayer_get_responses(struct inputctx *ictx) __attribute__((nonnull(1)))
Definition in.c:2896
int int stop_inputlayer(struct tinfo *ti)
Definition in.c:2644
queried_terminals_e
Definition in.h:31
@ TERMINAL_XTERM
Definition in.h:38
@ TERMINAL_LINUX
Definition in.h:35
@ TERMINAL_CONTOUR
Definition in.h:47
@ TERMINAL_APPLE
Definition in.h:50
@ TERMINAL_UNKNOWN
Definition in.h:32
@ TERMINAL_ALACRITTY
Definition in.h:46
@ TERMINAL_GNUSCREEN
Definition in.h:44
@ TERMINAL_TERMINOLOGY
Definition in.h:49
@ TERMINAL_LINUXDRM
Definition in.h:37
@ TERMINAL_MSTERMINAL
Definition in.h:52
@ TERMINAL_RXVT
Definition in.h:51
@ TERMINAL_KONSOLE
Definition in.h:54
@ TERMINAL_MLTERM
Definition in.h:42
@ TERMINAL_KITTY
Definition in.h:40
@ TERMINAL_MINTTY
Definition in.h:53
@ TERMINAL_ITERM
Definition in.h:48
@ TERMINAL_WEZTERM
Definition in.h:45
@ TERMINAL_VTE
Definition in.h:39
@ TERMINAL_FOOT
Definition in.h:41
@ TERMINAL_TMUX
Definition in.h:43
int y
Definition notcurses.h:1905
int int x
Definition notcurses.h:1905
API int API int const nccell unsigned len
Definition notcurses.h:2588
queried_terminals_e qterm
Definition in.h:63
int maxpaletteread
Definition in.h:84
unsigned appsync_supported
Definition in.h:62
ncpalette palette
Definition in.h:83
bool pixelmice
Definition in.h:85
unsigned kbdlevel
Definition in.h:82
bool rectangular_edits
Definition in.h:70
char * version
Definition in.h:81
unsigned kitty_graphics
Definition in.h:64
int cursorx
Definition in.h:61
int cursory
Definition in.h:60
uint32_t fg
Definition in.h:66
bool got_fg
Definition in.h:68
bool got_bg
Definition in.h:67
uint32_t bg
Definition in.h:65
char * hpa
Definition in.h:86
int color_registers
Definition in.h:78
Definition in.c:52