npv:osd:smooth timer glyph rendering
[nyanmp.git] / npa / npa_config.h
blobd74be34648e52937dcee1554f57960f2603ede66
1 /*
2 * only basic esc seq soup for keyboard input, "ansi/ecma-48 + VTXXX + xterm"
3 * utf8 terminal configured for 2 bytes c1 codes, hence the csi is the esc
4 * ascii byte followed by the '[' ascii char. to account for any unknown esc
5 * seq, we have a global timeout.
6 * you have very good documentation on VTXXX (52/100/5xx) on the web, that
7 * to understand well what is a terminal and from "where" all that comes
8 * from.
9 *
10 * or 1 utf8 char (up to 4 bytes and not 6 like in legacy iso)
12 struct tty_bind_t {
13 u8 *c; /* utf8 char, up to 4 bytes, or esc seq */
14 u8 sz; /* size of whatever is c */
15 u8 *name; /* friendly name */
16 void (*cmd)(void); /* bound cmd */
18 #define INPUT_ESC_SEQ_TIMEOUT_SECS_N 1
19 #define TTY_BIND(x, y, z) {.c = x, .sz = (sizeof(x) - 1), .name = y, .cmd = z}
20 struct tty_bind_t tty_binds[] = {
21 TTY_BIND("q", "letter q", cmd_quit),
22 TTY_BIND("i", "letter i", cmd_info),
23 TTY_BIND("\x1b[D", "arrow left", cmd_rewind),
24 TTY_BIND("\x1b[C", "arrow right", cmd_fastforward),
25 TTY_BIND("\x1b[A", "arrow up", cmd_vol_up),
26 TTY_BIND("\x1b[B", "arrow down", cmd_vol_down),
27 TTY_BIND("]", "closing square bracket", cmd_vol_up_small),
28 TTY_BIND("[", "opening square bracket", cmd_vol_down_small),
29 TTY_BIND("\x1b[H", "home", cmd_rewind_big),
30 TTY_BIND("\x1b[4~", "end", cmd_fastforward_big),
31 TTY_BIND("m", "letter m", cmd_mute),
32 TTY_BIND(" ", "space", cmd_pause)
34 #undef TTY_BIND
36 #define VOL_DELTA 0.1 /* from 0.0 to 1.0 */
37 #define VOL_DELTA_SMALL 0.01 /* from 0.0 to 1.0 */
38 #define SEEK_DELTA INT64_C(10) /* 10 seconds */
39 #define SEEK_DELTA_BIG (INT64_C(4) * INT64_C(60)) /* 4 minutes */