Browse Source

Wait a maximum of 2 seconds for clipboard

Signed-off-by: falkTX <falktx@falktx.com>
pull/321/head
falkTX 2 years ago
parent
commit
a652e711eb
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 6 additions and 5 deletions
  1. +4
    -2
      dgl/src/WindowPrivateData.cpp
  2. +2
    -3
      dgl/src/pugl.cpp

+ 4
- 2
dgl/src/WindowPrivateData.cpp View File

@@ -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;


+ 2
- 3
dgl/src/pugl.cpp View File

@@ -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;


Loading…
Cancel
Save