mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-06-08 21:04:32 +00:00
vt: add size effect callback for XTWINOPS queries
Add GHOSTTY_TERMINAL_OPT_SIZE so C consumers can respond to XTWINOPS size queries (CSI 14/16/18 t). The callback receives a GhosttySizeReportSize out-pointer and returns true if the size is available, or false to silently ignore the query. The trampoline converts the bool + out-pointer pattern to the optional that the Zig handler expects.
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include <ghostty/vt/types.h>
|
||||
#include <ghostty/vt/allocator.h>
|
||||
#include <ghostty/vt/modes.h>
|
||||
#include <ghostty/vt/size_report.h>
|
||||
#include <ghostty/vt/grid_ref.h>
|
||||
#include <ghostty/vt/screen.h>
|
||||
#include <ghostty/vt/point.h>
|
||||
@@ -216,6 +217,24 @@ typedef GhosttyString (*GhosttyTerminalXtversionFn)(GhosttyTerminal terminal,
|
||||
typedef void (*GhosttyTerminalTitleChangedFn)(GhosttyTerminal terminal,
|
||||
void* userdata);
|
||||
|
||||
/**
|
||||
* Callback function type for size queries (XTWINOPS).
|
||||
*
|
||||
* Called in response to XTWINOPS size queries (CSI 14/16/18 t).
|
||||
* Return true and fill *out_size with the current terminal geometry,
|
||||
* or return false to silently ignore the query.
|
||||
*
|
||||
* @param terminal The terminal handle
|
||||
* @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA
|
||||
* @param[out] out_size Pointer to store the terminal size information
|
||||
* @return true if size was filled, false to ignore the query
|
||||
*
|
||||
* @ingroup terminal
|
||||
*/
|
||||
typedef bool (*GhosttyTerminalSizeFn)(GhosttyTerminal terminal,
|
||||
void* userdata,
|
||||
GhosttySizeReportSize* out_size);
|
||||
|
||||
/**
|
||||
* Terminal option identifiers.
|
||||
*
|
||||
@@ -273,6 +292,14 @@ typedef enum {
|
||||
* Input type: GhosttyTerminalTitleChangedFn*
|
||||
*/
|
||||
GHOSTTY_TERMINAL_OPT_TITLE_CHANGED = 5,
|
||||
|
||||
/**
|
||||
* Callback invoked in response to XTWINOPS size queries
|
||||
* (CSI 14/16/18 t). Set to NULL to silently ignore size queries.
|
||||
*
|
||||
* Input type: GhosttyTerminalSizeFn*
|
||||
*/
|
||||
GHOSTTY_TERMINAL_OPT_SIZE = 6,
|
||||
} GhosttyTerminalOption;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user