mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-06 07:38:21 +00:00
libghostty: add cpp-vt-stream example and fix C++ header compatibility
Add a cpp-vt-stream example that verifies libghostty headers compile cleanly in C++ mode. The example is a simplified C++ port of c-vt-stream. The headers used the C idiom `typedef struct Foo* Foo` for opaque handles, which is invalid in C++ because struct tags and typedefs share the same namespace. Fix all 12 opaque handle typedefs across the headers to use a distinct struct tag with an Impl suffix, e.g. `typedef struct GhosttyTerminalImpl* GhosttyTerminal`. This is a source-compatible change for existing C consumers since the struct tags were never referenced directly.
This commit is contained in:
@@ -111,7 +111,7 @@ typedef struct {
|
||||
*
|
||||
* @ingroup formatter
|
||||
*/
|
||||
typedef struct GhosttyFormatter* GhosttyFormatter;
|
||||
typedef struct GhosttyFormatterImpl* GhosttyFormatter;
|
||||
|
||||
/**
|
||||
* Options for creating a terminal formatter.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*
|
||||
* @ingroup key
|
||||
*/
|
||||
typedef struct GhosttyKeyEncoder *GhosttyKeyEncoder;
|
||||
typedef struct GhosttyKeyEncoderImpl *GhosttyKeyEncoder;
|
||||
|
||||
/**
|
||||
* Kitty keyboard protocol flags.
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*
|
||||
* @ingroup key
|
||||
*/
|
||||
typedef struct GhosttyKeyEvent *GhosttyKeyEvent;
|
||||
typedef struct GhosttyKeyEventImpl *GhosttyKeyEvent;
|
||||
|
||||
/**
|
||||
* Keyboard input event types.
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*
|
||||
* @ingroup mouse
|
||||
*/
|
||||
typedef struct GhosttyMouseEncoder *GhosttyMouseEncoder;
|
||||
typedef struct GhosttyMouseEncoderImpl *GhosttyMouseEncoder;
|
||||
|
||||
/**
|
||||
* Mouse tracking mode.
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*
|
||||
* @ingroup mouse
|
||||
*/
|
||||
typedef struct GhosttyMouseEvent *GhosttyMouseEvent;
|
||||
typedef struct GhosttyMouseEventImpl *GhosttyMouseEvent;
|
||||
|
||||
/**
|
||||
* Mouse event action type.
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*
|
||||
* @ingroup osc
|
||||
*/
|
||||
typedef struct GhosttyOscParser *GhosttyOscParser;
|
||||
typedef struct GhosttyOscParserImpl *GhosttyOscParser;
|
||||
|
||||
/**
|
||||
* Opaque handle to a single OSC command.
|
||||
@@ -31,7 +31,7 @@ typedef struct GhosttyOscParser *GhosttyOscParser;
|
||||
*
|
||||
* @ingroup osc
|
||||
*/
|
||||
typedef struct GhosttyOscCommand *GhosttyOscCommand;
|
||||
typedef struct GhosttyOscCommandImpl *GhosttyOscCommand;
|
||||
|
||||
/** @defgroup osc OSC Parser
|
||||
*
|
||||
|
||||
@@ -86,21 +86,21 @@ extern "C" {
|
||||
*
|
||||
* @ingroup render
|
||||
*/
|
||||
typedef struct GhosttyRenderState* GhosttyRenderState;
|
||||
typedef struct GhosttyRenderStateImpl* GhosttyRenderState;
|
||||
|
||||
/**
|
||||
* Opaque handle to a render-state row iterator.
|
||||
*
|
||||
* @ingroup render
|
||||
*/
|
||||
typedef struct GhosttyRenderStateRowIterator* GhosttyRenderStateRowIterator;
|
||||
typedef struct GhosttyRenderStateRowIteratorImpl* GhosttyRenderStateRowIterator;
|
||||
|
||||
/**
|
||||
* Opaque handle to render-state row cells.
|
||||
*
|
||||
* @ingroup render
|
||||
*/
|
||||
typedef struct GhosttyRenderStateRowCells* GhosttyRenderStateRowCells;
|
||||
typedef struct GhosttyRenderStateRowCellsImpl* GhosttyRenderStateRowCells;
|
||||
|
||||
/**
|
||||
* Dirty state of a render state after update.
|
||||
|
||||
@@ -55,7 +55,7 @@ extern "C" {
|
||||
*
|
||||
* @ingroup sgr
|
||||
*/
|
||||
typedef struct GhosttySgrParser* GhosttySgrParser;
|
||||
typedef struct GhosttySgrParserImpl* GhosttySgrParser;
|
||||
|
||||
/**
|
||||
* SGR attribute tags.
|
||||
|
||||
@@ -159,7 +159,7 @@ extern "C" {
|
||||
*
|
||||
* @ingroup terminal
|
||||
*/
|
||||
typedef struct GhosttyTerminal* GhosttyTerminal;
|
||||
typedef struct GhosttyTerminalImpl* GhosttyTerminal;
|
||||
|
||||
/**
|
||||
* Terminal initialization options.
|
||||
|
||||
Reference in New Issue
Block a user