/* The system clipboard as Ctrl+V reads it (clipboard.c). Host-only: it runs * the platform's own commands (osascript and pbpaste on macOS, wl-paste, xclip * and xsel on Linux) and nothing is written to disk. */ #ifndef PIC_TUI_CLIPBOARD_H #define PIC_TUI_CLIPBOARD_H #include enum { TUI_CLIP_NONE, /* nothing usable, or no clipboard here */ TUI_CLIP_FILES, /* copied files (Finder): absolute paths, one per line */ TUI_CLIP_IMAGE, /* a PNG, JPEG, GIF or WebP image */ TUI_CLIP_TEXT, }; typedef struct { char *text; /* TUI_CLIP_FILES (paths) or TUI_CLIP_TEXT: malloc'd */ unsigned char *image; /* TUI_CLIP_IMAGE: malloc'd, image_len bytes */ size_t image_len; } tui_clip; /* Pi's handleClipboardPaste order: copied files, else an image, else text. * Returns the kind found, with its field set (free it); the others are NULL. * Tests point it at files instead, which also keeps them off the real * clipboard: PIC_CLIPBOARD_FILES_FILE (its lines are the paths), * PIC_CLIPBOARD_IMAGE_FILE (the image bytes) and PIC_CLIPBOARD_TEXT_FILE; * with PIC_NO_NATIVE_CLIPBOARD set and no such file, nothing is found. */ int tui_clipboard_read(tui_clip *c); void tui_clip_free(tui_clip *c); #endif