From cbffd494caad6388f6fe9a498436c6ca8740a315 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 4 Feb 2018 09:23:35 -0500 Subject: [PATCH] If key is consumed, RackScene should not attempt to recognize key commands --- include/util/common.hpp | 1 + src/app/RackScene.cpp | 74 +++++++++++++++++++++-------------------- 2 files changed, 39 insertions(+), 36 deletions(-) diff --git a/include/util/common.hpp b/include/util/common.hpp index dbc3e462..52ed73ed 100644 --- a/include/util/common.hpp +++ b/include/util/common.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include diff --git a/src/app/RackScene.cpp b/src/app/RackScene.cpp index 5ae0fbc5..bf1ea0ea 100644 --- a/src/app/RackScene.cpp +++ b/src/app/RackScene.cpp @@ -86,43 +86,45 @@ void RackScene::draw(NVGcontext *vg) { } void RackScene::onHoverKey(EventHoverKey &e) { - switch (e.key) { - case GLFW_KEY_N: - if (guiIsModPressed() && !guiIsShiftPressed()) { - gRackWidget->reset(); - e.consumed = true; - return; - } - break; - case GLFW_KEY_Q: - if (guiIsModPressed() && !guiIsShiftPressed()) { - guiClose(); - e.consumed = true; - return; - } - break; - case GLFW_KEY_O: - if (guiIsModPressed() && !guiIsShiftPressed()) { - gRackWidget->openDialog(); - e.consumed = true; - return; - } - break; - case GLFW_KEY_S: - if (guiIsModPressed() && !guiIsShiftPressed()) { - gRackWidget->saveDialog(); - e.consumed = true; - return; - } - if (guiIsModPressed() && guiIsShiftPressed()) { - gRackWidget->saveAsDialog(); - e.consumed = true; - return; - } - break; - } - Widget::onHoverKey(e); + + if (!e.consumed) { + switch (e.key) { + case GLFW_KEY_N: { + if (guiIsModPressed() && !guiIsShiftPressed()) { + gRackWidget->reset(); + e.consumed = true; + return; + } + } break; + case GLFW_KEY_Q: { + if (guiIsModPressed() && !guiIsShiftPressed()) { + guiClose(); + e.consumed = true; + return; + } + } break; + case GLFW_KEY_O: { + if (guiIsModPressed() && !guiIsShiftPressed()) { + gRackWidget->openDialog(); + e.consumed = true; + return; + } + } break; + case GLFW_KEY_S: { + if (guiIsModPressed() && !guiIsShiftPressed()) { + gRackWidget->saveDialog(); + e.consumed = true; + return; + } + if (guiIsModPressed() && guiIsShiftPressed()) { + gRackWidget->saveAsDialog(); + e.consumed = true; + return; + } + } break; + } + } } void RackScene::onPathDrop(EventPathDrop &e) {