summaryrefslogtreecommitdiff
blob: d46f8c541872558882136b425018dda17edebb16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From a83ddc5212736f89a0b94667c495494fe6861d63 Mon Sep 17 00:00:00 2001
From: Michael Palimaka <kensington@gentoo.org>
Date: Mon, 16 Jun 2014 23:52:24 +1000
Subject: Fix delay with QClipboard and useEventLoop.

This manifests when using LibreOffice with KDE integration. When KFileDialog is
open, the clipboard is repeatedly polled causing a visible delay since using
QClipboard in "useEventLoop" mode adds 50ms delay to every single clipboard
fetch.

Change-Id: Id30cda7b983ae7c949fa270d04f772fa44fc21cd
Task-number: QTBUG-38585
---
 src/gui/kernel/qclipboard_x11.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp
index 14bf088..5f442b9 100644
--- a/src/gui/kernel/qclipboard_x11.cpp
+++ b/src/gui/kernel/qclipboard_x11.cpp
@@ -548,7 +548,8 @@ bool QX11Data::clipboardWaitForEvent(Window win, int type, XEvent *event, int ti
                 return false;
 
             XSync(X11->display, false);
-            usleep(50000);
+            if (!XPending(X11->display))
+                usleep(5000);
 
             now.start();
 
-- 
2.0.0