1 // input.cxx -- handle user input from various sources.
3 // Written by David Megginson, started May 2001.
5 // Copyright (C) 2001 David Megginson, david@megginson.com
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31 #include <simgear/compiler.h>
44 #include <simgear/compiler.h>
46 #include <simgear/constants.h>
47 #include <simgear/debug/logstream.hxx>
48 #include <simgear/misc/props.hxx>
50 #include <Aircraft/aircraft.hxx>
51 #include <Autopilot/auto_gui.hxx>
52 #include <Autopilot/newauto.hxx>
53 #include <Cockpit/hud.hxx>
54 #include <Cockpit/panel.hxx>
55 #include <Cockpit/panel_io.hxx>
58 #include <Main/globals.hxx>
59 #include <Main/fg_props.hxx>
63 #if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
64 SG_USING_STD(ifstream);
71 ////////////////////////////////////////////////////////////////////////
72 // Local data structures.
73 ////////////////////////////////////////////////////////////////////////
76 ////////////////////////////////////////////////////////////////////////
77 // Implementation of FGBinding.
78 ////////////////////////////////////////////////////////////////////////
80 FGBinding::FGBinding ()
82 _arg(new SGPropertyNode),
88 FGBinding::FGBinding (const SGPropertyNode * node)
90 _arg(new SGPropertyNode),
97 FGBinding::~FGBinding ()
99 // delete _arg; // Delete the saved arguments
100 // delete _command_state; // Delete the saved command state
104 FGBinding::read (const SGPropertyNode * node)
106 const SGPropertyNode * conditionNode = node->getChild("condition");
107 if (conditionNode != 0) {
108 cerr << "Adding condition to binding" << endl;
109 setCondition(fgReadCondition(conditionNode));
112 _command_name = node->getStringValue("command", "");
113 if (_command_name.empty()) {
114 SG_LOG(SG_INPUT, SG_WARN, "No command supplied for binding.");
119 _command = globals->get_commands()->getCommand(_command_name);
121 SG_LOG(SG_INPUT, SG_ALERT, "Command " << _command_name << " is undefined");
127 _arg = new SGPropertyNode;
129 copyProperties(node, _arg); // FIXME: don't use whole node!!!
133 FGBinding::fire () const
137 SG_LOG(SG_INPUT, SG_WARN, "No command attached to binding");
138 } else if (!(*_command)(_arg, &_command_state)) {
139 SG_LOG(SG_INPUT, SG_ALERT, "Failed to execute command "
146 FGBinding::fire (int x, int y) const
150 _arg->setIntValue("x-pos", x);
152 _arg->setIntValue("y-pos", y);
158 FGBinding::fire (double setting) const
161 // A value is automatically added to
163 if (_setting == 0) // save the setting node for efficiency
164 _setting = _arg->getChild("setting", 0, true);
165 _setting->setDoubleValue(setting);
172 ////////////////////////////////////////////////////////////////////////
173 // Implementation of FGInput.
174 ////////////////////////////////////////////////////////////////////////
177 extern void fgReshape( int width, int height );
179 FGInput current_input;
183 : _current_mouse_mode(-1),
215 FGInput::update (int dt)
223 FGInput::doKey (int k, int modifiers, int x, int y)
225 SG_LOG( SG_INPUT, SG_DEBUG, "User pressed key " << k
226 << " with modifiers " << modifiers );
229 if (k < 0 || k >= MAX_KEYS) {
230 SG_LOG(SG_INPUT, SG_WARN, "Key value " << k << " out of range");
234 button &b = _key_bindings[k];
237 if (modifiers&FG_MOD_UP == 0) {
238 SG_LOG( SG_INPUT, SG_DEBUG, "User pressed key " << k
239 << " with modifiers " << modifiers );
240 if (!b.last_state || b.is_repeatable) {
241 const binding_list_t &bindings =
242 _find_key_bindings(k, modifiers);
243 int max = bindings.size();
245 for (int i = 0; i < max; i++)
254 SG_LOG(SG_INPUT, SG_DEBUG, "User released key " << k
255 << " with modifiers " << modifiers);
257 const binding_list_t &bindings =
258 _find_key_bindings(k, modifiers);
259 int max = bindings.size();
261 for (int i = 0; i < max; i++)
269 // Use the old, default actions.
270 SG_LOG( SG_INPUT, SG_DEBUG, "(No user binding.)" );
271 if (modifiers&FG_MOD_UP)
274 // everything after here will be removed sooner or later...
276 if (modifiers & FG_MOD_SHIFT) {
280 HUD_brightkey( true );
284 fgHUDInit2(¤t_aircraft);
290 SG_LOG( SG_INPUT, SG_DEBUG, "" );
293 HUD_masterswitch( true );
296 fgHUDInit(¤t_aircraft); // normal HUD
301 case 256+GLUT_KEY_F6: // F6 toggles Autopilot target location
302 if ( globals->get_autopilot()->get_HeadingMode() !=
303 FGAutopilot::FG_HEADING_WAYPOINT ) {
304 globals->get_autopilot()->set_HeadingMode(
305 FGAutopilot::FG_HEADING_WAYPOINT );
306 globals->get_autopilot()->set_HeadingEnabled( true );
308 globals->get_autopilot()->set_HeadingMode(
309 FGAutopilot::FG_TC_HEADING_LOCK );
312 case 256+GLUT_KEY_F8: {// F8 toggles fog ... off fastest nicest...
313 const string &fog = fgGetString("/sim/rendering/fog");
314 if (fog == "disabled") {
315 fgSetString("/sim/rendering/fog", "fastest");
316 SG_LOG(SG_INPUT, SG_INFO, "Fog enabled, hint=fastest");
317 } else if (fog == "fastest") {
318 fgSetString("/sim/rendering/fog", "nicest");
319 SG_LOG(SG_INPUT, SG_INFO, "Fog enabled, hint=nicest");
320 } else if (fog == "nicest") {
321 fgSetString("/sim/rendering/fog", "disabled");
322 SG_LOG(SG_INPUT, SG_INFO, "Fog disabled");
324 fgSetString("/sim/rendering/fog", "disabled");
325 SG_LOG(SG_INPUT, SG_ALERT, "Unrecognized fog type "
326 << fog << ", changed to 'disabled'");
330 case 256+GLUT_KEY_F10: // F10 toggles menu on and off...
331 SG_LOG(SG_INPUT, SG_INFO, "Invoking call back function");
334 case 256+GLUT_KEY_F11: // F11 Altitude Dialog.
335 SG_LOG(SG_INPUT, SG_INFO, "Invoking Altitude call back function");
338 case 256+GLUT_KEY_F12: // F12 Heading Dialog...
339 SG_LOG(SG_INPUT, SG_INFO, "Invoking Heading call back function");
350 FGInput::doMouseClick (int b, int updown, int x, int y)
352 std::cout << "Mouse click " << b << ',' << updown << std::endl;
353 int modifiers = FG_MOD_NONE; // FIXME: any way to get the real ones?
355 if (b >= MAX_MOUSE_BUTTONS) {
356 SG_LOG(SG_INPUT, SG_ALERT, "Mouse button " << b
357 << " where only " << MAX_MOUSE_BUTTONS << " expected");
361 _update_button(_mouse_bindings[0].buttons[b], modifiers, updown, x, y);
365 FGInput::doMouseMotion (int x, int y)
371 FGInput::_init_keyboard ()
373 // TODO: zero the old bindings first.
374 SG_LOG(SG_INPUT, SG_DEBUG, "Initializing key bindings");
375 SGPropertyNode * key_nodes = fgGetNode("/input/keyboard");
376 if (key_nodes == 0) {
377 SG_LOG(SG_INPUT, SG_WARN, "No key bindings (/input/keyboard)!!");
378 key_nodes = fgGetNode("/input/keyboard", true);
381 vector<SGPropertyNode *> keys = key_nodes->getChildren("key");
382 for (unsigned int i = 0; i < keys.size(); i++) {
383 int index = keys[i]->getIndex();
384 SG_LOG(SG_INPUT, SG_DEBUG, "Binding key " << index);
385 _key_bindings[index].is_repeatable = keys[i]->getBoolValue("repeatable");
386 _read_bindings(keys[i], _key_bindings[index].bindings, FG_MOD_NONE);
392 FGInput::_init_joystick ()
394 // TODO: zero the old bindings first.
395 SG_LOG(SG_INPUT, SG_DEBUG, "Initializing joystick bindings");
396 SGPropertyNode * js_nodes = fgGetNode("/input/joysticks");
398 SG_LOG(SG_INPUT, SG_WARN, "No joystick bindings (/input/joysticks)!!");
399 js_nodes = fgGetNode("/input/joysticks", true);
402 for (int i = 0; i < MAX_JOYSTICKS; i++) {
403 SGPropertyNode * js_node = js_nodes->getChild("js", i);
405 SG_LOG(SG_INPUT, SG_DEBUG, "No bindings for joystick " << i);
406 js_node = js_nodes->getChild("js", i, true);
408 jsJoystick * js = new jsJoystick(i);
409 _joystick_bindings[i].js = js;
410 if (js->notWorking()) {
411 SG_LOG(SG_INPUT, SG_WARN, "Joystick " << i << " not found");
416 joyGetDevCaps( i, &jsCaps, sizeof(jsCaps) );
417 int nbuttons = jsCaps.wNumButtons;
418 if (nbuttons > MAX_JOYSTICK_BUTTONS) nbuttons = MAX_JOYSTICK_BUTTONS;
420 int nbuttons = MAX_JOYSTICK_BUTTONS;
423 int naxes = js->getNumAxes();
424 if (naxes > MAX_JOYSTICK_AXES) naxes = MAX_JOYSTICK_AXES;
425 _joystick_bindings[i].naxes = naxes;
426 _joystick_bindings[i].nbuttons = nbuttons;
428 SG_LOG(SG_INPUT, SG_DEBUG, "Initializing joystick " << i);
430 // Set up range arrays
431 float minRange[MAX_JOYSTICK_AXES];
432 float maxRange[MAX_JOYSTICK_AXES];
433 float center[MAX_JOYSTICK_AXES];
435 // Initialize with default values
436 js->getMinRange(minRange);
437 js->getMaxRange(maxRange);
438 js->getCenter(center);
440 // Allocate axes and buttons
441 _joystick_bindings[i].axes = new axis[naxes];
442 _joystick_bindings[i].buttons = new button[nbuttons];
446 // Initialize the axes.
449 for (j = 0; j < naxes; j++) {
450 const SGPropertyNode * axis_node = js_node->getChild("axis", j);
451 if (axis_node == 0) {
452 SG_LOG(SG_INPUT, SG_DEBUG, "No bindings for axis " << j);
453 axis_node = js_node->getChild("axis", j, true);
456 axis &a = _joystick_bindings[i].axes[j];
458 js->setDeadBand(j, axis_node->getDoubleValue("dead-band", 0.0));
460 a.tolerance = axis_node->getDoubleValue("tolerance", 0.002);
461 minRange[j] = axis_node->getDoubleValue("min-range", minRange[j]);
462 maxRange[j] = axis_node->getDoubleValue("max-range", maxRange[j]);
463 center[j] = axis_node->getDoubleValue("center", center[j]);
465 _read_bindings(axis_node, a.bindings, FG_MOD_NONE);
467 // Initialize the virtual axis buttons.
468 _init_button(axis_node->getChild("low"), a.low, "low");
469 a.low_threshold = axis_node->getDoubleValue("low-threshold", -0.9);
471 _init_button(axis_node->getChild("high"), a.high, "high");
472 a.high_threshold = axis_node->getDoubleValue("high-threshold", 0.9);
476 // Initialize the buttons.
479 for (j = 0; j < nbuttons; j++) {
480 sprintf(buf, "%d", j);
481 SG_LOG(SG_INPUT, SG_DEBUG, "Initializing button " << j);
482 _init_button(js_node->getChild("button", j),
483 _joystick_bindings[i].buttons[j],
488 js->setMinRange(minRange);
489 js->setMaxRange(maxRange);
490 js->setCenter(center);
495 // Map of all known GLUT cursor names
500 } mouse_cursor_map[] = {
501 { "right-arrow", GLUT_CURSOR_RIGHT_ARROW },
502 { "left-arrow", GLUT_CURSOR_LEFT_ARROW },
503 { "info", GLUT_CURSOR_INFO },
504 { "destroy", GLUT_CURSOR_DESTROY },
505 { "help", GLUT_CURSOR_HELP },
506 { "cycle", GLUT_CURSOR_CYCLE },
507 { "spray", GLUT_CURSOR_SPRAY },
508 { "wait", GLUT_CURSOR_WAIT },
509 { "text", GLUT_CURSOR_TEXT },
510 { "crosshair", GLUT_CURSOR_CROSSHAIR },
511 { "up-down", GLUT_CURSOR_UP_DOWN },
512 { "left-right", GLUT_CURSOR_LEFT_RIGHT },
513 { "top-side", GLUT_CURSOR_TOP_SIDE },
514 { "bottom-side", GLUT_CURSOR_BOTTOM_SIDE },
515 { "left-side", GLUT_CURSOR_LEFT_SIDE },
516 { "right-side", GLUT_CURSOR_RIGHT_SIDE },
517 { "top-left-corner", GLUT_CURSOR_TOP_LEFT_CORNER },
518 { "top-right-corner", GLUT_CURSOR_TOP_RIGHT_CORNER },
519 { "bottom-right-corner", GLUT_CURSOR_BOTTOM_RIGHT_CORNER },
520 { "bottom-left-corner", GLUT_CURSOR_BOTTOM_LEFT_CORNER },
521 { "inherit", GLUT_CURSOR_INHERIT },
522 { "none", GLUT_CURSOR_NONE },
523 { "full-crosshair", GLUT_CURSOR_FULL_CROSSHAIR },
530 FGInput::_init_mouse ()
532 SG_LOG(SG_INPUT, SG_DEBUG, "Initializing mouse bindings");
534 SGPropertyNode * mouse_nodes = fgGetNode("/input/mice");
535 if (mouse_nodes == 0) {
536 SG_LOG(SG_INPUT, SG_WARN, "No mouse bindings (/input/mice)!!");
537 mouse_nodes = fgGetNode("/input/mice", true);
541 for (int i = 0; i < MAX_MICE; i++) {
542 SGPropertyNode * mouse_node = mouse_nodes->getChild("mouse", i);
544 // Read the cursor type for each mode.
545 _mouse_bindings[i].nModes = mouse_node->getIntValue("mode-count", 1);
546 _mouse_bindings[i].cursors = new int[_mouse_bindings[i].nModes];
547 SGPropertyNode * cursor_nodes =
548 mouse_node->getChild("mode-cursors", 0, true);
549 for (j = 0; j < _mouse_bindings[i].nModes; j++) {
550 const char * name = cursor_nodes->getChild("cursor", j, true)
554 _mouse_bindings[i].cursors[j] = GLUT_CURSOR_INHERIT;
555 for (int k = 0; mouse_cursor_map[k].name != 0; k++) {
556 if (!strcmp(mouse_cursor_map[k].name, name)) {
557 _mouse_bindings[i].cursors[j] = mouse_cursor_map[k].cursor;
563 // Read the binding for each button
564 _mouse_bindings[i].buttons = new button[MAX_MOUSE_BUTTONS];
565 if (mouse_node == 0) {
566 SG_LOG(SG_INPUT, SG_DEBUG, "No bindings for mouse " << i);
567 mouse_node = mouse_nodes->getChild("mouse", i, true);
570 for (j = 0; j < MAX_MOUSE_BUTTONS; j++) {
571 sprintf(buf, "%d", j);
572 SG_LOG(SG_INPUT, SG_DEBUG, "Initializing mouse button " << j);
573 _init_button(mouse_node->getChild("button", j),
574 _mouse_bindings[i].buttons[j],
582 FGInput::_init_button (const SGPropertyNode * node,
587 SG_LOG(SG_INPUT, SG_DEBUG, "No bindings for button " << name);
589 b.is_repeatable = node->getBoolValue("repeatable", b.is_repeatable);
591 // Get the bindings for the button
592 _read_bindings(node, b.bindings, FG_MOD_NONE);
598 FGInput::_update_keyboard ()
605 FGInput::_update_joystick ()
607 int modifiers = FG_MOD_NONE; // FIXME: any way to get the real ones?
609 // float js_val, diff;
610 float axis_values[MAX_JOYSTICK_AXES];
615 for ( i = 0; i < MAX_JOYSTICKS; i++) {
617 jsJoystick * js = _joystick_bindings[i].js;
618 if (js == 0 || js->notWorking())
621 js->read(&buttons, axis_values);
624 // Fire bindings for the axes.
625 for ( j = 0; j < _joystick_bindings[i].naxes; j++) {
626 axis &a = _joystick_bindings[i].axes[j];
628 // Do nothing if the axis position
629 // is unchanged; only a change in
630 // position fires the bindings.
631 if (fabs(axis_values[j] - a.last_value) > a.tolerance) {
632 // SG_LOG(SG_INPUT, SG_DEBUG, "Axis " << j << " has moved");
634 a.last_value = axis_values[j];
635 // SG_LOG(SG_INPUT, SG_DEBUG, "There are "
636 // << a.bindings[modifiers].size() << " bindings");
637 for (unsigned int k = 0; k < a.bindings[modifiers].size(); k++)
638 a.bindings[modifiers][k]->fire(axis_values[j]);
641 // do we have to emulate axis buttons?
642 if (a.low.bindings[modifiers].size())
643 _update_button(_joystick_bindings[i].axes[j].low,
645 axis_values[j] < a.low_threshold,
648 if (a.high.bindings[modifiers].size())
649 _update_button(_joystick_bindings[i].axes[j].high,
651 axis_values[j] > a.high_threshold,
655 // Fire bindings for the buttons.
656 for (j = 0; j < _joystick_bindings[i].nbuttons; j++) {
657 _update_button(_joystick_bindings[i].buttons[j],
659 (buttons & (1 << j)) > 0,
666 FGInput::_update_mouse ()
668 _current_mouse_mode = fgGetInt("/input/mice/mouse[0]/mode");
669 if (_current_mouse_mode != _last_mouse_mode) {
670 _last_mouse_mode = _current_mouse_mode;
671 if (_current_mouse_mode >= 0
672 && _current_mouse_mode < _mouse_bindings[0].nModes) {
673 glutSetCursor(_mouse_bindings[0].cursors[_current_mouse_mode]);
675 SG_LOG(SG_INPUT, SG_DEBUG, "Mouse mode "
676 << _current_mouse_mode << " out of range");
677 glutSetCursor(GLUT_CURSOR_INHERIT);
683 FGInput::_update_button (button &b, int modifiers, bool pressed,
687 // The press event may be repeated.
688 if (!b.last_state || b.is_repeatable) {
689 SG_LOG( SG_INPUT, SG_DEBUG, "Button has been pressed" );
690 for (unsigned int k = 0; k < b.bindings[modifiers].size(); k++)
691 b.bindings[modifiers][k]->fire(x, y);
694 // The release event is never repeated.
696 SG_LOG( SG_INPUT, SG_DEBUG, "Button has been released" );
697 for (unsigned int k = 0; k < b.bindings[modifiers|FG_MOD_UP].size(); k++)
698 b.bindings[modifiers|FG_MOD_UP][k]->fire(x, y);
702 b.last_state = pressed;
707 FGInput::_read_bindings (const SGPropertyNode * node,
708 binding_list_t * binding_list,
711 SG_LOG(SG_INPUT, SG_DEBUG, "Reading all bindings");
712 vector<const SGPropertyNode *> bindings = node->getChildren("binding");
713 for (unsigned int i = 0; i < bindings.size(); i++) {
714 SG_LOG(SG_INPUT, SG_DEBUG, "Reading binding "
715 << bindings[i]->getStringValue("command"));
716 binding_list[modifiers].push_back(new FGBinding(bindings[i]));
719 // Read nested bindings for modifiers
720 if (node->getChild("mod-up") != 0)
721 _read_bindings(node->getChild("mod-up"), binding_list,
722 modifiers|FG_MOD_UP);
724 if (node->getChild("mod-shift") != 0)
725 _read_bindings(node->getChild("mod-shift"), binding_list,
726 modifiers|FG_MOD_SHIFT);
728 if (node->getChild("mod-ctrl") != 0)
729 _read_bindings(node->getChild("mod-ctrl"), binding_list,
730 modifiers|FG_MOD_CTRL);
732 if (node->getChild("mod-alt") != 0)
733 _read_bindings(node->getChild("mod-alt"), binding_list,
734 modifiers|FG_MOD_ALT);
738 const vector<FGBinding *> &
739 FGInput::_find_key_bindings (unsigned int k, int modifiers)
741 button &b = _key_bindings[k];
743 // Try it straight, first.
744 if (b.bindings[modifiers].size() > 0)
745 return b.bindings[modifiers];
747 // Try removing the control modifier
749 else if ((modifiers&FG_MOD_CTRL) && iscntrl(k))
750 return _find_key_bindings(k, modifiers&~FG_MOD_CTRL);
752 // Try removing shift modifier
753 // for upper case or any punctuation
754 // (since different keyboards will
755 // shift different punctuation types)
756 else if ((modifiers&FG_MOD_SHIFT) && (isupper(k) || ispunct(k)))
757 return _find_key_bindings(k, modifiers&~FG_MOD_SHIFT);
759 // Try removing alt modifier for
760 // high-bit characters.
761 else if ((modifiers&FG_MOD_ALT) && k >= 128 && k < 256)
762 return _find_key_bindings(k, modifiers&~FG_MOD_ALT);
764 // Give up and return the empty vector.
766 return b.bindings[modifiers];
771 ////////////////////////////////////////////////////////////////////////
772 // Implementation of FGInput::button.
773 ////////////////////////////////////////////////////////////////////////
775 FGInput::button::button ()
776 : is_repeatable(false),
781 FGInput::button::~button ()
783 // FIXME: memory leak
784 // for (int i = 0; i < FG_MOD_MAX; i++)
785 // for (int j = 0; i < bindings[i].size(); j++)
786 // delete bindings[i][j];
791 ////////////////////////////////////////////////////////////////////////
792 // Implementation of FGInput::axis.
793 ////////////////////////////////////////////////////////////////////////
795 FGInput::axis::axis ()
796 : last_value(9999999),
803 FGInput::axis::~axis ()
805 // for (int i = 0; i < FG_MOD_MAX; i++)
806 // for (int j = 0; i < bindings[i].size(); j++)
807 // delete bindings[i][j];
812 ////////////////////////////////////////////////////////////////////////
813 // Implementation of FGInput::joystick.
814 ////////////////////////////////////////////////////////////////////////
816 FGInput::joystick::joystick ()
820 FGInput::joystick::~joystick ()
829 ////////////////////////////////////////////////////////////////////////
830 // Implementation of FGInput::mouse
831 ////////////////////////////////////////////////////////////////////////
833 FGInput::mouse::mouse ()
840 FGInput::mouse::~mouse ()
848 ////////////////////////////////////////////////////////////////////////
849 // Implementation of GLUT callbacks.
850 ////////////////////////////////////////////////////////////////////////
854 * Construct the modifiers.
856 static inline int get_mods ()
858 int glut_modifiers = glutGetModifiers();
861 if (glut_modifiers & GLUT_ACTIVE_SHIFT)
862 modifiers |= FGInput::FG_MOD_SHIFT;
863 if (glut_modifiers & GLUT_ACTIVE_CTRL)
864 modifiers |= FGInput::FG_MOD_CTRL;
865 if (glut_modifiers & GLUT_ACTIVE_ALT)
866 modifiers |= FGInput::FG_MOD_ALT;
873 ////////////////////////////////////////////////////////////////////////
875 ////////////////////////////////////////////////////////////////////////
878 GLUTkey(unsigned char k, int x, int y)
880 // Give PUI a chance to grab it first.
881 if (!puKeyboard(k, PU_DOWN))
882 current_input.doKey(k, get_mods(), x, y);
886 GLUTkeyup(unsigned char k, int x, int y)
888 current_input.doKey(k, get_mods()|FGInput::FG_MOD_UP, x, y);
892 GLUTspecialkey(int k, int x, int y)
894 // Give PUI a chance to grab it first.
895 if (!puKeyboard(k + PU_KEY_GLUT_SPECIAL_OFFSET, PU_DOWN))
896 current_input.doKey(k + 256, get_mods(), x, y);
900 GLUTspecialkeyup(int k, int x, int y)
902 current_input.doKey(k + 256, get_mods()|FGInput::FG_MOD_UP, x, y);
906 GLUTmouse (int button, int updown, int x, int y)
908 current_input.doMouseClick(button, updown == GLUT_DOWN, x, y);
912 GLUTmotion (int x, int y)
915 // glutPostRedisplay();
916 current_input.doMouseMotion(x, y);