View | Details | Raw Unified | Return to bug 127791
Collapse All | Expand All

(-)synergy2/Makefile (-1 / +1 lines)
Lines 7-13 Link Here
7
7
8
PORTNAME=	synergy
8
PORTNAME=	synergy
9
PORTVERSION= 	1.3.1
9
PORTVERSION= 	1.3.1
10
PORTREVISION=	3
10
PORTREVISION=	4
11
CATEGORIES=	sysutils
11
CATEGORIES=	sysutils
12
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
12
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
13
MASTER_SITE_SUBDIR=	${PORTNAME}2
13
MASTER_SITE_SUBDIR=	${PORTNAME}2
(-)synergy2/files/patch-lib__platform__CXWindowsEventQueueBuffer.cpp (+58 lines)
Line 0 Link Here
1
--- ./lib/platform/CXWindowsEventQueueBuffer.cpp	2005-04-24 12:32:16.000000000 +0930
2
+++ ./lib/platform/CXWindowsEventQueueBuffer.cpp	2008-10-02 11:14:18.112098206 +0930
3
@@ -84,6 +73,8 @@
4
 	pfds[0].events = POLLIN;
5
 	int timeout    = (dtimeout < 0.0) ? -1 :
6
 						static_cast<int>(1000.0 * dtimeout);
7
+	int remaining  =  timeout;
8
+	int retval     =  0;
9
 #else
10
 	struct timeval timeout;
11
 	struct timeval* timeoutPtr;
12
@@ -102,19 +93,31 @@
13
 	FD_ZERO(&rfds);
14
 	FD_SET(ConnectionNumber(m_display), &rfds);
15
 #endif
16
+	// It's possible that the X server has queued events locally
17
+	// in xlib's event buffer and not pushed on to the fd. Hence we
18
+	// can't simply monitor the fd as we may never be woken up.
19
+	// ie addEvent calls flush, XFlush may not send via the fd hence
20
+	// there is an event waiting to be sent but we must exit the poll
21
+	// before it can.
22
+	// Instead we poll for a brief period of time (so if events
23
+	// queued locally in the xlib buffer can be processed)
24
+	// and continue doing this until timeout is reached.
25
+	// The human eye can notice 60hz (ansi) which is 16ms, however
26
+	// we want to give the cpu a chance s owe up this to 25ms
27
+#define TIMEOUT_DELAY 25
28
 
29
-	// wait for message from X server or for timeout.  also check
30
-	// if the thread has been cancelled.  poll() should return -1
31
-	// with EINTR when the thread is cancelled.
32
+	while( remaining > 0 && QLength(m_display)==0 && retval==0){
33
 #if HAVE_POLL
34
-	poll(pfds, 1, timeout);
35
+	retval = poll(pfds, 1, TIMEOUT_DELAY); //16ms = 60hz, but we make it > to play nicely with the cpu
36
 #else
37
-	select(ConnectionNumber(m_display) + 1,
38
+	retval = select(ConnectionNumber(m_display) + 1,
39
 						SELECT_TYPE_ARG234 &rfds,
40
 						SELECT_TYPE_ARG234 NULL,
41
 						SELECT_TYPE_ARG234 NULL,
42
-						SELECT_TYPE_ARG5   timeoutPtr);
43
+						SELECT_TYPE_ARG5   TIMEOUT_DELAY);
44
 #endif
45
+	    remaining-=TIMEOUT_DELAY;
46
+	}
47
 
48
 	{
49
 		// we're no longer waiting for events
50
@@ -179,7 +184,7 @@
51
 CXWindowsEventQueueBuffer::isEmpty() const
52
 {
53
 	CLock lock(&m_mutex);
54
-	return (XPending(m_display) == 0);
55
+	return (QLength(m_display) == 0 );
56
 }
57
 
58
 CEventQueueTimer*

Return to bug 127791