diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-10-12 08:32:04 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-10-12 08:32:04 +0200 |
commit | 051d521f6e20761ba6831cecd91883da960fa931 (patch) | |
tree | b28abba7818115d2fed80eb360a79a0f9183948e /nx-X11/lib/X11/PutBEvent.c | |
parent | 6dce607bad8711dd06a5a7b69ad1930386b4123b (diff) | |
parent | b8de7bf654929c823080b211aeac56cd213f5a32 (diff) | |
download | nx-libs-051d521f6e20761ba6831cecd91883da960fa931.tar.gz nx-libs-051d521f6e20761ba6831cecd91883da960fa931.tar.bz2 nx-libs-051d521f6e20761ba6831cecd91883da960fa931.zip |
Merge branch 'uli42-pr/upgrade_libX11' into 3.6.x
Attributes GH PR #214: https://github.com/ArcticaProject/nx-libs/pull/214
Fixes ArcticaProject/nx-libs#157.
Diffstat (limited to 'nx-X11/lib/X11/PutBEvent.c')
-rw-r--r-- | nx-X11/lib/X11/PutBEvent.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/nx-X11/lib/X11/PutBEvent.c b/nx-X11/lib/X11/PutBEvent.c index 63c92e627..f9d4c29bd 100644 --- a/nx-X11/lib/X11/PutBEvent.c +++ b/nx-X11/lib/X11/PutBEvent.c @@ -34,10 +34,11 @@ from The Open Group. int _XPutBackEvent ( - register Display *dpy, + register Display *dpy, register XEvent *event) { register _XQEvent *qelt; + XEvent store = *event; if (!dpy->qfree) { if ((dpy->qfree = (_XQEvent *) Xmalloc (sizeof (_XQEvent))) == NULL) { @@ -45,11 +46,26 @@ _XPutBackEvent ( } dpy->qfree->next = NULL; } + + /* unclaimed cookie? */ + if (_XIsEventCookie(dpy, event)) + { + XEvent copy = {0}; + /* if not claimed, then just fetch and store again */ + if (!event->xcookie.data) { + _XFetchEventCookie(dpy, &event->xcookie); + store = *event; + } else { /* if claimed, copy, client must free */ + _XCopyEventCookie(dpy, &event->xcookie, ©.xcookie); + store = copy; + } + } + qelt = dpy->qfree; dpy->qfree = qelt->next; qelt->qserial_num = dpy->next_event_serial_num++; qelt->next = dpy->head; - qelt->event = *event; + qelt->event = store; dpy->head = qelt; if (dpy->tail == NULL) dpy->tail = qelt; @@ -59,7 +75,7 @@ _XPutBackEvent ( int XPutBackEvent ( - register Display * dpy, + register Display * dpy, register XEvent *event) { int ret; |