macos: change focus callback to use an enum so we can get other dirs

This commit is contained in:
Mitchell Hashimoto
2023-03-11 17:44:00 -08:00
parent 18cf0dc9fc
commit 04c38ef3b0
8 changed files with 70 additions and 56 deletions

View File

@@ -32,8 +32,7 @@ typedef const char* (*ghostty_runtime_read_clipboard_cb)(void *);
typedef void (*ghostty_runtime_write_clipboard_cb)(void *, const char *);
typedef void (*ghostty_runtime_new_split_cb)(void *, ghostty_split_direction_e);
typedef void (*ghostty_runtime_close_surface_cb)(void *);
typedef void (*ghostty_runtime_focus_next_split_cb)(void *);
typedef void (*ghostty_runtime_focus_previous_split_cb)(void *);
typedef void (*ghostty_runtime_focus_split_cb)(void *, ghostty_split_focus_direction_e);
typedef struct {
void *userdata;
@@ -43,8 +42,7 @@ typedef struct {
ghostty_runtime_write_clipboard_cb write_clipboard_cb;
ghostty_runtime_new_split_cb new_split_cb;
ghostty_runtime_close_surface_cb close_surface_cb;
ghostty_runtime_focus_next_split_cb focus_next_split_cb;
ghostty_runtime_focus_previous_split_cb focus_previous_split_cb;
ghostty_runtime_focus_split_cb focus_split_cb;
} ghostty_runtime_config_s;
typedef struct {
@@ -58,6 +56,15 @@ typedef enum {
GHOSTTY_SPLIT_DOWN
} ghostty_split_direction_e;
typedef enum {
GHOSTTY_SPLIT_FOCUS_PREVIOUS,
GHOSTTY_SPLIT_FOCUS_NEXT,
GHOSTTY_SPLIT_FOCUS_TOP,
GHOSTTY_SPLIT_FOCUS_LEFT,
GHOSTTY_SPLIT_FOCUS_BOTTOM,
GHOSTTY_SPLIT_FOCUS_RIGHT,
} ghostty_split_focus_direction_e;
typedef enum {
GHOSTTY_MOUSE_RELEASE,
GHOSTTY_MOUSE_PRESS,
@@ -258,8 +265,7 @@ void ghostty_surface_mouse_scroll(ghostty_surface_t, double, double);
void ghostty_surface_ime_point(ghostty_surface_t, double *, double *);
void ghostty_surface_request_close(ghostty_surface_t);
void ghostty_surface_split(ghostty_surface_t, ghostty_split_direction_e);
void ghostty_surface_split_focus_previous(ghostty_surface_t);
void ghostty_surface_split_focus_next(ghostty_surface_t);
void ghostty_surface_split_focus(ghostty_surface_t, ghostty_split_focus_direction_e);
#ifdef __cplusplus
}