Browse Source

Make MenuOverlay steal key commands, remove assertion for framebuffer

tags/v0.4.0
Andrew Belt 7 years ago
parent
commit
c35c8a2e02
4 changed files with 12 additions and 4 deletions
  1. +1
    -0
      include/widgets.hpp
  2. +4
    -1
      src/app/RackScene.cpp
  3. +0
    -3
      src/gui.cpp
  4. +7
    -0
      src/widgets/MenuOverlay.cpp

+ 1
- 0
include/widgets.hpp View File

@@ -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 {


+ 4
- 1
src/app/RackScene.cpp View File

@@ -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;
}




+ 0
- 3
src/gui.cpp View File

@@ -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();



+ 7
- 0
src/widgets/MenuOverlay.cpp View File

@@ -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

Loading…
Cancel
Save