]> git.mxchange.org Git - flightgear.git/blobdiff - src/Viewer/FGEventHandler.cxx
commradio: improvements for atis speech
[flightgear.git] / src / Viewer / FGEventHandler.cxx
index c0978b1648807ce7dc6e4a27e765925569613095..601d5a7b8768aaf0264b788ddd286a031c9554f8 100644 (file)
@@ -103,6 +103,13 @@ FGEventHandler::FGEventHandler() :
     _print = fgGetNode("/sim/rendering/print-statistics", true);
 }
 
+void FGEventHandler::reset()
+{
+    _display = fgGetNode("/sim/rendering/on-screen-statistics", true);
+    _print = fgGetNode("/sim/rendering/print-statistics", true);
+    statsHandler->reset();
+}
+    
 namespace
 {
 // Translate OSG modifier mask to FG modifier mask.
@@ -185,7 +192,14 @@ bool FGEventHandler::handle(const osgGA::GUIEventAdapter& ea,
     // Event handlers seem to be called even if the according event has already
     // been handled. Already handled events shouldn't be handled multiple times
     // so we need to exit here manually.
-    if( ea.getHandled() )
+    if(    ea.getHandled()
+           // Let mouse move events pass to correctly handle mouse cursor hide
+           // timeout while moving just on the canvas gui.
+           // TODO We should clean up the whole mouse input and make hide
+           //      timeout independent of the event handler which consumed the
+           //      event.
+        && ea.getEventType() != osgGA::GUIEventAdapter::MOVE
+        && ea.getEventType() != osgGA::GUIEventAdapter::DRAG )
       return false;
 
     int x = 0;
@@ -244,6 +258,18 @@ bool FGEventHandler::handle(const osgGA::GUIEventAdapter& ea,
                 button = 4;
             else
                 button = -1;
+            
+#if defined(SG_MAC)
+            // bug https://code.google.com/p/flightgear-bugs/issues/detail?id=1286
+            // Mac (Cocoa) interprets shuft+wheel as horizontal scroll
+            if (ea.getModKeyMask() & osgGA::GUIEventAdapter::MODKEY_SHIFT) {
+                if (ea.getScrollingDeltaX() > 0)
+                    button = 3;
+                else if (ea.getScrollingDeltaX() < 0)
+                    button = 4;
+            }
+#endif
+            
         } else if (ea.getScrollingMotion() == osgGA::GUIEventAdapter::SCROLL_UP)
             button = 3;
         else