Unbreak synergy after the X11 Xlib -> XCB switch, which
caused multi-second pauses for each event rendering it useless, due to queueing in xcb buffers not triggering X file descriptor changes. Patch from http://bugs.gentoo.org/show_bug.cgi?id=257794 OK & hint in the right direction from maintainer dim@ :)
This commit is contained in:
parent
34ded43f52
commit
ab8e840802
@ -1,9 +1,9 @@
|
||||
# $OpenBSD: Makefile,v 1.8 2009/08/10 06:33:43 kili Exp $
|
||||
# $OpenBSD: Makefile,v 1.9 2009/09/03 18:05:35 pvalchev Exp $
|
||||
|
||||
COMMENT= mouse and keyboard sharing utility
|
||||
|
||||
DISTNAME= synergy-1.3.1
|
||||
PKGNAME= ${DISTNAME}p2
|
||||
PKGNAME= ${DISTNAME}p3
|
||||
CATEGORIES= net
|
||||
|
||||
HOMEPAGE= http://synergy2.sourceforge.net/
|
||||
|
@ -1,8 +1,8 @@
|
||||
$OpenBSD: patch-lib_arch_CMultibyte_cpp,v 1.1.1.1 2005/01/25 03:58:23 mbalmer Exp $
|
||||
--- lib/arch/CMultibyte.cpp.orig Fri Jan 21 22:26:26 2005
|
||||
+++ lib/arch/CMultibyte.cpp Fri Jan 21 22:26:53 2005
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <string.h>
|
||||
$OpenBSD: patch-lib_arch_CMultibyte_cpp,v 1.2 2009/09/03 18:05:36 pvalchev Exp $
|
||||
--- lib/arch/CMultibyte.cpp.orig Tue Nov 29 20:33:24 2005
|
||||
+++ lib/arch/CMultibyte.cpp Wed Sep 2 14:18:01 2009
|
||||
@@ -24,7 +24,7 @@
|
||||
#endif
|
||||
#if HAVE_WCHAR_H || defined(_MSC_VER)
|
||||
# include <wchar.h>
|
||||
-#elif __APPLE__
|
||||
|
@ -0,0 +1,59 @@
|
||||
$OpenBSD: patch-lib_platform_CXWindowsEventQueueBuffer_cpp,v 1.1 2009/09/03 18:05:36 pvalchev Exp $
|
||||
--- lib/platform/CXWindowsEventQueueBuffer.cpp.orig Sat Apr 23 20:02:16 2005
|
||||
+++ lib/platform/CXWindowsEventQueueBuffer.cpp Wed Sep 2 14:18:24 2009
|
||||
@@ -84,6 +84,8 @@ CXWindowsEventQueueBuffer::waitForEvent(double dtimeou
|
||||
pfds[0].events = POLLIN;
|
||||
int timeout = (dtimeout < 0.0) ? -1 :
|
||||
static_cast<int>(1000.0 * dtimeout);
|
||||
+ int remaining = timeout;
|
||||
+ int retval = 0;
|
||||
#else
|
||||
struct timeval timeout;
|
||||
struct timeval* timeoutPtr;
|
||||
@@ -102,19 +104,31 @@ CXWindowsEventQueueBuffer::waitForEvent(double dtimeou
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(ConnectionNumber(m_display), &rfds);
|
||||
#endif
|
||||
+ // It's possible that the X server has queued events locally
|
||||
+ // in xlib's event buffer and not pushed on to the fd. Hence we
|
||||
+ // can't simply monitor the fd as we may never be woken up.
|
||||
+ // ie addEvent calls flush, XFlush may not send via the fd hence
|
||||
+ // there is an event waiting to be sent but we must exit the poll
|
||||
+ // before it can.
|
||||
+ // Instead we poll for a brief period of time (so if events
|
||||
+ // queued locally in the xlib buffer can be processed)
|
||||
+ // and continue doing this until timeout is reached.
|
||||
+ // The human eye can notice 60hz (ansi) which is 16ms, however
|
||||
+ // we want to give the cpu a chance s owe up this to 25ms
|
||||
+#define TIMEOUT_DELAY 25
|
||||
|
||||
- // wait for message from X server or for timeout. also check
|
||||
- // if the thread has been cancelled. poll() should return -1
|
||||
- // with EINTR when the thread is cancelled.
|
||||
+ while( remaining > 0 && QLength(m_display)==0 && retval==0){
|
||||
#if HAVE_POLL
|
||||
- poll(pfds, 1, timeout);
|
||||
+ retval = poll(pfds, 1, TIMEOUT_DELAY); //16ms = 60hz, but we make it > to play nicely with the cpu
|
||||
#else
|
||||
- select(ConnectionNumber(m_display) + 1,
|
||||
+ retval = select(ConnectionNumber(m_display) + 1,
|
||||
SELECT_TYPE_ARG234 &rfds,
|
||||
SELECT_TYPE_ARG234 NULL,
|
||||
SELECT_TYPE_ARG234 NULL,
|
||||
- SELECT_TYPE_ARG5 timeoutPtr);
|
||||
+ SELECT_TYPE_ARG5 TIMEOUT_DELAY);
|
||||
#endif
|
||||
+ remaining-=TIMEOUT_DELAY;
|
||||
+ }
|
||||
|
||||
{
|
||||
// we're no longer waiting for events
|
||||
@@ -179,7 +193,7 @@ bool
|
||||
CXWindowsEventQueueBuffer::isEmpty() const
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
- return (XPending(m_display) == 0);
|
||||
+ return (QLength(m_display) == 0 );
|
||||
}
|
||||
|
||||
CEventQueueTimer*
|
Loading…
Reference in New Issue
Block a user