diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/c/clipboards.rst | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/doc/c/clipboards.rst b/doc/c/clipboards.rst index 44f2960..c7b6ef4 100644 --- a/doc/c/clipboards.rst +++ b/doc/c/clipboards.rst @@ -66,10 +66,11 @@ When handling this event, static void onDataOffer(PuglView* view, const PuglEventDataOffer* event) { - size_t numTypes = puglGetNumClipboardTypes(view, clipboard); + PuglClipboard clipboard = event->clipboard; + size_t numTypes = puglGetNumClipboardTypes(view, clipboard); for (uint32_t t = 0; t < numTypes; ++t) { - const char* type = puglGetClipboardType(view, t); + const char* type = puglGetClipboardType(view, clipboard, t); printf("Offered type: %s\n", type); } } @@ -80,7 +81,7 @@ it can accept the offer with :func:`puglAcceptOffer`: .. code-block:: c for (uint32_t t = 0; t < numTypes; ++t) { - const char* type = puglGetClipboardType(view, t); + const char* type = puglGetClipboardType(view, clipboard, t); if (!strcmp(type, "text/uri-list")) { puglAcceptOffer(view, event, @@ -109,15 +110,16 @@ the data can be fetched with :func:`puglGetClipboard`: static void onData(PuglView* view, const PuglEventData* event) { - uint32_t typeIndex = event->typeIndex; + PuglClipboard clipboard = event->clipboard; + uint32_t typeIndex = event->typeIndex; - const char* type = puglGetClipboardType(view, typeIndex); + const char* type = puglGetClipboardType(view, clipboard, typeIndex); fprintf(stderr, "Received data type: %s\n", type); if (!strcmp(type, "text/plain")) { size_t len = 0; - const void* data = puglGetClipboard(view, typeIndex, &len); + const void* data = puglGetClipboard(view, clipboard, typeIndex, &len); printf("Dropped: %s\n", (const char*)data); } |