mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-18 05:20:29 +00:00
docs: extract focus encoding example into standalone project
Extract the inline code example from focus.h into a standalone buildable example at example/c-vt-encode-focus. The header now uses a Doxygen @snippet tag to include the code from the example source file, so the documentation stays in sync with code that is verified to compile and run.
This commit is contained in:
20
example/c-vt-encode-focus/src/main.c
Normal file
20
example/c-vt-encode-focus/src/main.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <stdio.h>
|
||||
#include <ghostty/vt.h>
|
||||
|
||||
//! [focus-encode]
|
||||
int main() {
|
||||
char buf[8];
|
||||
size_t written = 0;
|
||||
|
||||
GhosttyResult result = ghostty_focus_encode(
|
||||
GHOSTTY_FOCUS_GAINED, buf, sizeof(buf), &written);
|
||||
|
||||
if (result == GHOSTTY_SUCCESS) {
|
||||
printf("Encoded %zu bytes: ", written);
|
||||
fwrite(buf, 1, written, stdout);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
//! [focus-encode]
|
||||
Reference in New Issue
Block a user