diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-11-05 08:13:47 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-11-05 08:13:47 +0000 |
| commit | fd82caad4226c045c78dac47d6cdeed235c44e14 (patch) | |
| tree | 6198139af3ae528bcf95f59ff00a94ffbd1f9c6e /selection.h | |
| parent | selection: make text_from_{clipboard,primary} async (diff) | |
selection: document the asynchronous behavior of text_from_{primary,clipboard}
Diffstat (limited to 'selection.h')
| -rw-r--r-- | selection.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/selection.h b/selection.h index 9ff40919..0ead8f0e 100644 --- a/selection.h +++ b/selection.h @@ -25,13 +25,29 @@ void selection_from_clipboard(struct terminal *term, uint32_t serial); void selection_to_primary(struct terminal *term, uint32_t serial); void selection_from_primary(struct terminal *term); +/* Copy text *to* primary/clipboard */ bool text_to_clipboard(struct terminal *term, char *text, uint32_t serial); +bool text_to_primary(struct terminal *term, char *text, uint32_t serial); + +/* + * Copy text *from* primary/clipboard + * + * Note that these are asynchronous; they *will* return + * immediately. The 'cb' callback will be called 0..n times with + * clipboard data. When done (or on error), the 'done' callback is + * called. + * + * As such, keep this in mind: + * - The 'user' context must not be stack allocated + * - Don't expect clipboard data to have been received when these + * functions return (it will *never* have been received at this + * point). + */ void text_from_clipboard( struct terminal *term, uint32_t serial, void (*cb)(const char *data, size_t size, void *user), void (*done)(void *user), void *user); -bool text_to_primary(struct terminal *term, char *text, uint32_t serial); void text_from_primary( struct terminal *term, void (*cb)(const char *data, size_t size, void *user), |
