Fixed: #1036 Problem when we start moving the camera in third person

This commit is contained in:
rti 2010-08-05 03:06:22 +02:00
parent 3c469007f5
commit 3460411dc1

View file

@ -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)) { };
}
}