1 |
wired 09/10/30 09:24:22 |
2 |
|
3 |
Added: synergy-1.3.1-stuttered-delay-fix.patch |
4 |
Log: |
5 |
added patch that reduces delays - bug 257794 |
6 |
(Portage version: 2.2_rc46/cvs/Linux x86_64) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 x11-misc/synergy/files/synergy-1.3.1-stuttered-delay-fix.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/x11-misc/synergy/files/synergy-1.3.1-stuttered-delay-fix.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/x11-misc/synergy/files/synergy-1.3.1-stuttered-delay-fix.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: synergy-1.3.1-stuttered-delay-fix.patch |
15 |
=================================================================== |
16 |
--- synergy-1.3.1/lib/platform/CXWindowsEventQueueBuffer.cpp 2005-04-24 12:32:16.000000000 +0930 |
17 |
+++ synergy-1.3.1/lib/platform/CXWindowsEventQueueBuffer.cpp 2008-10-02 11:14:18.112098206 +0930 |
18 |
@@ -84,6 +73,8 @@ |
19 |
pfds[0].events = POLLIN; |
20 |
int timeout = (dtimeout < 0.0) ? -1 : |
21 |
static_cast<int>(1000.0 * dtimeout); |
22 |
+ int remaining = timeout; |
23 |
+ int retval = 0; |
24 |
#else |
25 |
struct timeval timeout; |
26 |
struct timeval* timeoutPtr; |
27 |
@@ -102,19 +93,31 @@ |
28 |
FD_ZERO(&rfds); |
29 |
FD_SET(ConnectionNumber(m_display), &rfds); |
30 |
#endif |
31 |
+ // It's possible that the X server has queued events locally |
32 |
+ // in xlib's event buffer and not pushed on to the fd. Hence we |
33 |
+ // can't simply monitor the fd as we may never be woken up. |
34 |
+ // ie addEvent calls flush, XFlush may not send via the fd hence |
35 |
+ // there is an event waiting to be sent but we must exit the poll |
36 |
+ // before it can. |
37 |
+ // Instead we poll for a brief period of time (so if events |
38 |
+ // queued locally in the xlib buffer can be processed) |
39 |
+ // and continue doing this until timeout is reached. |
40 |
+ // The human eye can notice 60hz (ansi) which is 16ms, however |
41 |
+ // we want to give the cpu a chance s owe up this to 25ms |
42 |
+#define TIMEOUT_DELAY 25 |
43 |
|
44 |
- // wait for message from X server or for timeout. also check |
45 |
- // if the thread has been cancelled. poll() should return -1 |
46 |
- // with EINTR when the thread is cancelled. |
47 |
+ while( remaining > 0 && QLength(m_display)==0 && retval==0){ |
48 |
#if HAVE_POLL |
49 |
- poll(pfds, 1, timeout); |
50 |
+ retval = poll(pfds, 1, TIMEOUT_DELAY); //16ms = 60hz, but we make it > to play nicely with the cpu |
51 |
#else |
52 |
- select(ConnectionNumber(m_display) + 1, |
53 |
+ retval = select(ConnectionNumber(m_display) + 1, |
54 |
SELECT_TYPE_ARG234 &rfds, |
55 |
SELECT_TYPE_ARG234 NULL, |
56 |
SELECT_TYPE_ARG234 NULL, |
57 |
- SELECT_TYPE_ARG5 timeoutPtr); |
58 |
+ SELECT_TYPE_ARG5 TIMEOUT_DELAY); |
59 |
#endif |
60 |
+ remaining-=TIMEOUT_DELAY; |
61 |
+ } |
62 |
|
63 |
{ |
64 |
// we're no longer waiting for events |
65 |
@@ -179,7 +184,7 @@ |
66 |
CXWindowsEventQueueBuffer::isEmpty() const |
67 |
{ |
68 |
CLock lock(&m_mutex); |
69 |
- return (XPending(m_display) == 0); |
70 |
+ return (QLength(m_display) == 0 ); |
71 |
} |
72 |
|
73 |
CEventQueueTimer* |