mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-06-09 05:14:27 +00:00
vt: pass pointer options directly to terminal_set
Previously ghostty_terminal_set required all values to be passed as pointers to the value, even when the value itself was already a pointer (userdata, function pointer callbacks). This forced callers into awkward patterns like compound literals or intermediate variables just to take the address of a pointer. Now pointer-typed options (userdata and all callbacks) are passed directly as the value parameter. Only non-pointer types like GhosttyString still require a pointer to the value. This simplifies InType to return the actual stored type for each option and lets setTyped work with those types directly.
This commit is contained in:
@@ -341,7 +341,7 @@ typedef enum {
|
||||
/**
|
||||
* Opaque userdata pointer passed to all callbacks.
|
||||
*
|
||||
* Input type: void**
|
||||
* Input type: void*
|
||||
*/
|
||||
GHOSTTY_TERMINAL_OPT_USERDATA = 0,
|
||||
|
||||
@@ -350,7 +350,7 @@ typedef enum {
|
||||
* to the pty (e.g. in response to a DECRQM query or device
|
||||
* status report). Set to NULL to ignore such sequences.
|
||||
*
|
||||
* Input type: GhosttyTerminalWritePtyFn*
|
||||
* Input type: GhosttyTerminalWritePtyFn
|
||||
*/
|
||||
GHOSTTY_TERMINAL_OPT_WRITE_PTY = 1,
|
||||
|
||||
@@ -358,7 +358,7 @@ typedef enum {
|
||||
* Callback invoked when the terminal receives a BEL character
|
||||
* (0x07). Set to NULL to ignore bell events.
|
||||
*
|
||||
* Input type: GhosttyTerminalBellFn*
|
||||
* Input type: GhosttyTerminalBellFn
|
||||
*/
|
||||
GHOSTTY_TERMINAL_OPT_BELL = 2,
|
||||
|
||||
@@ -366,7 +366,7 @@ typedef enum {
|
||||
* Callback invoked when the terminal receives an ENQ character
|
||||
* (0x05). Set to NULL to send no response.
|
||||
*
|
||||
* Input type: GhosttyTerminalEnquiryFn*
|
||||
* Input type: GhosttyTerminalEnquiryFn
|
||||
*/
|
||||
GHOSTTY_TERMINAL_OPT_ENQUIRY = 3,
|
||||
|
||||
@@ -374,7 +374,7 @@ typedef enum {
|
||||
* Callback invoked when the terminal receives an XTVERSION query
|
||||
* (CSI > q). Set to NULL to report the default "libghostty" string.
|
||||
*
|
||||
* Input type: GhosttyTerminalXtversionFn*
|
||||
* Input type: GhosttyTerminalXtversionFn
|
||||
*/
|
||||
GHOSTTY_TERMINAL_OPT_XTVERSION = 4,
|
||||
|
||||
@@ -383,7 +383,7 @@ typedef enum {
|
||||
* sequences (e.g. OSC 0 or OSC 2). Set to NULL to ignore title
|
||||
* change events.
|
||||
*
|
||||
* Input type: GhosttyTerminalTitleChangedFn*
|
||||
* Input type: GhosttyTerminalTitleChangedFn
|
||||
*/
|
||||
GHOSTTY_TERMINAL_OPT_TITLE_CHANGED = 5,
|
||||
|
||||
@@ -391,7 +391,7 @@ typedef enum {
|
||||
* Callback invoked in response to XTWINOPS size queries
|
||||
* (CSI 14/16/18 t). Set to NULL to silently ignore size queries.
|
||||
*
|
||||
* Input type: GhosttyTerminalSizeFn*
|
||||
* Input type: GhosttyTerminalSizeFn
|
||||
*/
|
||||
GHOSTTY_TERMINAL_OPT_SIZE = 6,
|
||||
|
||||
@@ -401,7 +401,7 @@ typedef enum {
|
||||
* to report the current scheme, or return false to silently ignore.
|
||||
* Set to NULL to ignore color scheme queries.
|
||||
*
|
||||
* Input type: GhosttyTerminalColorSchemeFn*
|
||||
* Input type: GhosttyTerminalColorSchemeFn
|
||||
*/
|
||||
GHOSTTY_TERMINAL_OPT_COLOR_SCHEME = 7,
|
||||
|
||||
@@ -411,7 +411,7 @@ typedef enum {
|
||||
* pointer with response data, or return false to silently ignore.
|
||||
* Set to NULL to ignore device attributes queries.
|
||||
*
|
||||
* Input type: GhosttyTerminalDeviceAttributesFn*
|
||||
* Input type: GhosttyTerminalDeviceAttributesFn
|
||||
*/
|
||||
GHOSTTY_TERMINAL_OPT_DEVICE_ATTRIBUTES = 8,
|
||||
|
||||
@@ -619,8 +619,10 @@ GhosttyResult ghostty_terminal_resize(GhosttyTerminal terminal,
|
||||
* Set an option on the terminal.
|
||||
*
|
||||
* Configures terminal callbacks and associated state such as the
|
||||
* write_pty callback and userdata pointer. A NULL value pointer
|
||||
* clears the option to its default (NULL/disabled).
|
||||
* write_pty callback and userdata pointer. The value is passed
|
||||
* directly for pointer types (callbacks, userdata) or as a pointer
|
||||
* to the value for non-pointer types (e.g. GhosttyString*).
|
||||
* NULL clears the option to its default.
|
||||
*
|
||||
* Callbacks are invoked synchronously during ghostty_terminal_vt_write().
|
||||
* Callbacks must not call ghostty_terminal_vt_write() on the same
|
||||
|
||||
Reference in New Issue
Block a user