mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-18 05:20:29 +00:00
start input, its broken but we're getting there
This commit is contained in:
@@ -14,8 +14,19 @@ extern "C" {
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Macros
|
||||
|
||||
#define GHOSTTY_SUCCESS 0
|
||||
|
||||
// Masks for input modifiers
|
||||
#define GHOSTTY_INPUT_SHIFT 1
|
||||
#define GHOSTTY_INPUT_CTRL 2
|
||||
#define GHOSTTY_INPUT_ALT 4
|
||||
#define GHOSTTY_INPUT_SUPER 8
|
||||
#define GHOSTTY_INPUT_CAPS 16
|
||||
#define GHOSTTY_INPUT_NUM 32
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Types
|
||||
|
||||
@@ -23,15 +34,153 @@ extern "C" {
|
||||
// structs. To find the Zig struct, grep for this type name. The documentation
|
||||
// for all of these types is available in the Zig source.
|
||||
typedef void (*ghostty_runtime_wakeup_cb)(void *);
|
||||
|
||||
typedef struct {
|
||||
void *userdata;
|
||||
ghostty_runtime_wakeup_cb wakeup_cb;
|
||||
} ghostty_runtime_config_s;
|
||||
|
||||
typedef struct {
|
||||
void *nsview;
|
||||
double scale_factor;
|
||||
} ghostty_surface_config_s;
|
||||
|
||||
typedef enum { release, press, repeat } ghostty_input_action_e;
|
||||
typedef enum {
|
||||
invalid,
|
||||
|
||||
// a-z
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
d,
|
||||
e,
|
||||
f,
|
||||
g,
|
||||
h,
|
||||
i,
|
||||
j,
|
||||
k,
|
||||
l,
|
||||
m,
|
||||
n,
|
||||
o,
|
||||
p,
|
||||
q,
|
||||
r,
|
||||
s,
|
||||
t,
|
||||
u,
|
||||
v,
|
||||
w,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
|
||||
// numbers
|
||||
zero,
|
||||
one,
|
||||
two,
|
||||
three,
|
||||
four,
|
||||
five,
|
||||
six,
|
||||
seven,
|
||||
eight,
|
||||
nine,
|
||||
|
||||
// puncuation
|
||||
semicolon,
|
||||
space,
|
||||
apostrophe,
|
||||
comma,
|
||||
grave_accent, // `
|
||||
period,
|
||||
slash,
|
||||
minus,
|
||||
equal,
|
||||
left_bracket, // [
|
||||
right_bracket, // ]
|
||||
backslash, // /
|
||||
|
||||
// control
|
||||
up,
|
||||
down,
|
||||
right,
|
||||
left,
|
||||
home,
|
||||
end,
|
||||
insert,
|
||||
delete,
|
||||
caps_lock,
|
||||
scroll_lock,
|
||||
num_lock,
|
||||
page_up,
|
||||
page_down,
|
||||
escape,
|
||||
enter,
|
||||
tab,
|
||||
backspace,
|
||||
print_screen,
|
||||
pause,
|
||||
|
||||
// function keys
|
||||
f1,
|
||||
f2,
|
||||
f3,
|
||||
f4,
|
||||
f5,
|
||||
f6,
|
||||
f7,
|
||||
f8,
|
||||
f9,
|
||||
f10,
|
||||
f11,
|
||||
f12,
|
||||
f13,
|
||||
f14,
|
||||
f15,
|
||||
f16,
|
||||
f17,
|
||||
f18,
|
||||
f19,
|
||||
f20,
|
||||
f21,
|
||||
f22,
|
||||
f23,
|
||||
f24,
|
||||
f25,
|
||||
|
||||
// keypad
|
||||
kp_0,
|
||||
kp_1,
|
||||
kp_2,
|
||||
kp_3,
|
||||
kp_4,
|
||||
kp_5,
|
||||
kp_6,
|
||||
kp_7,
|
||||
kp_8,
|
||||
kp_9,
|
||||
kp_decimal,
|
||||
kp_divide,
|
||||
kp_multiply,
|
||||
kp_subtract,
|
||||
kp_add,
|
||||
kp_enter,
|
||||
kp_equal,
|
||||
|
||||
// modifiers
|
||||
left_shift,
|
||||
left_control,
|
||||
left_alt,
|
||||
left_super,
|
||||
right_shift,
|
||||
right_control,
|
||||
right_alt,
|
||||
right_super,
|
||||
} ghostty_input_key_e;
|
||||
|
||||
// Opaque types
|
||||
typedef void *ghostty_app_t;
|
||||
typedef void *ghostty_config_t;
|
||||
@@ -56,6 +205,7 @@ void ghostty_surface_free(ghostty_surface_t);
|
||||
void ghostty_surface_refresh(ghostty_surface_t);
|
||||
void ghostty_surface_set_content_scale(ghostty_surface_t, double, double);
|
||||
void ghostty_surface_set_size(ghostty_surface_t, uint32_t, uint32_t);
|
||||
void ghostty_surface_key(ghostty_surface_t, ghostty_input_action_e, ghostty_input_key_e, uint8_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user