From 04822346a6530557d58abe9c800ab44b6d0c57d9 Mon Sep 17 00:00:00 2001 From: Bruno Herbelin Date: Mon, 3 Apr 2023 23:38:59 +0200 Subject: [PATCH] Use CTRL+F to toggle Fullscreen for all window types Main window and output windows use same keyboard shortcut for uniformity. --- src/ControlManager.cpp | 28 +++++++++++++++------------- src/RenderingManager.cpp | 6 ++---- src/UserInterfaceManager.cpp | 3 --- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/ControlManager.cpp b/src/ControlManager.cpp index a86d300..5ffb176 100644 --- a/src/ControlManager.cpp +++ b/src/ControlManager.cpp @@ -1184,23 +1184,25 @@ void Control::sendOutputStatus(const IpEndpointName &remoteEndpoint) void Control::keyboardCalback(GLFWwindow* w, int key, int, int action, int mods) { - if (UserInterface::manager().keyboardAvailable() && !mods ) + if (UserInterface::manager().keyboardAvailable()) { - int _key = layoutKey(key); - Control::manager().input_access_.lock(); - if (_key >= GLFW_KEY_A && _key <= GLFW_KEY_Z) { - Control::manager().input_active[INPUT_KEYBOARD_FIRST + _key - GLFW_KEY_A] = action > GLFW_RELEASE; - Control::manager().input_values[INPUT_KEYBOARD_FIRST + _key - GLFW_KEY_A] = action > GLFW_RELEASE ? 1.f : 0.f; + if ( !mods ) { + int _key = layoutKey(key); + Control::manager().input_access_.lock(); + if (_key >= GLFW_KEY_A && _key <= GLFW_KEY_Z) { + Control::manager().input_active[INPUT_KEYBOARD_FIRST + _key - GLFW_KEY_A] = action > GLFW_RELEASE; + Control::manager().input_values[INPUT_KEYBOARD_FIRST + _key - GLFW_KEY_A] = action > GLFW_RELEASE ? 1.f : 0.f; + } + else if (_key >= GLFW_KEY_KP_0 && _key <= GLFW_KEY_KP_EQUAL) { + Control::manager().input_active[INPUT_NUMPAD_FIRST + _key - GLFW_KEY_KP_0] = action > GLFW_RELEASE; + Control::manager().input_values[INPUT_NUMPAD_FIRST + _key - GLFW_KEY_KP_0] = action > GLFW_RELEASE ? 1.f : 0.f; + } + Control::manager().input_access_.unlock(); } - else if (_key >= GLFW_KEY_KP_0 && _key <= GLFW_KEY_KP_EQUAL) { - Control::manager().input_active[INPUT_NUMPAD_FIRST + _key - GLFW_KEY_KP_0] = action > GLFW_RELEASE; - Control::manager().input_values[INPUT_NUMPAD_FIRST + _key - GLFW_KEY_KP_0] = action > GLFW_RELEASE ? 1.f : 0.f; - } - else if (_key == GLFW_KEY_ESCAPE && action == GLFW_PRESS ) + else if ( key == GLFW_KEY_F && action == GLFW_PRESS && mods == GLFW_MOD_CONTROL ) { - Rendering::manager().window(w)->exitFullscreen(); + Rendering::manager().window(w)->toggleFullscreen(); } - Control::manager().input_access_.unlock(); } } diff --git a/src/RenderingManager.cpp b/src/RenderingManager.cpp index 1b47b88..c77c887 100644 --- a/src/RenderingManager.cpp +++ b/src/RenderingManager.cpp @@ -167,10 +167,8 @@ static void OutputWindowEvent( GLFWwindow *w, int button, int action, int) // exit fullscreen if its the case if (glfwGetWindowMonitor(w) != nullptr) Rendering::manager().window(w)->exitFullscreen(); - - // show main window in DISPLAYS view to - // indicate how to manipulate output window - Mixer::manager().setView(View::DISPLAYS); + // show main window + else Rendering::manager().mainWindow().show(); } // for next double clic detection diff --git a/src/UserInterfaceManager.cpp b/src/UserInterfaceManager.cpp index 67d1aaf..2cfb3ac 100644 --- a/src/UserInterfaceManager.cpp +++ b/src/UserInterfaceManager.cpp @@ -350,9 +350,6 @@ void UserInterface::handleKeyboard() if (clipboard != nullptr && strlen(clipboard) > 0) Mixer::manager().paste(clipboard); } - else if (ImGui::IsKeyPressed( Control::layoutKey(GLFW_KEY_F), false )) { - Rendering::manager().mainWindow().toggleFullscreen(); - } else if (ImGui::IsKeyPressed( Control::layoutKey(GLFW_KEY_M), false )) { Settings::application.widget.stats = !Settings::application.widget.stats; }