From b74a200bdf39ecc9bd94e90a4e2e66f328d3ffe3 Mon Sep 17 00:00:00 2001 From: maj00r Date: Sat, 24 Oct 2026 21:12:28 +0200 Subject: [PATCH] test(editor): EU07_EDITOR_SELFTEST_HIDDEN runs a selftest in a window never shown nor focused, full screen or not, for the computer in use meanwhile --- application/application.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/application/application.cpp b/application/application.cpp index 012cd4e3..d043351c 100644 --- a/application/application.cpp +++ b/application/application.cpp @@ -968,7 +968,8 @@ GLFWwindow *eu07_application::window(int const Windowindex, bool visible, int wi if (keep_ownership) m_windows.emplace_back(childwindow); - glfwFocusWindow(m_windows.front()); // restore focus to main window + if (glfwGetWindowAttrib(m_windows.front(), GLFW_VISIBLE)) + glfwFocusWindow(m_windows.front()); // restore focus to main window return childwindow; } @@ -1330,7 +1331,9 @@ int eu07_application::init_glfw() Global.bFullScreen = true; } - auto *mainwindow = window(-1, true, Global.window_size.x, Global.window_size.y, Global.bFullScreen ? monitor : nullptr, true, false); + // a selftest of the editor run while the computer is in use for something else draws into a window never shown nor focused + bool const shown{std::getenv("EU07_EDITOR_SELFTEST_HIDDEN") == nullptr}; + auto *mainwindow = window(-1, shown, Global.window_size.x, Global.window_size.y, Global.bFullScreen && shown ? monitor : nullptr, true, false); if (mainwindow == nullptr) {