Download
jcs
/subtext
/console.h
(View History)
jcs focusable: Introduce focusable objects | Latest amendment: 55 on 2022-01-18 |
1 | /* |
2 | * Copyright (c) 2021 joshua stein <jcs@jcs.org> |
3 | * |
4 | * Permission to use, copy, modify, and distribute this software for any |
5 | * purpose with or without fee is hereby granted, provided that the above |
6 | * copyright notice and this permission notice appear in all copies. |
7 | * |
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ |
16 | |
17 | #ifndef __CONSOLE_H__ |
18 | #define __CONSOLE_H__ |
19 | |
20 | #include "session.h" |
21 | |
22 | struct console { |
23 | short state; |
24 | WindowPtr win; |
25 | ControlHandle scroller; |
26 | short nlines; |
27 | short ncolumns; |
28 | char chars[DEFAULT_TERMINAL_COLUMNS * DEFAULT_TERMINAL_LINES]; |
29 | unsigned char attrs[DEFAULT_TERMINAL_COLUMNS * DEFAULT_TERMINAL_LINES]; |
30 | unsigned char cur_attr; |
31 | #define ATTR_BOLD (1 << 0) |
32 | #define ATTR_REVERSE (1 << 1) |
33 | #define ATTR_UNDERLINE (1 << 2) |
34 | #define ATTR_CURSOR (1 << 6) |
35 | #define ATTR_DIRTY (1 << 7) |
36 | short cursor_line; |
37 | short cursor_column; |
38 | short saved_cursor_line; |
39 | short saved_cursor_column; |
40 | short in_csi; |
41 | short csilen; |
42 | char csi[32]; |
43 | struct session *session; |
44 | struct focusable *focusable; |
45 | }; |
46 | |
47 | struct console *console_init(void); |
48 | |
49 | void console_close_from_session(struct session *session); |
50 | short console_output(struct session *session); |
51 | short console_input(struct session *session); |
52 | short console_read(struct session *session); |
53 | |
54 | #endif /* __CONSOLE_H__ */ |