DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit a652e711eb4b0be13bf9c821870fab308da981d5
parent 9de73b40a9a417f19aa150175081eb4d233a34f5
Author: falkTX <falktx@falktx.com>
Date:   Tue, 12 Jul 2022 10:50:57 +0100

Wait a maximum of 2 seconds for clipboard

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Mdgl/src/WindowPrivateData.cpp | 6++++--
Mdgl/src/pugl.cpp | 5++---
2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/dgl/src/WindowPrivateData.cpp b/dgl/src/WindowPrivateData.cpp @@ -786,7 +786,8 @@ const void* Window::PrivateData::getClipboard(size_t& dataSize) #ifdef DGL_USING_X11 // wait for type request, clipboardTypeId must be != 0 to be valid - while (clipboardTypeId == 0 && waitingForClipboardData) + int retry = static_cast<int>(2 / 0.03); + while (clipboardTypeId == 0 && waitingForClipboardData && --retry >= 0) { if (puglX11UpdateWithoutExposures(appData->world) != PUGL_SUCCESS) break; @@ -802,7 +803,8 @@ const void* Window::PrivateData::getClipboard(size_t& dataSize) #ifdef DGL_USING_X11 // wait for actual data (assumes offer was accepted) - while (waitingForClipboardData) + retry = static_cast<int>(2 / 0.03); + while (waitingForClipboardData && --retry >= 0) { if (puglX11UpdateWithoutExposures(appData->world) != PUGL_SUCCESS) break; diff --git a/dgl/src/pugl.cpp b/dgl/src/pugl.cpp @@ -597,9 +597,8 @@ PuglStatus puglX11UpdateWithoutExposures(PuglWorld* const world) for (double t = startTime; !st && t < endTime; t = puglGetTime(world)) { - if (!(st = pollX11Socket(world, endTime - t))) { - st = dispatchX11Events(world); - } + pollX11Socket(world, endTime - t); + st = dispatchX11Events(world); } world->impl->dispatchingEvents = wasDispatchingEvents;