SG_USING_STD(string);
SG_USING_STD(vector);
-void mouseClickHandler(int button, int updown, int x, int y);
+void mouseClickHandler(int button, int updown, int x, int y, bool mainWindow, const osgGA::GUIEventAdapter*);
void mouseMotionHandler(int x, int y);
void keyHandler(int key, int keymod, int mousex, int mousey);
}
void
-FGInput::doMouseClick (int b, int updown, int x, int y)
+FGInput::doMouseClick (int b, int updown, int x, int y, bool mainWindow, const osgGA::GUIEventAdapter* ea)
{
int modifiers = fgGetKeyModifiers();
}
if (mode.pass_through) {
- if (puMouse(b, updown, x, y))
+ // The pu stuff seems to need that. May be it does opengl picking ...
+ fgMakeCurrent();
+ if (0 <= x && 0 <= y && puMouse(b, updown, x, y))
return;
- else if ((globals->get_current_panel() != 0) &&
+ else if (0 <= x && 0 <= y && (globals->get_current_panel() != 0) &&
globals->get_current_panel()->getVisibility() &&
globals->get_current_panel()->doMouseAction(b, updown, x, y))
return;
- else if (fgHandle3DPanelMouseEvent(b, updown, x, y))
+ else if (0 <= x && 0 <= y && fgHandle3DPanelMouseEvent(b, updown, x, y))
return;
else {
// pui didn't want the click event so compute a
// scenegraph intersection point corresponding to the mouse click
if (updown == MOUSE_BUTTON_DOWN) {
- FGScenery* scenery = globals->get_scenery();
- SGVec3d start, dir;
// Get the list of hit callbacks. Take the first callback that
// accepts the mouse button press and ignore the rest of them
// That is they get sorted by distance and by scenegraph depth.
// The nearest one is the first one and the deepest
// (the most specialized one in the scenegraph) is the first.
- if (FGRenderer::getPickInfo(start, dir, x, y)) {
- std::vector<SGSceneryPick> pickList;
- scenery->pick(start, dir, pickList);
+ std::vector<SGSceneryPick> pickList;
+ if (FGRenderer::pick(x, y, pickList, ea)) {
std::vector<SGSceneryPick>::const_iterator i;
for (i = pickList.begin(); i != pickList.end(); ++i) {
if (i->callback->buttonPressed(b, i->info)) {
_activePickCallbacks[b].push_back(i->callback);
- break;
+ return;
}
}
}
if (need_warp)
fgWarpMouse(x, y);
}
- m.x = x;
- m.y = y;
+
+ if (m.x != x)
+ fgSetInt("/devices/status/mice/mouse/x", m.x = x);
+
+ if (m.y != y)
+ fgSetInt("/devices/status/mice/mouse/y", m.y = y);
}
void
default_input->doKey(key, keymod, mousex, mousey);
}
-void mouseClickHandler(int button, int updown, int x, int y)
+void mouseClickHandler(int button, int updown, int x, int y, bool mainWindow, const osgGA::GUIEventAdapter* ea)
{
if(default_input)
- default_input->doMouseClick(button, updown, x, y);
+ default_input->doMouseClick(button, updown, x, y, mainWindow, ea);
}
void mouseMotionHandler(int x, int y)