diff options
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Events.c')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Events.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 846254e92..3e62d9097 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -3309,7 +3309,6 @@ int nxagentHandleConfigureNotify(XEvent* X) ScreenPtr pScreen = nxagentScreen(X -> xconfigure.window); Bool doRandR = False; - struct timeval timeout; if (X -> xconfigure.window == nxagentDefaultWindows[pScreen -> myNum]) { @@ -3345,10 +3344,7 @@ int nxagentHandleConfigureNotify(XEvent* X) { newEvents = False; - timeout.tv_sec = 0; - timeout.tv_usec = 500 * 1000; - - nxagentWaitEvents(nxagentDisplay, &timeout); + nxagentWaitEvents(nxagentDisplay, 500); /* * This should also flush the NX link for us. @@ -3827,7 +3823,7 @@ int nxagentWaitForResource(GetResourceFuncPtr pGetResource, PredicateFuncPtr pPr while ((resource = (*pGetResource)(nxagentDisplay)) == -1) { - if (nxagentWaitEvents(nxagentDisplay, NULL) == -1) + if (nxagentWaitEvents(nxagentDisplay, 0) == -1) { return -1; } @@ -4511,14 +4507,11 @@ int nxagentPendingEvents(Display *dpy) } /* - * Blocks until an event becomes - * available. + * Blocks until an event becomes available. */ -int nxagentWaitEvents(Display *dpy, struct timeval *tm) +int nxagentWaitEvents(Display *dpy, useconds_t msec) { - XEvent ev; - #ifdef DEBUG fprintf(stderr, "nxagentWaitEvents called.\n"); #endif @@ -4526,33 +4519,41 @@ int nxagentWaitEvents(Display *dpy, struct timeval *tm) NXFlushDisplay(dpy, NXFlushLink); /* - * If the transport is not running we - * have to rely on Xlib to wait for an - * event. In this case the timeout is - * ignored. + * If the transport is not running we have to rely on Xlib to wait + * for an event. In this case the timeout is ignored. */ if (NXTransRunning(NX_FD_ANY) == 1) { - NXTransContinue(tm); + if (msec > 0) + { + struct timeval tm = { + .tv_sec = 0, + .tv_usec = msec * 1000 + }; + NXTransContinue(&tm); + } + else + { + NXTransContinue(NULL); + } } else { + XEvent ev; XPeekEvent(dpy, &ev); } /* - * Check if we encountered a display - * error. If we did, wait for the + * Check if we encountered a display error. If we did, wait for the * time requested by the caller. */ if (NXDisplayError(dpy) == 1) { - if (tm != NULL) + if (msec > 0) { - usleep(tm -> tv_sec * 1000 * 1000 + - tm -> tv_usec); + usleep(msec * 1000); } return -1; |