New Headless execution mode (DRAFT)

This commit is contained in:
Bruno Herbelin
2024-02-23 23:29:20 +01:00
parent c1aa3c9d4d
commit e3b8ccff9e
4 changed files with 51 additions and 17 deletions

View File

@@ -1398,7 +1398,8 @@ void Control::keyboardCalback(GLFWwindow* w, int key, int, int action, int mods)
{
if (UserInterface::manager().keyboardAvailable())
{
if ( !mods ) {
// keys without modifiers in any windows
if (!mods) {
int _key = layoutKey(key);
Control::manager().input_access_.lock();
if (_key >= GLFW_KEY_A && _key <= GLFW_KEY_Z) {
@@ -1411,14 +1412,31 @@ void Control::keyboardCalback(GLFWwindow* w, int key, int, int action, int mods)
}
Control::manager().input_access_.unlock();
}
#if defined(APPLE)
else if ( w != Rendering::manager().mainWindow().window() &&
key == GLFW_KEY_F && action == GLFW_PRESS && mods == GLFW_MOD_SUPER )
#else
else if ( key == GLFW_KEY_F && action == GLFW_PRESS && mods == GLFW_MOD_CONTROL )
#endif
// keys with modifiers in non-main window
else if ( w != Rendering::manager().mainWindow().window() )
{
Rendering::manager().window(w)->toggleFullscreen();
#if defined(APPLE)
if ( key == GLFW_KEY_F && action == GLFW_PRESS && mods == GLFW_MOD_SUPER )
#else
if ( key == GLFW_KEY_F && action == GLFW_PRESS && mods == GLFW_MOD_CONTROL )
#endif
{
// toggle fullscreen on CTRL+F
Rendering::manager().window(w)->toggleFullscreen();
}
#if defined(APPLE)
else if ( key == GLFW_KEY_Q && action == GLFW_PRESS && mods == GLFW_MOD_SUPER )
#else
else if ( key == GLFW_KEY_Q && action == GLFW_PRESS && mods == GLFW_MOD_CONTROL )
#endif
{
// Quit on CTRL+Q (if no main window)
if (glfwGetWindowAttrib(Rendering::manager().mainWindow().window(), GLFW_VISIBLE)
== GL_FALSE) {
// close rendering manager = quit
Rendering::manager().close();
}
}
}
}
}