mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-14 03:25:50 +00:00
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.
21 lines
391 B
C
21 lines
391 B
C
#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]
|