From 91ba4a52701db0a43ffc7769d2fda510ca2ebfa3 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 22 May 2022 16:02:04 -0400 Subject: [WIP] Add support for drag and drop --- examples/pugl_clipboard_demo.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/pugl_clipboard_demo.c b/examples/pugl_clipboard_demo.c index 08227d1..01e96dc 100644 --- a/examples/pugl_clipboard_demo.c +++ b/examples/pugl_clipboard_demo.c @@ -81,10 +81,10 @@ static void onDataOffer(PuglView* view, const PuglDataOfferEvent* event) { const PuglClipboard clipboard = event->clipboard; - const uint32_t numTypes = puglGetNumClipboardTypes(view, clipboard); + const size_t numTypes = puglGetNumClipboardTypes(view, clipboard); // Print all offered types to be useful as a testing program - fprintf(stderr, "Offered %u types:\n", numTypes); + fprintf(stderr, "Offered %zu types:\n", numTypes); for (uint32_t t = 0; t < numTypes; ++t) { const char* type = puglGetClipboardType(view, clipboard, t); fprintf(stderr, "\t%s\n", type); @@ -230,12 +230,16 @@ main(int argc, char** argv) puglSetSizeHint(view, PUGL_MIN_SIZE, 128, 128); puglSetBackend(view, puglGlBackend()); + puglRegisterDragType(view, "text/plain"); + puglRegisterDragType(view, "text/uri-list"); + puglSetViewHint(view, PUGL_CONTEXT_DEBUG, opts.errorChecking); puglSetViewHint(view, PUGL_RESIZABLE, opts.resizable); puglSetViewHint(view, PUGL_SAMPLES, opts.samples); puglSetViewHint(view, PUGL_DOUBLE_BUFFER, opts.doubleBuffer); puglSetViewHint(view, PUGL_SWAP_INTERVAL, opts.sync); puglSetViewHint(view, PUGL_IGNORE_KEY_REPEAT, opts.ignoreKeyRepeat); + puglSetViewHint(view, PUGL_ACCEPT_DROP, true); puglSetHandle(view, &app.cube); puglSetEventFunc(view, onEvent); -- cgit v1.2.1