diff options
| author | 2020-07-21 06:15:16 -0400 | |
|---|---|---|
| committer | 2020-07-21 06:15:16 -0400 | |
| commit | 37a7155ea7c504b308a8afa642c653a12bbe5f84 (patch) | |
| tree | bd68ea5d2a2400dcd04b1aa85617534e66aba94c /src/lib/platform/XWindowsEventQueueBuffer.cpp | |
| parent | 1ae09e76cde035d716763fc88b570535884cd50f (diff) | |
| parent | fbc30002ab3438356c0476e70c4577a0310d52c0 (diff) | |
Update upstream source from tag 'upstream/2.3.3+dfsg'
Update to upstream version '2.3.3+dfsg'
with Debian dir f7eeed313bc1a4c2bda69f04f0316ee29651397f
Diffstat (limited to 'src/lib/platform/XWindowsEventQueueBuffer.cpp')
| -rw-r--r-- | src/lib/platform/XWindowsEventQueueBuffer.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/platform/XWindowsEventQueueBuffer.cpp b/src/lib/platform/XWindowsEventQueueBuffer.cpp index 78f0e5a..8b8c3b5 100644 --- a/src/lib/platform/XWindowsEventQueueBuffer.cpp +++ b/src/lib/platform/XWindowsEventQueueBuffer.cpp @@ -82,6 +82,19 @@ XWindowsEventQueueBuffer::~XWindowsEventQueueBuffer() close(m_pipefd[1]); } +int XWindowsEventQueueBuffer::getPendingCountLocked() +{ + Lock lock(&m_mutex); + // work around a bug in old libx11 which causes the first XPending not to read events under + // certain conditions. The issue happens when libx11 has not yet received replies for all + // flushed events. In that case, internally XPending will not try to process received events + // as the reply for the last event was not found. As a result, XPending will return the number + // of pending events without regard to the events it has just read. + // https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/1 fixes this on libx11 side. + m_impl->XPending(m_display); + return m_impl->XPending(m_display); +} + void XWindowsEventQueueBuffer::waitForEvent(double dtimeout) { @@ -163,7 +176,7 @@ XWindowsEventQueueBuffer::waitForEvent(double dtimeout) // we want to give the cpu a chance s owe up this to 25ms #define TIMEOUT_DELAY 25 - while (((dtimeout < 0.0) || (remaining > 0)) && QLength(m_display)==0 && retval==0){ + while (((dtimeout < 0.0) || (remaining > 0)) && getPendingCountLocked() == 0 && retval == 0) { #if HAVE_POLL retval = poll(pfds, 2, TIMEOUT_DELAY); //16ms = 60hz, but we make it > to play nicely with the cpu if (pfds[1].revents & POLLIN) { |
