#6409 Time out read events for clipboard

This commit is contained in:
Nathan Neulinger 2019-07-02 10:27:23 -05:00 committed by Jnewbon
parent 9ce4f867a1
commit c8e1e036e2
1 changed files with 6 additions and 0 deletions

View File

@ -1333,6 +1333,12 @@ XWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display,
// process events if any otherwise sleep
if (noWait || XPending(display) > 0) {
while (!m_done && !m_failed && (noWait || XPending(display) > 0)) {
// fail if timeout has expired
if (timeout.getTime() >= s_timeout) {
m_failed = true;
break;
}
XNextEvent(display, &xevent);
if (!processEvent(display, &xevent)) {
// not processed so save it