From 0edc5f1f2c2c777aeec3f64b59e01b69b63f59b4 Mon Sep 17 00:00:00 2001 From: rti Date: Thu, 5 Aug 2010 03:06:22 +0200 Subject: [PATCH] Fixed: #1036 Problem when we start moving the camera in third person --- code/nel/src/3d/driver/opengl/unix_event_emitter.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp index 7fad62a98..2d1c969a2 100644 --- a/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp +++ b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp @@ -111,6 +111,11 @@ void CUnixEventEmitter::submitEvents(CEventServer & server, bool allWindows) _InternalServer.pump (allWindows); } +static Bool isMouseMoveEvent(Display *display, XEvent *event, XPointer arg) +{ + return (event->type == MotionNotify); +} + void CUnixEventEmitter::emulateMouseRawMode(bool enable) { _emulateRawMode = enable; @@ -121,6 +126,12 @@ void CUnixEventEmitter::emulateMouseRawMode(bool enable) XGetWindowAttributes(_dpy, _win, &xwa); XWarpPointer(_dpy, None, _win, None, None, None, None, (xwa.width / 2), (xwa.height / 2)); + + // remove all outstanding mouse move events, they happened before the mouse + // was pulled back to 0.5 / 0.5, so a wrong movement delta would be + // reported otherwise + XEvent event; + while(XCheckIfEvent(_dpy, &event, &isMouseMoveEvent, NULL)) { }; } }