]> git.mxchange.org Git - flightgear.git/blobdiff - src/Input/input.cxx
Remove unneeded inclusions of windows.h, GL.h and GLU.H
[flightgear.git] / src / Input / input.cxx
index 2547e523d12e19c12faf60996a5ee0de546ce9a4..21d96e6582f12d9dd16d9aed0f3fdbc346a0de3f 100644 (file)
 #  include <config.h>
 #endif
 
-#ifdef HAVE_WINDOWS_H
-#  include <windows.h>
-#endif
-
 #include <simgear/compiler.h>
 
 #include <math.h>
 #include <ctype.h>
 #include <sstream>
 
-#include STL_FSTREAM
-#include STL_STRING
+#include <fstream>
+#include <string>
 #include <vector>
 
 #include <simgear/compiler.h>
@@ -84,6 +80,12 @@ static FGInput * default_input = 0;
 // Local functions.
 ////////////////////////////////////////////////////////////////////////
 
+static int
+getModifiers ()
+{
+  return fgGetKeyModifiers() >> 1;
+}
+
 static bool
 getModShift ()
 {
@@ -166,6 +168,7 @@ FGInput::postinit ()
 void
 FGInput::bind ()
 {
+  fgTie("/devices/status/keyboard", getModifiers);
   fgTie("/devices/status/keyboard/shift", getModShift);
   fgTie("/devices/status/keyboard/ctrl", getModCtrl);
   fgTie("/devices/status/keyboard/alt", getModAlt);
@@ -187,6 +190,7 @@ FGInput::bind ()
 void
 FGInput::unbind ()
 {
+  fgUntie("/devices/status/keyboard");
   fgUntie("/devices/status/keyboard/shift");
   fgUntie("/devices/status/keyboard/ctrl");
   fgUntie("/devices/status/keyboard/alt");
@@ -250,7 +254,7 @@ FGInput::doKey (int k, int modifiers, int x, int y)
   }
 
   _key_code = k;
-  _key_modifiers = modifiers & ~KEYMOD_RELEASED;
+  _key_modifiers = modifiers >> 1;
   _key_pressed = !bool(modifiers & KEYMOD_RELEASED);
   _key_shift = bool(modifiers & KEYMOD_SHIFT);
   _key_ctrl = bool(modifiers & KEYMOD_CTRL);
@@ -259,11 +263,13 @@ FGInput::doKey (int k, int modifiers, int x, int y)
   _key_super = bool(modifiers & KEYMOD_SUPER);
   _key_hyper = bool(modifiers & KEYMOD_HYPER);
   _key_event->fireValueChanged();
-  if (!_key_code)
+  if (_key_code < 0)
     return;
 
   k = _key_code;
-  modifiers = _key_modifiers | (_key_pressed ? KEYMOD_NONE : KEYMOD_RELEASED);
+  modifiers = _key_modifiers << 1;
+  if (!_key_pressed)
+      modifiers |= KEYMOD_RELEASED;
   button &b = _key_bindings[k];
 
                                 // Key pressed.
@@ -317,8 +323,6 @@ FGInput::doMouseClick (int b, int updown, int x, int y, bool mainWindow, const o
   }
 
   if (mode.pass_through) {
-    // 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 (0 <= x && 0 <= y && (globals->get_current_panel() != 0) &&