mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-21 14:55:20 +00:00
vt: expose dirty state in C API
Switch RenderState.Dirty to lib.Enum so it uses C-compatible enum backing when building the C ABI target. Add GhosttyRenderStateDirty and new ghostty_render_state_dirty_get/set declarations to the render header, then wire both functions through src/terminal/c/main.zig and the lib_vt export table.
This commit is contained in:
@@ -49,6 +49,22 @@ extern "C" {
|
||||
*/
|
||||
typedef struct GhosttyRenderState* GhosttyRenderState;
|
||||
|
||||
/**
|
||||
* Dirty state of a render state after update.
|
||||
*
|
||||
* @ingroup render
|
||||
*/
|
||||
typedef enum {
|
||||
/** Not dirty at all; rendering can be skipped. */
|
||||
GHOSTTY_RENDER_STATE_DIRTY_FALSE = 0,
|
||||
|
||||
/** Some rows changed; renderer can redraw incrementally. */
|
||||
GHOSTTY_RENDER_STATE_DIRTY_PARTIAL = 1,
|
||||
|
||||
/** Global state changed; renderer should redraw everything. */
|
||||
GHOSTTY_RENDER_STATE_DIRTY_FULL = 2,
|
||||
} GhosttyRenderStateDirty;
|
||||
|
||||
/**
|
||||
* Create a new render state instance.
|
||||
*
|
||||
@@ -79,6 +95,34 @@ GhosttyResult ghostty_render_state_new(const GhosttyAllocator* allocator,
|
||||
GhosttyResult ghostty_render_state_update(GhosttyRenderState state,
|
||||
GhosttyTerminal terminal);
|
||||
|
||||
/**
|
||||
* Get the current dirty state of a render state.
|
||||
*
|
||||
* @param state The render state handle (NULL returns GHOSTTY_INVALID_VALUE)
|
||||
* @param[out] out_dirty On success, receives the current dirty state
|
||||
* @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if `state` is
|
||||
* NULL
|
||||
*
|
||||
* @ingroup render
|
||||
*/
|
||||
GhosttyResult ghostty_render_state_dirty_get(GhosttyRenderState state,
|
||||
GhosttyRenderStateDirty* out_dirty);
|
||||
|
||||
/**
|
||||
* Set the dirty state of a render state.
|
||||
*
|
||||
* This can be used by callers to clear dirty state after handling updates.
|
||||
*
|
||||
* @param state The render state handle (NULL returns GHOSTTY_INVALID_VALUE)
|
||||
* @param dirty The dirty state to set
|
||||
* @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if `state` is
|
||||
* NULL or `dirty` is not a recognized enum value
|
||||
*
|
||||
* @ingroup render
|
||||
*/
|
||||
GhosttyResult ghostty_render_state_dirty_set(GhosttyRenderState state,
|
||||
GhosttyRenderStateDirty dirty);
|
||||
|
||||
/**
|
||||
* Free a render state instance.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user