core/gtk: open urls using an apprt action instead of doing it directly

Partial implementation of #5256

This implements the core changes necessary to open urls using an apprt
action rather than doing it directly from the core.

Implements the open_url action in the GTK and GLFW apprts.

Note that this should not be merged until a macOS-savvy developer can add
an implementation of the open_url action for the macOS apprt.
This commit is contained in:
Jeffrey C. Ollie
2025-02-25 11:59:46 -06:00
committed by Mitchell Hashimoto
parent 185a4ea10b
commit 9583ea1b7a
5 changed files with 209 additions and 44 deletions

View File

@@ -662,6 +662,19 @@ typedef struct {
bool soft;
} ghostty_action_reload_config_s;
// apprt.action.OpenUrlKind
typedef enum {
GHOSTTY_ACTION_OPEN_URL_KIND_TEXT,
GHOSTTY_ACTION_OPEN_URL_KIND_UNKNOWN,
} ghostty_action_open_url_kind_e;
// apprt.action.OpenUrl.C
typedef struct {
ghostty_action_open_url_kind_e kind;
const char* url;
uintptr_t len;
} ghostty_action_open_url_s;
// apprt.Action.Key
typedef enum {
GHOSTTY_ACTION_QUIT,
@@ -711,7 +724,8 @@ typedef enum {
GHOSTTY_ACTION_RING_BELL,
GHOSTTY_ACTION_UNDO,
GHOSTTY_ACTION_REDO,
GHOSTTY_ACTION_CHECK_FOR_UPDATES
GHOSTTY_ACTION_CHECK_FOR_UPDATES,
GHOSTTY_ACTION_OPEN_URL,
} ghostty_action_tag_e;
typedef union {
@@ -739,6 +753,7 @@ typedef union {
ghostty_action_color_change_s color_change;
ghostty_action_reload_config_s reload_config;
ghostty_action_config_change_s config_change;
ghostty_action_open_url_s open_url;
} ghostty_action_u;
typedef struct {