aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-05-22 16:02:04 -0400
committerDavid Robillard <d@drobilla.net>2023-11-11 10:20:03 -0500
commit91ba4a52701db0a43ffc7769d2fda510ca2ebfa3 (patch)
treebe2dca91d457f28e0c9c324736f24d85a5ed57c2 /examples
parent91051e9059b67b8d633e385afb48a36d4f9467ba (diff)
downloadpugl-dragdrop.tar.gz
pugl-dragdrop.tar.bz2
pugl-dragdrop.zip
[WIP] Add support for drag and dropdragdrop
Diffstat (limited to 'examples')
-rw-r--r--examples/pugl_clipboard_demo.c8
1 files changed, 6 insertions, 2 deletions
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);