From d9981b25d951730d39233e2e029c64f90c9fbe1d Mon Sep 17 00:00:00 2001 From: joaquins Date: Fri, 23 Dec 2016 11:13:00 -0800 Subject: [PATCH] Fixes #4085: Horus simulator rotary control improvements (#4087) * Fix for issue with trackpad & mouse wheel: Small movements up or down send delta=0, causing always events in the same direction. * Changed keys to X,C --- companion/src/simulation/simulatordialog.cpp | 11 ++++++++++- radio/src/simu.cpp | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/companion/src/simulation/simulatordialog.cpp b/companion/src/simulation/simulatordialog.cpp index 3842df120..90018265c 100644 --- a/companion/src/simulation/simulatordialog.cpp +++ b/companion/src/simulation/simulatordialog.cpp @@ -70,7 +70,9 @@ void SimulatorDialog::updateDebugOutput() void SimulatorDialog::wheelEvent (QWheelEvent *event) { - simulator->wheelEvent(event->delta() > 0 ? 1 : -1); + if ( event->delta() != 0) { + simulator->wheelEvent(event->delta() > 0 ? 1 : -1); + } } SimulatorDialog::SimulatorDialog(QWidget * parent, SimulatorInterface *simulator, unsigned int flags): @@ -220,6 +222,13 @@ void SimulatorDialog::keyPressEvent (QKeyEvent *event) case Qt::Key_PageUp: buttonPressed = event->key(); break; + case Qt::Key_X: + simulator->wheelEvent(-1); + break; + case Qt::Key_C: + simulator->wheelEvent(1); + break; + } } diff --git a/radio/src/simu.cpp b/radio/src/simu.cpp index 07c0d6578..3c1280cc7 100644 --- a/radio/src/simu.cpp +++ b/radio/src/simu.cpp @@ -360,11 +360,11 @@ long Open9xSim::onTimeout(FXObject*, FXSelector, void*) #if defined(ROTARY_ENCODER_NAVIGATION) static bool rotencAction = false; - if (getApp()->getKeyState(KEY_X)) { + if (getApp()->getKeyState(KEY_C)) { if (!rotencAction) ROTARY_ENCODER_NAVIGATION_VALUE += ROTARY_ENCODER_GRANULARITY; rotencAction = true; } - else if (getApp()->getKeyState(KEY_W) || getApp()->getKeyState(KEY_Z)) { + else if (getApp()->getKeyState(KEY_X)) { if (!rotencAction) ROTARY_ENCODER_NAVIGATION_VALUE -= ROTARY_ENCODER_GRANULARITY; rotencAction = true; }