aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/winclipboardwndproc.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-07 07:51:02 +0200
committermarha <marha@users.sourceforge.net>2012-08-07 07:51:02 +0200
commitf8e35ebbe71eed74ccf68af8ccda4182f1edc7f0 (patch)
tree0451299b4aaaaf6d2423d1faf07dc9f35c9f80d8 /xorg-server/hw/xwin/winclipboardwndproc.c
parent18e75aa6ae27a6e44d93babd96afbbe0cd6077c8 (diff)
downloadvcxsrv-f8e35ebbe71eed74ccf68af8ccda4182f1edc7f0.tar.gz
vcxsrv-f8e35ebbe71eed74ccf68af8ccda4182f1edc7f0.tar.bz2
vcxsrv-f8e35ebbe71eed74ccf68af8ccda4182f1edc7f0.zip
mesa xserver xkeyboard-config git update 7 Aug 2012
Diffstat (limited to 'xorg-server/hw/xwin/winclipboardwndproc.c')
-rw-r--r--xorg-server/hw/xwin/winclipboardwndproc.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/xorg-server/hw/xwin/winclipboardwndproc.c b/xorg-server/hw/xwin/winclipboardwndproc.c
index cbe6599f4..e19f678a7 100644
--- a/xorg-server/hw/xwin/winclipboardwndproc.c
+++ b/xorg-server/hw/xwin/winclipboardwndproc.c
@@ -74,10 +74,10 @@ winProcessXEventsTimeout(HWND hwnd, int iWindow, Display * pDisplay,
int iConnNumber;
struct timeval tv;
int iReturn;
- DWORD dwStopTime = (GetTickCount() / 1000) + iTimeoutSec;
+ DWORD dwStopTime = GetTickCount() + iTimeoutSec * 1000;
- /* We need to ensure that all pending events are processed */
- XSync(pDisplay, FALSE);
+ winDebug("winProcessXEventsTimeout () - pumping X events for %d seconds\n",
+ iTimeoutSec);
/* Get our connection number */
iConnNumber = ConnectionNumber(pDisplay);
@@ -85,17 +85,24 @@ winProcessXEventsTimeout(HWND hwnd, int iWindow, Display * pDisplay,
/* Loop for X events */
while (1) {
fd_set fdsRead;
+ long remainingTime;
+
+ /* We need to ensure that all pending events are processed */
+ XSync(pDisplay, FALSE);
/* Setup the file descriptor set */
FD_ZERO(&fdsRead);
FD_SET(iConnNumber, &fdsRead);
/* Adjust timeout */
- tv.tv_sec = dwStopTime - (GetTickCount() / 1000);
- tv.tv_usec = 0;
+ remainingTime = dwStopTime - GetTickCount();
+ tv.tv_sec = remainingTime / 1000;
+ tv.tv_usec = (remainingTime % 1000) * 1000;
+ winDebug("winProcessXEventsTimeout () - %d milliseconds left\n",
+ remainingTime);
/* Break out if no time left */
- if (tv.tv_sec < 0)
+ if (remainingTime <= 0)
return WIN_XEVENTS_SUCCESS;
/* Wait for an X event */
@@ -103,7 +110,7 @@ winProcessXEventsTimeout(HWND hwnd, int iWindow, Display * pDisplay,
&fdsRead, /* Read mask */
NULL, /* No write mask */
NULL, /* No exception mask */
- &tv); /* No timeout */
+ &tv); /* Timeout */
if (iReturn < 0) {
ErrorF("winProcessXEventsTimeout - Call to select () failed: %d. "
"Bailing.\n", iReturn);
@@ -116,11 +123,19 @@ winProcessXEventsTimeout(HWND hwnd, int iWindow, Display * pDisplay,
/* Exit when we see that server is shutting down */
iReturn = winClipboardFlushXEvents(hwnd,
iWindow, pDisplay, fUseUnicode);
+
+ winDebug
+ ("winProcessXEventsTimeout () - winClipboardFlushXEvents returned %d\n",
+ iReturn);
+
if (WIN_XEVENTS_NOTIFY == iReturn) {
/* Bail out if notify processed */
return iReturn;
}
}
+ else {
+ winDebug("winProcessXEventsTimeout - Spurious wake\n");
+ }
}
return WIN_XEVENTS_SUCCESS;