libghostty
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>
14#include <ghostty/vt/terminal.h>
16
25typedef struct GhosttyKeyEncoderImpl *GhosttyKeyEncoder;
26
36typedef 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
67typedef enum GHOSTTY_ENUM_TYPED {
76 GHOSTTY_OPTION_AS_ALT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
78
87typedef enum GHOSTTY_ENUM_TYPED {
90
93
96
99
102
105
108
115
116 GHOSTTY_KEY_ENCODER_OPT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
118
133
145
167GHOSTTY_API void ghostty_key_encoder_setopt(GhosttyKeyEncoder encoder, GhosttyKeyEncoderOption option, const void *value);
168
187
253GHOSTTY_API GhosttyResult ghostty_key_encoder_encode(GhosttyKeyEncoder encoder, GhosttyKeyEvent event, char *out_buf, size_t out_buf_size, size_t *out_len);
254
255#endif /* GHOSTTY_VT_KEY_ENCODER_H */
struct GhosttyKeyEncoderImpl * GhosttyKeyEncoder
Definition key/encoder.h:25
uint8_t GhosttyKittyKeyFlags
Definition key/encoder.h:36
GHOSTTY_API GhosttyResult ghostty_key_encoder_encode(GhosttyKeyEncoder encoder, GhosttyKeyEvent event, char *out_buf, size_t out_buf_size, size_t *out_len)
GHOSTTY_API void ghostty_key_encoder_setopt_from_terminal(GhosttyKeyEncoder encoder, GhosttyTerminal terminal)
GHOSTTY_API void ghostty_key_encoder_setopt(GhosttyKeyEncoder encoder, GhosttyKeyEncoderOption option, const void *value)
GhosttyKeyEncoderOption
Definition key/encoder.h:87
struct GhosttyKeyEventImpl * GhosttyKeyEvent
Definition key/event.h:24
GhosttyOptionAsAlt
Definition key/encoder.h:67
GHOSTTY_API GhosttyResult ghostty_key_encoder_new(const GhosttyAllocator *allocator, GhosttyKeyEncoder *encoder)
GHOSTTY_API void ghostty_key_encoder_free(GhosttyKeyEncoder encoder)
@ GHOSTTY_KEY_ENCODER_OPT_IGNORE_KEYPAD_WITH_NUMLOCK
Definition key/encoder.h:95
@ GHOSTTY_KEY_ENCODER_OPT_KITTY_FLAGS
@ GHOSTTY_KEY_ENCODER_OPT_CURSOR_KEY_APPLICATION
Definition key/encoder.h:89
@ GHOSTTY_KEY_ENCODER_OPT_ALT_ESC_PREFIX
Definition key/encoder.h:98
@ GHOSTTY_KEY_ENCODER_OPT_KEYPAD_KEY_APPLICATION
Definition key/encoder.h:92
@ GHOSTTY_KEY_ENCODER_OPT_MODIFY_OTHER_KEYS_STATE_2
@ GHOSTTY_KEY_ENCODER_OPT_MACOS_OPTION_AS_ALT
@ GHOSTTY_KEY_ENCODER_OPT_BACKARROW_KEY_MODE
@ GHOSTTY_OPTION_AS_ALT_FALSE
Definition key/encoder.h:69
@ GHOSTTY_OPTION_AS_ALT_TRUE
Definition key/encoder.h:71
@ GHOSTTY_OPTION_AS_ALT_LEFT
Definition key/encoder.h:73
@ GHOSTTY_OPTION_AS_ALT_RIGHT
Definition key/encoder.h:75
struct GhosttyTerminalImpl * GhosttyTerminal
Definition types.h:95
GhosttyResult
Definition types.h:74
#define GHOSTTY_ENUM_TYPED
Definition types.h:67