| @@ -28,6 +28,7 @@ struct EventMouseDown : EventPosition { | |||||
| }; | }; | ||||
| struct EventMouseUp : EventPosition { | struct EventMouseUp : EventPosition { | ||||
| /** 0 for left mouse button, 1 for right, 2 for middle */ | |||||
| int button; | int button; | ||||
| Widget *target = NULL; | Widget *target = NULL; | ||||
| }; | }; | ||||
| @@ -45,6 +45,8 @@ Vec windowGetWindowPos(); | |||||
| void windowSetWindowPos(Vec pos); | void windowSetWindowPos(Vec pos); | ||||
| bool windowIsMaximized(); | bool windowIsMaximized(); | ||||
| void windowSetTheme(NVGcolor bg, NVGcolor fg); | void windowSetTheme(NVGcolor bg, NVGcolor fg); | ||||
| void windowSetFullScreen(bool fullScreen); | |||||
| bool windowGetFullScreen(); | |||||
| } // namespace rack | } // namespace rack | ||||
| @@ -84,6 +84,9 @@ void RackScene::onHoverKey(EventHoverKey &e) { | |||||
| appModuleBrowserCreate(); | appModuleBrowserCreate(); | ||||
| e.consumed = true; | e.consumed = true; | ||||
| } break; | } break; | ||||
| case GLFW_KEY_F11: { | |||||
| windowSetFullScreen(!windowGetFullScreen()); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -62,10 +62,9 @@ void Widget::addChild(Widget *widget) { | |||||
| void Widget::removeChild(Widget *widget) { | void Widget::removeChild(Widget *widget) { | ||||
| assert(widget->parent == this); | assert(widget->parent == this); | ||||
| auto it = std::find(children.begin(), children.end(), widget); | auto it = std::find(children.begin(), children.end(), widget); | ||||
| if (it != children.end()) { | |||||
| children.erase(it); | |||||
| widget->parent = NULL; | |||||
| } | |||||
| assert(it != children.end()); | |||||
| children.erase(it); | |||||
| widget->parent = NULL; | |||||
| } | } | ||||
| void Widget::clearChildren() { | void Widget::clearChildren() { | ||||
| @@ -607,6 +607,29 @@ void windowSetTheme(NVGcolor bg, NVGcolor fg) { | |||||
| bndSetTheme(t); | bndSetTheme(t); | ||||
| } | } | ||||
| static int windowX = 0; | |||||
| static int windowY = 0; | |||||
| static int windowWidth = 0; | |||||
| static int windowHeight = 0; | |||||
| void windowSetFullScreen(bool fullScreen) { | |||||
| if (windowGetFullScreen()) { | |||||
| glfwSetWindowMonitor(gWindow, NULL, windowX, windowY, windowWidth, windowHeight, GLFW_DONT_CARE); | |||||
| } | |||||
| else { | |||||
| glfwGetWindowPos(gWindow, &windowX, &windowY); | |||||
| glfwGetWindowSize(gWindow, &windowWidth, &windowHeight); | |||||
| GLFWmonitor *monitor = glfwGetPrimaryMonitor(); | |||||
| const GLFWvidmode* mode = glfwGetVideoMode(monitor); | |||||
| glfwSetWindowMonitor(gWindow, monitor, 0, 0, mode->width, mode->height, mode->refreshRate); | |||||
| } | |||||
| } | |||||
| bool windowGetFullScreen() { | |||||
| GLFWmonitor *monitor = glfwGetWindowMonitor(gWindow); | |||||
| return monitor != NULL; | |||||
| } | |||||
| //////////////////// | //////////////////// | ||||
| // resources | // resources | ||||