aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/PeekEvent.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib/X11/PeekEvent.c')
-rw-r--r--nx-X11/lib/X11/PeekEvent.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/nx-X11/lib/X11/PeekEvent.c b/nx-X11/lib/X11/PeekEvent.c
index 218c9a6dd..ffbaa05b4 100644
--- a/nx-X11/lib/X11/PeekEvent.c
+++ b/nx-X11/lib/X11/PeekEvent.c
@@ -29,17 +29,18 @@ in this Software without prior written authorization from The Open Group.
#endif
#include "Xlibint.h"
-/*
+/*
* Return the next event in the queue,
* BUT do not remove it from the queue.
* If none found, flush and wait until there is an event to peek.
*/
int
-XPeekEvent (dpy, event)
- register Display *dpy;
- register XEvent *event;
+XPeekEvent (
+ register Display *dpy,
+ register XEvent *event)
{
+ XEvent copy;
LockDisplay(dpy);
if (dpy->head == NULL)
_XReadEvents(dpy);
@@ -47,9 +48,13 @@ XPeekEvent (dpy, event)
if (_XGetIOError(dpy)) {
UnlockDisplay(dpy);
return 1;
- }
+ }
#endif
*event = (dpy->head)->event;
+ if (_XCopyEventCookie(dpy, &event->xcookie, &copy.xcookie)) {
+ _XStoreEventCookie(dpy, &copy);
+ *event = copy;
+ }
UnlockDisplay(dpy);
return 1;
}