summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2012-01-14 12:03:10 -0800
committerAaron Plattner <aplattner@nvidia.com>2012-01-14 12:04:47 -0800
commit81f1451e0532a95723e0fc0c31f1be3554c7c620 (patch)
treee4da4666dc8214a50a84fdd3e7441240757575f7
parentbb551f654df8f647c867f79252241964521e689e (diff)
XNextEvent: Work around a bug in MachinariumHEADmachinarium-workaround
Machinarium has a bug where it sometimes handles every single MotionNotify event it gets by drawing the cursor itself, regarless of whether its rendering is keeping up. This can result in the mouse cursor lagging behind the real mouse position severely, making the game nearly unplayable. Work around this problem in libX11 by discarding all but the last MotionNotify whenever XNextEvent is called. This breaks the proper ordering of events, but works well enough for this particular game. Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
-rw-r--r--src/NextEvent.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/NextEvent.c b/src/NextEvent.c
index 69b979b..71ad354 100644
--- a/src/NextEvent.c
+++ b/src/NextEvent.c
@@ -53,6 +53,12 @@ XNextEvent (
_XDeq(dpy, NULL, qelt);
_XStoreEventCookie(dpy, event);
UnlockDisplay(dpy);
+
+ if (event->type == MotionNotify) {
+ while (XCheckTypedWindowEvent(dpy, event->xmotion.window, MotionNotify, event))
+ ;
+ }
+
return 0;
}