merge
commit
e4a50f0143
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,84 @@
|
||||
#ifndef NOTCURSES_IN
|
||||
#define NOTCURSES_IN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// internal header, not installed
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
struct tinfo;
|
||||
struct inputctx;
|
||||
struct ncsharedstats;
|
||||
|
||||
int init_inputlayer(struct tinfo* ti, FILE* infp, int lmargin, int tmargin,
|
||||
struct ncsharedstats* stats, unsigned drain)
|
||||
__attribute__ ((nonnull (1, 2, 5)));
|
||||
|
||||
int stop_inputlayer(struct tinfo* ti);
|
||||
|
||||
int inputready_fd(const struct inputctx* ictx)
|
||||
__attribute__ ((nonnull (1)));
|
||||
|
||||
// allow another source provide raw input for distribution to client code.
|
||||
// drops input if there is no room in appropriate output queue.
|
||||
int ncinput_shovel(struct inputctx* ictx, const void* buf, int len)
|
||||
__attribute__ ((nonnull (1, 2)));
|
||||
|
||||
typedef enum {
|
||||
TERMINAL_UNKNOWN, // no useful information from queries; use termname
|
||||
// the very limited linux VGA/serial console, or possibly the (deprecated,
|
||||
// pixel-drawable, RGBA8888) linux framebuffer console. *not* fbterm.
|
||||
TERMINAL_LINUX, // ioctl()s
|
||||
// the linux KMS/DRM console, *not* kmscon, but DRM direct dumb buffers
|
||||
TERMINAL_LINUXDRM, // ioctl()s
|
||||
TERMINAL_XTERM, // XTVERSION == 'XTerm(ver)'
|
||||
TERMINAL_VTE, // TDA: "~VTE"
|
||||
TERMINAL_KITTY, // XTGETTCAP['TN'] == 'xterm-kitty'
|
||||
TERMINAL_FOOT, // TDA: "\EP!|464f4f54\E\\"
|
||||
TERMINAL_MLTERM, // XTGETTCAP['TN'] == 'mlterm'
|
||||
TERMINAL_TMUX, // XTVERSION == "tmux ver"
|
||||
TERMINAL_WEZTERM, // XTVERSION == 'WezTerm *'
|
||||
TERMINAL_ALACRITTY, // can't be detected; match TERM+DA2
|
||||
TERMINAL_CONTOUR, // XTVERSION == 'contour ver'
|
||||
TERMINAL_ITERM, // XTVERSION == 'iTerm2 [ver]'
|
||||
TERMINAL_TERMINOLOGY, // TDA: "~~TY"
|
||||
TERMINAL_APPLE, // Terminal.App, determined by TERM_PROGRAM + macOS
|
||||
TERMINAL_MSTERMINAL, // Microsoft Windows Terminal
|
||||
TERMINAL_MINTTY, // XTVERSION == 'mintty ver' MinTTY (Cygwin, MSYS2)
|
||||
} queried_terminals_e;
|
||||
|
||||
// after spawning the input layer, send initial queries to the terminal. its
|
||||
// responses will be built up herein. it's dangerous to go alone! take this!
|
||||
struct initial_responses {
|
||||
int cursory; // cursor location
|
||||
int cursorx; // cursor location
|
||||
unsigned appsync_supported; // is application-synchronized mode supported?
|
||||
queried_terminals_e qterm; // determined terminal
|
||||
unsigned kitty_graphics; // kitty graphics supported
|
||||
uint32_t bg; // default background
|
||||
int pixx; // screen geometry in pixels
|
||||
int pixy; // screen geometry in pixels
|
||||
int dimx; // screen geometry in cells
|
||||
int dimy; // screen geometry in cells
|
||||
int color_registers; // sixel color registers
|
||||
int sixely; // maximum sixel height
|
||||
int sixelx; // maximum sixel width
|
||||
char* version; // version string, heap-allocated
|
||||
};
|
||||
|
||||
// Blocking call. Waits until the input thread has processed all responses to
|
||||
// our initial queries, and returns them.
|
||||
struct initial_responses* inputlayer_get_responses(struct inputctx* ictx)
|
||||
__attribute__ ((nonnull (1)));
|
||||
|
||||
int get_cursor_location(struct inputctx* ictx, int* y, int* x)
|
||||
__attribute__ ((nonnull (1)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,69 +0,0 @@
|
||||
#ifndef NOTCURSES_INPUT
|
||||
#define NOTCURSES_INPUT
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// internal header, not installed
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
struct tinfo;
|
||||
struct termios;
|
||||
struct ncinputlayer;
|
||||
struct ncsharedstats;
|
||||
|
||||
typedef enum {
|
||||
TERMINAL_UNKNOWN, // no useful information from queries; use termname
|
||||
// the very limited linux VGA/serial console, or possibly the (deprecated,
|
||||
// pixel-drawable, RGBA8888) linux framebuffer console. *not* fbterm.
|
||||
TERMINAL_LINUX, // ioctl()s
|
||||
// the linux KMS/DRM console, *not* kmscon, but DRM direct dumb buffers
|
||||
TERMINAL_LINUXDRM, // ioctl()s
|
||||
TERMINAL_XTERM, // XTVERSION == 'XTerm(ver)'
|
||||
TERMINAL_VTE, // TDA: "~VTE"
|
||||
TERMINAL_KITTY, // XTGETTCAP['TN'] == 'xterm-kitty'
|
||||
TERMINAL_FOOT, // TDA: "\EP!|464f4f54\E\\"
|
||||
TERMINAL_MLTERM, // XTGETTCAP['TN'] == 'mlterm'
|
||||
TERMINAL_TMUX, // XTVERSION == "tmux ver"
|
||||
TERMINAL_WEZTERM, // XTVERSION == 'WezTerm *'
|
||||
TERMINAL_ALACRITTY, // can't be detected; match TERM+DA2
|
||||
TERMINAL_CONTOUR, // XTVERSION == 'contour ver'
|
||||
TERMINAL_ITERM, // XTVERSION == 'iTerm2 [ver]'
|
||||
TERMINAL_TERMINOLOGY, // TDA: "~~TY"
|
||||
TERMINAL_APPLE, // Terminal.App, determined by TERM_PROGRAM + macOS
|
||||
TERMINAL_MSTERMINAL, // Microsoft Windows Terminal
|
||||
TERMINAL_MINTTY, // XTVERSION == 'mintty ver' MinTTY (Cygwin, MSYS2)
|
||||
} queried_terminals_e;
|
||||
|
||||
// sets up the input layer, building a trie of escape sequences and their
|
||||
// nckey equivalents. if we are connected to a tty, this also completes the
|
||||
// terminal detection sequence (we ought have already written our initial
|
||||
// queries, ideally as early as possible). if we are able to determine the
|
||||
// terminal conclusively, it will be written to |detected|. if the terminal
|
||||
// advertised support for application-sychronized updates, |appsync| will be
|
||||
// non-zero.
|
||||
int ncinputlayer_init(struct tinfo* tcache, FILE* infp,
|
||||
queried_terminals_e* detected, unsigned* appsync,
|
||||
int* cursor_y, int* cursor_x,
|
||||
struct ncsharedstats* stats,
|
||||
unsigned* kittygraphs);
|
||||
|
||||
void ncinputlayer_stop(struct ncinputlayer* nilayer);
|
||||
|
||||
// FIXME absorb into ncinputlayer_init()
|
||||
int cbreak_mode(struct tinfo* ti);
|
||||
|
||||
// assuming the user context is not active, go through current data looking
|
||||
// for a cursor location report. if we find none, block on input, and read if
|
||||
// appropriate. we can be interrupted by a new user context.
|
||||
void ncinput_extract_clrs(struct tinfo* ti);
|
||||
|
||||
int ncinput_shovel(struct ncinputlayer* ni, const char* buf, size_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue