From b5c57d9b5e45d3cede52e2418432cd6c5655377f Mon Sep 17 00:00:00 2001 From: Jamie Newbon Date: Thu, 30 Apr 2020 22:19:29 +0100 Subject: [PATCH 1/3] #6487 Possible culprit to mouse freeze commented out for testing --- src/lib/platform/XWindowsEventQueueBuffer.cpp | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/lib/platform/XWindowsEventQueueBuffer.cpp b/src/lib/platform/XWindowsEventQueueBuffer.cpp index 71e2cfba8..0a5e4b46c 100644 --- a/src/lib/platform/XWindowsEventQueueBuffer.cpp +++ b/src/lib/platform/XWindowsEventQueueBuffer.cpp @@ -162,31 +162,31 @@ 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)) && QLength(m_display)==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) { - ssize_t read_response = read(m_pipefd[0], buf, 15); - - // with linux automake, warnings are treated as errors by default - if (read_response < 0) - { - // todo: handle read response - } - - } +// retval = poll(pfds, 2, TIMEOUT_DELAY); //16ms = 60hz, but we make it > to play nicely with the cpu +// if (pfds[1].revents & POLLIN) { +// ssize_t read_response = read(m_pipefd[0], buf, 15); +// +// // with linux automake, warnings are treated as errors by default +// if (read_response < 0) +// { +// // todo: handle read response +// } +// +// } #else - retval = select(nfds, - SELECT_TYPE_ARG234 &rfds, - SELECT_TYPE_ARG234 NULL, - SELECT_TYPE_ARG234 NULL, - SELECT_TYPE_ARG5 TIMEOUT_DELAY); - if (FD_SET(m_pipefd[0], &rfds)) { - read(m_pipefd[0], buf, 15); - } +// retval = select(nfds, +// SELECT_TYPE_ARG234 &rfds, +// SELECT_TYPE_ARG234 NULL, +// SELECT_TYPE_ARG234 NULL, +// SELECT_TYPE_ARG5 TIMEOUT_DELAY); +// if (FD_SET(m_pipefd[0], &rfds)) { +// read(m_pipefd[0], buf, 15); +// } #endif - remaining-=TIMEOUT_DELAY; - } +// remaining-=TIMEOUT_DELAY; +// } { // we're no longer waiting for events From 26f4b4da46caab73d172bfc33e8e406a2d44f200 Mon Sep 17 00:00:00 2001 From: Jamie Newbon Date: Mon, 4 May 2020 13:45:45 +0100 Subject: [PATCH 2/3] Revert "#6487 Possible culprit to mouse freeze commented out for testing" This reverts commit b5c57d9b --- src/lib/platform/XWindowsEventQueueBuffer.cpp | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/lib/platform/XWindowsEventQueueBuffer.cpp b/src/lib/platform/XWindowsEventQueueBuffer.cpp index 0a5e4b46c..71e2cfba8 100644 --- a/src/lib/platform/XWindowsEventQueueBuffer.cpp +++ b/src/lib/platform/XWindowsEventQueueBuffer.cpp @@ -162,31 +162,31 @@ 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)) && QLength(m_display)==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) { -// ssize_t read_response = read(m_pipefd[0], buf, 15); -// -// // with linux automake, warnings are treated as errors by default -// if (read_response < 0) -// { -// // todo: handle read response -// } -// -// } + retval = poll(pfds, 2, TIMEOUT_DELAY); //16ms = 60hz, but we make it > to play nicely with the cpu + if (pfds[1].revents & POLLIN) { + ssize_t read_response = read(m_pipefd[0], buf, 15); + + // with linux automake, warnings are treated as errors by default + if (read_response < 0) + { + // todo: handle read response + } + + } #else -// retval = select(nfds, -// SELECT_TYPE_ARG234 &rfds, -// SELECT_TYPE_ARG234 NULL, -// SELECT_TYPE_ARG234 NULL, -// SELECT_TYPE_ARG5 TIMEOUT_DELAY); -// if (FD_SET(m_pipefd[0], &rfds)) { -// read(m_pipefd[0], buf, 15); -// } + retval = select(nfds, + SELECT_TYPE_ARG234 &rfds, + SELECT_TYPE_ARG234 NULL, + SELECT_TYPE_ARG234 NULL, + SELECT_TYPE_ARG5 TIMEOUT_DELAY); + if (FD_SET(m_pipefd[0], &rfds)) { + read(m_pipefd[0], buf, 15); + } #endif -// remaining-=TIMEOUT_DELAY; -// } + remaining-=TIMEOUT_DELAY; + } { // we're no longer waiting for events From a324957e2da7822e08e754eea62279d924e97dad Mon Sep 17 00:00:00 2001 From: Jamie Newbon Date: Mon, 4 May 2020 13:46:21 +0100 Subject: [PATCH 3/3] #6487 Changed timeout multiplier We belive that there was a bug in the polling function that caused it to return straight away instead of actually waiting for the timeout. --- src/lib/platform/XWindowsEventQueueBuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/platform/XWindowsEventQueueBuffer.cpp b/src/lib/platform/XWindowsEventQueueBuffer.cpp index 71e2cfba8..079dd50bc 100644 --- a/src/lib/platform/XWindowsEventQueueBuffer.cpp +++ b/src/lib/platform/XWindowsEventQueueBuffer.cpp @@ -120,7 +120,7 @@ XWindowsEventQueueBuffer::waitForEvent(double dtimeout) pfds[1].fd = m_pipefd[0]; pfds[1].events = POLLIN; int timeout = (dtimeout < 0.0) ? -1 : - static_cast(1000.0 * dtimeout); + static_cast(dtimeout); int remaining = timeout; int retval = 0; #else