libghostty-vt
0.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
key/encoder.h
Go to the documentation of this file.
1
6
7
#ifndef GHOSTTY_VT_KEY_ENCODER_H
8
#define GHOSTTY_VT_KEY_ENCODER_H
9
10
#include <stddef.h>
11
#include <stdint.h>
12
#include <
ghostty/vt/types.h
>
13
#include <
ghostty/vt/allocator.h
>
14
#include <
ghostty/vt/terminal.h
>
15
#include <
ghostty/vt/key/event.h
>
16
25
typedef
struct
GhosttyKeyEncoderImpl *
GhosttyKeyEncoder
;
26
36
typedef
uint8_t
GhosttyKittyKeyFlags
;
37
39
#define GHOSTTY_KITTY_KEY_DISABLED 0
40
42
#define GHOSTTY_KITTY_KEY_DISAMBIGUATE (1 << 0)
43
45
#define GHOSTTY_KITTY_KEY_REPORT_EVENTS (1 << 1)
46
48
#define GHOSTTY_KITTY_KEY_REPORT_ALTERNATES (1 << 2)
49
51
#define GHOSTTY_KITTY_KEY_REPORT_ALL (1 << 3)
52
54
#define GHOSTTY_KITTY_KEY_REPORT_ASSOCIATED (1 << 4)
55
57
#define GHOSTTY_KITTY_KEY_ALL (GHOSTTY_KITTY_KEY_DISAMBIGUATE | GHOSTTY_KITTY_KEY_REPORT_EVENTS | GHOSTTY_KITTY_KEY_REPORT_ALTERNATES | GHOSTTY_KITTY_KEY_REPORT_ALL | GHOSTTY_KITTY_KEY_REPORT_ASSOCIATED)
58
67
typedef
enum
GHOSTTY_ENUM_TYPED
{
69
GHOSTTY_OPTION_AS_ALT_FALSE
= 0,
71
GHOSTTY_OPTION_AS_ALT_TRUE
= 1,
73
GHOSTTY_OPTION_AS_ALT_LEFT
= 2,
75
GHOSTTY_OPTION_AS_ALT_RIGHT
= 3,
76
GHOSTTY_OPTION_AS_ALT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
77
}
GhosttyOptionAsAlt
;
78
87
typedef
enum
GHOSTTY_ENUM_TYPED
{
93
GHOSTTY_KEY_ENCODER_OPT_INVALID
= 0,
94
97
GHOSTTY_KEY_ENCODER_OPT_CURSOR_KEY_APPLICATION
= 1,
98
101
GHOSTTY_KEY_ENCODER_OPT_KEYPAD_KEY_APPLICATION
= 2,
102
105
GHOSTTY_KEY_ENCODER_OPT_IGNORE_KEYPAD_WITH_NUMLOCK
= 3,
106
109
GHOSTTY_KEY_ENCODER_OPT_ALT_ESC_PREFIX
= 4,
110
112
GHOSTTY_KEY_ENCODER_OPT_MODIFY_OTHER_KEYS_STATE_2
= 5,
113
116
GHOSTTY_KEY_ENCODER_OPT_KITTY_FLAGS
= 6,
117
120
GHOSTTY_KEY_ENCODER_OPT_MACOS_OPTION_AS_ALT
= 7,
121
127
GHOSTTY_KEY_ENCODER_OPT_BACKARROW_KEY_MODE
= 8,
128
129
GHOSTTY_KEY_ENCODER_OPT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
130
}
GhosttyKeyEncoderOption
;
131
145
GHOSTTY_API
GhosttyResult
ghostty_key_encoder_new
(
const
GhosttyAllocator
*allocator,
GhosttyKeyEncoder
*encoder);
146
157
GHOSTTY_API
void
ghostty_key_encoder_free
(
GhosttyKeyEncoder
encoder);
158
196
GHOSTTY_API
GhosttyResult
ghostty_key_encoder_set
(
GhosttyKeyEncoder
encoder,
GhosttyKeyEncoderOption
option,
const
void
*value);
197
218
GHOSTTY_API
GhosttyResult
ghostty_key_encoder_set_from_terminal
(
GhosttyKeyEncoder
encoder,
GhosttyTerminal
terminal);
219
294
GHOSTTY_API
GhosttyResult
ghostty_key_encoder_encode
(
GhosttyKeyEncoder
encoder,
GhosttyKeyEvent
event, uint8_t *buf,
size_t
buf_len,
size_t
*out_written);
295
296
#endif
/* GHOSTTY_VT_KEY_ENCODER_H */
allocator.h
GhosttyResult
GhosttyResult
Definition
types.h:143
GHOSTTY_ENUM_TYPED
#define GHOSTTY_ENUM_TYPED
Definition
types.h:124
ghostty_key_encoder_set_from_terminal
GHOSTTY_API GhosttyResult ghostty_key_encoder_set_from_terminal(GhosttyKeyEncoder encoder, GhosttyTerminal terminal)
GhosttyKeyEncoder
struct GhosttyKeyEncoderImpl * GhosttyKeyEncoder
Definition
key/encoder.h:25
GhosttyKittyKeyFlags
uint8_t GhosttyKittyKeyFlags
Definition
key/encoder.h:36
GhosttyKeyEncoderOption
GhosttyKeyEncoderOption
Definition
key/encoder.h:87
GhosttyKeyEvent
struct GhosttyKeyEventImpl * GhosttyKeyEvent
Definition
key/event.h:24
ghostty_key_encoder_set
GHOSTTY_API GhosttyResult ghostty_key_encoder_set(GhosttyKeyEncoder encoder, GhosttyKeyEncoderOption option, const void *value)
GhosttyOptionAsAlt
GhosttyOptionAsAlt
Definition
key/encoder.h:67
ghostty_key_encoder_new
GHOSTTY_API GhosttyResult ghostty_key_encoder_new(const GhosttyAllocator *allocator, GhosttyKeyEncoder *encoder)
ghostty_key_encoder_free
GHOSTTY_API void ghostty_key_encoder_free(GhosttyKeyEncoder encoder)
ghostty_key_encoder_encode
GHOSTTY_API GhosttyResult ghostty_key_encoder_encode(GhosttyKeyEncoder encoder, GhosttyKeyEvent event, uint8_t *buf, size_t buf_len, size_t *out_written)
GHOSTTY_KEY_ENCODER_OPT_IGNORE_KEYPAD_WITH_NUMLOCK
@ GHOSTTY_KEY_ENCODER_OPT_IGNORE_KEYPAD_WITH_NUMLOCK
Definition
key/encoder.h:105
GHOSTTY_KEY_ENCODER_OPT_KITTY_FLAGS
@ GHOSTTY_KEY_ENCODER_OPT_KITTY_FLAGS
Definition
key/encoder.h:116
GHOSTTY_KEY_ENCODER_OPT_CURSOR_KEY_APPLICATION
@ GHOSTTY_KEY_ENCODER_OPT_CURSOR_KEY_APPLICATION
Definition
key/encoder.h:97
GHOSTTY_KEY_ENCODER_OPT_ALT_ESC_PREFIX
@ GHOSTTY_KEY_ENCODER_OPT_ALT_ESC_PREFIX
Definition
key/encoder.h:109
GHOSTTY_KEY_ENCODER_OPT_KEYPAD_KEY_APPLICATION
@ GHOSTTY_KEY_ENCODER_OPT_KEYPAD_KEY_APPLICATION
Definition
key/encoder.h:101
GHOSTTY_KEY_ENCODER_OPT_MODIFY_OTHER_KEYS_STATE_2
@ GHOSTTY_KEY_ENCODER_OPT_MODIFY_OTHER_KEYS_STATE_2
Definition
key/encoder.h:112
GHOSTTY_KEY_ENCODER_OPT_MACOS_OPTION_AS_ALT
@ GHOSTTY_KEY_ENCODER_OPT_MACOS_OPTION_AS_ALT
Definition
key/encoder.h:120
GHOSTTY_KEY_ENCODER_OPT_INVALID
@ GHOSTTY_KEY_ENCODER_OPT_INVALID
Definition
key/encoder.h:93
GHOSTTY_KEY_ENCODER_OPT_BACKARROW_KEY_MODE
@ GHOSTTY_KEY_ENCODER_OPT_BACKARROW_KEY_MODE
Definition
key/encoder.h:127
GHOSTTY_OPTION_AS_ALT_FALSE
@ GHOSTTY_OPTION_AS_ALT_FALSE
Definition
key/encoder.h:69
GHOSTTY_OPTION_AS_ALT_TRUE
@ GHOSTTY_OPTION_AS_ALT_TRUE
Definition
key/encoder.h:71
GHOSTTY_OPTION_AS_ALT_LEFT
@ GHOSTTY_OPTION_AS_ALT_LEFT
Definition
key/encoder.h:73
GHOSTTY_OPTION_AS_ALT_RIGHT
@ GHOSTTY_OPTION_AS_ALT_RIGHT
Definition
key/encoder.h:75
GhosttyTerminal
struct GhosttyTerminalImpl * GhosttyTerminal
Definition
types.h:196
event.h
GhosttyAllocator
Definition
allocator.h:164
terminal.h
types.h
include
ghostty
vt
key
encoder.h
Generated by
1.17.0