int modifiers = FG_MOD_NONE; // FIXME: any way to get the real ones?
mouse &m = _mouse_bindings[0];
+ mouse_mode &mode = m.modes[m.current_mode];
+
+ // Pass on to PUI and the panel if
+ // requested, and return if one of
+ // them consumes the event.
+ if (mode.pass_through) {
+ if (puMouse(b, updown, x, y))
+ return;
+ else if ((current_panel != 0) &&
+ current_panel->doMouseAction(b, updown, x, y))
+ return;
+ }
+ // OK, PUI and the panel didn't want the click
if (b >= MAX_MOUSE_BUTTONS) {
SG_LOG(SG_INPUT, SG_ALERT, "Mouse button " << b
<< " where only " << MAX_MOUSE_BUTTONS << " expected");
if (m.current_mode < 0 || m.current_mode >= m.nModes)
return;
mouse_mode &mode = m.modes[m.current_mode];
+
+ // Pass on to PUI if requested, and return
+ // if PUI consumed the event.
+ if (mode.pass_through && puMouse(x, y))
+ return;
+
+ // OK, PUI didn't want the event,
+ // so we can play with it.
if (x != m.x) {
int delta = x - m.x;
for (int i = 0; i < mode.x_bindings[modifiers].size(); i++)
// Read other properties for this mode
m.modes[j].constrained = mode_node->getBoolValue("constrained", false);
+ m.modes[j].pass_through = mode_node->getBoolValue("pass-through", false);
// Read the button bindings for this mode
m.modes[j].buttons = new button[MAX_MOUSE_BUTTONS];
FGInput::mouse_mode::mouse_mode ()
: cursor(GLUT_CURSOR_INHERIT),
constrained(false),
+ pass_through(false),
buttons(0)
{
}
}
-/**
- * Built-in command: let PUI handle a mouse click.
- *
- * button: the mouse button number, zero-based.
- * is-down: true if the button is down, false if it is up.
- * x-pos: the x position of the mouse click.
- * y-pos: the y position of the mouse click.
- */
-static bool
-do_pui_mouse_click (const SGPropertyNode * arg, SGCommandState ** state)
-{
- return puMouse(arg->getIntValue("button"),
- arg->getBoolValue("is-down") ? PU_DOWN : PU_UP,
- arg->getIntValue("x-pos"),
- arg->getIntValue("y-pos"));
-}
-
-
-/**
- * Built-in command: let PUI *or* the panel handle a mouse click.
- *
- * button: the mouse button number, zero-based.
- * is-down: true if the button is down, false if it is up.
- * x-pos: the x position of the mouse click.
- * y-pos: the y position of the mouse click.
- */
-static bool
-do_pui_or_panel_mouse_click (const SGPropertyNode * arg,
- SGCommandState ** state)
-{
- int button = arg->getIntValue("button");
- bool is_down = arg->getBoolValue("is-down");
- int x = arg->getIntValue("x-pos");
- int y = arg->getIntValue("y-pos");
- return (puMouse(button, is_down ? PU_DOWN : PU_UP, x, y) ||
- (current_panel != 0 &&
- current_panel->doMouseAction(button,
- is_down ? PU_DOWN : PU_UP, x, y)));
-}
-
-
/**
* Built-in command: (re)load the panel.
*
{ "exit", do_exit },
{ "load", do_load },
{ "save", do_save },
- { "pui-mouse-click", do_pui_mouse_click },
- { "pui-or-panel-mouse-click", do_pui_or_panel_mouse_click },
{ "panel-load", do_panel_load },
{ "panel-mouse-click", do_panel_mouse_click },
{ "preferences-load", do_preferences_load },