]> git.mxchange.org Git - flightgear.git/commitdiff
Fix bug 1286 - mouse scroll-wheel+shift ignored
authorJames Turner <zakalawe@mac.com>
Mon, 13 Jan 2014 21:08:32 +0000 (21:08 +0000)
committerJames Turner <zakalawe@mac.com>
Mon, 13 Jan 2014 21:08:32 +0000 (21:08 +0000)
On Mac, the OS is mapping shift+wheel to horizontal scrolling for
those of us without a mighty-mouse or trackpad. Detect this case
and map back to vertical scrolling inside FlightGear for the moment.

https://code.google.com/p/flightgear-bugs/issues/detail?id=1286

src/Viewer/FGEventHandler.cxx

index c3bf622e0468930b093b749599080392f6f89ade..85d01120203a62f557f269605b673248916a699b 100644 (file)
@@ -251,6 +251,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