#include "renderer.hxx"
#include "fg_props.hxx"
-// We need to flush all pending mouse move events past a mouse warp to avoid
-// a race condition ending in warping twice and having huge increments for the
-// second warp.
-// I am not aware of such a flush function in glut. So we emulate that by
-// ignoring mouse move events between a warp mouse and the next frame.
-static bool mouseWarped = false;
-
//
// Native glut callbacks.
// These translate the glut event model into osgGA events
static void GLUTmotion (int x, int y)
{
- if (mouseWarped || !gw.valid())
+ if (!gw.valid())
return;
gw->getEventQueue()->mouseMotion(x, y);
}
viewer->frame();
glutSwapBuffers();
glutPostRedisplay();
- mouseWarped = false;
}
static void GLUTreshape(int w, int h)
void fgWarpMouse(int x, int y)
{
- mouseWarped = true;
+ globals->get_renderer()->getManipulator()->setMouseWarped();
glutWarpPointer(x, y);
}