wlt: fix shl_hook API changes
[platform/upstream/kmscon.git] / src / tsm_vte.h
1 /*
2  * TSM - VT Emulator
3  *
4  * Copyright (c) 2011 David Herrmann <dh.herrmann@googlemail.com>
5  * Copyright (c) 2011 University of Tuebingen
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining
8  * a copy of this software and associated documentation files
9  * (the "Software"), to deal in the Software without restriction, including
10  * without limitation the rights to use, copy, modify, merge, publish,
11  * distribute, sublicense, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject to
13  * the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included
16  * in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  */
26
27 /*
28  * Virtual Terminal Emulator
29  * This is a vt100 implementation. It is written from scratch. It uses the
30  * screen state-machine as output and is tightly bound to it.
31  */
32
33 #ifndef TSM_VTE_H
34 #define TSM_VTE_H
35
36 #include <stdlib.h>
37 #include "tsm_screen.h"
38 #include "tsm_unicode.h"
39
40 /* available character sets */
41
42 typedef tsm_symbol_t tsm_vte_charset[96];
43
44 extern tsm_vte_charset tsm_vte_unicode_lower;
45 extern tsm_vte_charset tsm_vte_unicode_upper;
46 extern tsm_vte_charset tsm_vte_dec_supplemental_graphics;
47 extern tsm_vte_charset tsm_vte_dec_special_graphics;
48
49 /* virtual terminal emulator */
50
51 struct tsm_vte;
52
53 /* keep in sync with shl_xkb_mods */
54 enum tsm_vte_modifier {
55         TSM_SHIFT_MASK          = (1 << 0),
56         TSM_LOCK_MASK           = (1 << 1),
57         TSM_CONTROL_MASK        = (1 << 2),
58         TSM_ALT_MASK            = (1 << 3),
59         TSM_LOGO_MASK           = (1 << 4),
60 };
61
62 /* keep in sync with TSM_INPUT_INVALID */
63 #define TSM_VTE_INVALID 0xffffffff
64
65 typedef void (*tsm_vte_write_cb) (struct tsm_vte *vte,
66                                   const char *u8,
67                                   size_t len,
68                                   void *data);
69
70 int tsm_vte_new(struct tsm_vte **out, struct tsm_screen *con,
71                 tsm_vte_write_cb write_cb, void *data,
72                 tsm_log_t log);
73 void tsm_vte_ref(struct tsm_vte *vte);
74 void tsm_vte_unref(struct tsm_vte *vte);
75
76 int tsm_vte_set_palette(struct tsm_vte *vte, const char *palette);
77
78 void tsm_vte_reset(struct tsm_vte *vte);
79 void tsm_vte_hard_reset(struct tsm_vte *vte);
80 void tsm_vte_input(struct tsm_vte *vte, const char *u8, size_t len);
81 bool tsm_vte_handle_keyboard(struct tsm_vte *vte, uint32_t keysym,
82                              uint32_t ascii, unsigned int mods,
83                              uint32_t unicode);
84
85 #endif /* TSM_VTE_H */