From c35c8a2e02c0d2aaaf3120e2d081559531afe7d3 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Wed, 27 Sep 2017 08:08:57 -0400 Subject: [PATCH] Make MenuOverlay steal key commands, remove assertion for framebuffer --- include/widgets.hpp | 1 + src/app/RackScene.cpp | 5 ++++- src/gui.cpp | 3 --- src/widgets/MenuOverlay.cpp | 7 +++++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/widgets.hpp b/include/widgets.hpp index 353de939..f89866e0 100644 --- a/include/widgets.hpp +++ b/include/widgets.hpp @@ -258,6 +258,7 @@ struct Label : Widget { struct MenuOverlay : OpaqueWidget { void onDragDrop(Widget *origin); bool onScrollOpaque(Vec scrollRel) {return true;} + Widget *onHoverKey(Vec pos, int key); }; struct Menu : OpaqueWidget { diff --git a/src/app/RackScene.cpp b/src/app/RackScene.cpp index fc4d779b..04355f19 100644 --- a/src/app/RackScene.cpp +++ b/src/app/RackScene.cpp @@ -68,6 +68,9 @@ void RackScene::draw(NVGcontext *vg) { } Widget *RackScene::onHoverKey(Vec pos, int key) { + Widget *w = Widget::onHoverKey(pos, key); + if (w) return w; + switch (key) { case GLFW_KEY_N: if (guiIsModPressed() && !guiIsShiftPressed()) { @@ -99,7 +102,7 @@ Widget *RackScene::onHoverKey(Vec pos, int key) { break; } - return Widget::onHoverKey(pos, key); + return NULL; } diff --git a/src/gui.cpp b/src/gui.cpp index 34c1ee8b..021b9180 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -241,9 +241,6 @@ void guiInit() { err = glewInit(); assert(err == GLEW_OK); - // Check framebuffer support - assert(GLEW_EXT_framebuffer_object); - // GLEW generates GL error because it calls glGetString(GL_EXTENSIONS), we'll consume it here. glGetError(); diff --git a/src/widgets/MenuOverlay.cpp b/src/widgets/MenuOverlay.cpp index bb2a4982..e887c274 100644 --- a/src/widgets/MenuOverlay.cpp +++ b/src/widgets/MenuOverlay.cpp @@ -10,5 +10,12 @@ void MenuOverlay::onDragDrop(Widget *origin) { } } +Widget *MenuOverlay::onHoverKey(Vec pos, int key) { + Widget *w = Widget::onHoverKey(pos, key); + if (w) return w; + // Steal all keys + return this; +} + } // namespace rack