diff options
author | David Robillard <d@drobilla.net> | 2022-05-22 18:26:35 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-11-11 09:54:18 -0500 |
commit | 91051e9059b67b8d633e385afb48a36d4f9467ba (patch) | |
tree | 0d221ea736e27dec7f405acfe2b866b4f81398e3 /src | |
parent | c59e88aa6fa60c6f7424da737fcaf0496a0bf3d6 (diff) | |
download | pugl-91051e9059b67b8d633e385afb48a36d4f9467ba.tar.gz pugl-91051e9059b67b8d633e385afb48a36d4f9467ba.tar.bz2 pugl-91051e9059b67b8d633e385afb48a36d4f9467ba.zip |
Add action parameter to puglAcceptOffer()
Diffstat (limited to 'src')
-rw-r--r-- | src/mac.m | 20 | ||||
-rw-r--r-- | src/win.c | 1 | ||||
-rw-r--r-- | src/x11.c | 3 | ||||
-rw-r--r-- | src/x11.h | 1 |
4 files changed, 24 insertions, 1 deletions
@@ -1926,10 +1926,28 @@ puglGetClipboardType(const PuglView* const view, return mimeType ? [mimeType UTF8String] : [uti UTF8String]; } +static NSDragOperation +getDragOperation(const PuglAction action) +{ + switch (action) { + case PUGL_ACTION_COPY: + return NSDragOperationCopy; + case PUGL_ACTION_LINK: + return NSDragOperationLink; + case PUGL_ACTION_MOVE: + return NSDragOperationMove; + case PUGL_ACTION_PRIVATE: + break; + } + + return NSDragOperationPrivate; +} + PuglStatus puglAcceptOffer(PuglView* const view, const PuglDataOfferEvent* const offer, const uint32_t typeIndex, + const PuglAction action, const PuglRect region) { PuglWrapperView* const wrapper = view->impl->wrapperView; @@ -1943,7 +1961,7 @@ puglAcceptOffer(PuglView* const view, return PUGL_BAD_PARAMETER; } - wrapper->dragOperation = NSDragOperationCopy; + wrapper->dragOperation = getDragOperation(action); wrapper->dragTypeIndex = typeIndex; const PuglDataEvent data = {PUGL_DATA, @@ -1372,6 +1372,7 @@ PuglStatus puglAcceptOffer(PuglView* const view, const PuglDataOfferEvent* const PUGL_UNUSED(offer), const uint32_t typeIndex, + PuglAction PUGL_UNUSED(action), const PuglRect region) { if (typeIndex != 0) { @@ -508,6 +508,7 @@ clearX11Clipboard(PuglX11Clipboard* const board) board->source = None; board->numFormats = 0; + board->acceptedAction = PUGL_ACTION_PRIVATE; board->acceptedFormatIndex = UINT32_MAX; board->acceptedFormat = None; board->data.len = 0; @@ -2116,6 +2117,7 @@ PuglStatus puglAcceptOffer(PuglView* const view, const PuglDataOfferEvent* const offer, const uint32_t typeIndex, + PuglAction action, const PuglRect region) { (void)region; @@ -2124,6 +2126,7 @@ puglAcceptOffer(PuglView* const view, Display* const display = view->world->impl->display; PuglX11Clipboard* const board = getX11Clipboard(view, offer->clipboard); + board->acceptedAction = action; board->acceptedFormatIndex = typeIndex; board->acceptedFormat = board->formats[typeIndex]; @@ -61,6 +61,7 @@ typedef struct { Atom* formats; char** formatStrings; unsigned long numFormats; + PuglAction acceptedAction; uint32_t acceptedFormatIndex; Atom acceptedFormat; PuglBlob data; |