]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_os_sdl.cxx
- Added ultra-light traffic is now a separate traffic class that can have its
[flightgear.git] / src / Main / fg_os_sdl.cxx
index 58602a884b9922c01b0ca2587a8ec9483436b9b7..7917832075409f7473ffa640c15a00a1ac243957 100644 (file)
@@ -112,6 +112,14 @@ void fgOSOpenWindow(int w, int h, int bpp,
     // int realh = screen->h;
 }
 
+
+struct keydata {
+    keydata() : unicode(0), mod(0) {};
+    Uint16 unicode;
+    unsigned int mod;
+} keys[SDLK_LAST];
+
+
 static void handleKey(int key, int raw, int keyup)
 {
     int modmask = 0;
@@ -173,8 +181,19 @@ static void handleKey(int key, int raw, int keyup)
         CurrentModifiers |= modmask;
         keymod = CurrentModifiers & ~KEYMOD_RELEASED;
     }
-    if(modmask == 0 && KeyHandler)
+
+    if(modmask == 0 && KeyHandler) {
+        if (keymod & KEYMOD_RELEASED) {
+            if (keys[raw].mod) {
+                key = keys[raw].unicode;
+                keys[raw].mod = 0;
+            }
+        } else {
+            keys[raw].mod = keymod;
+            keys[raw].unicode = key;
+        }
         (*KeyHandler)(key, keymod, CurrentMouseX, CurrentMouseY);
+    }
 }
 
 // FIXME: Integrate with existing fgExit() in util.cxx.
@@ -207,7 +226,7 @@ void fgOSMainLoop()
                 if(MouseClickHandler)
                     (*MouseClickHandler)(e.button.button - 1,
                                          e.button.state == SDL_RELEASED,
-                                         e.button.x, e.button.y);
+                                         e.button.x, e.button.y, true, 0);
                 break;
             case SDL_MOUSEMOTION:
                 CurrentMouseX = e.motion.x;
@@ -388,3 +407,18 @@ static void initCursors()
                                                 cursors[i].hoty);
     }
 }
+
+// Noop; the graphics context is always current
+void fgMakeCurrent()
+{
+}
+
+bool fgOSIsMainCamera(const osg::Camera*)
+{
+  return true;
+}
+
+bool fgOSIsMainContext(const osg::GraphicsContext*)
+{
+  return true;
+}