fix: Focus loss getting triggered when a popup was selected

This commit is contained in:
WerWolv
2025-08-15 17:29:49 +02:00
parent 9928439f4f
commit 1c54e7e38b
2 changed files with 25 additions and 14 deletions

View File

@@ -376,8 +376,9 @@ namespace hex {
}
void Window::frameBegin() {
auto &io = ImGui::GetIO();
ImHexApi::Fonts::getDefaultFont().push();
ImGui::GetIO().FontDefault = ImHexApi::Fonts::getDefaultFont();
io.FontDefault = ImHexApi::Fonts::getDefaultFont();
// Start new ImGui Frame
ImGui_ImplOpenGL3_NewFrame();
@@ -396,6 +397,12 @@ namespace hex {
EventFrameBegin::post();
static bool lastFocusLost = io.AppFocusLost;
if (io.AppFocusLost != lastFocusLost) {
EventWindowFocused::post(!io.AppFocusLost);
}
lastFocusLost = io.AppFocusLost;
// Handle all undocked floating windows
ImGuiViewport *viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(viewport->WorkPos);
@@ -1127,11 +1134,7 @@ namespace hex {
glfwSetCursorPosCallback(m_window, unlockFrameRate);
glfwSetMouseButtonCallback(m_window, unlockFrameRate);
glfwSetScrollCallback(m_window, unlockFrameRate);
glfwSetWindowFocusCallback(m_window, [](GLFWwindow *window, int focused) {
unlockFrameRate(window);
EventWindowFocused::post(focused == GLFW_TRUE);
});
glfwSetWindowFocusCallback(m_window, unlockFrameRate);
glfwSetWindowMaximizeCallback(m_window, [](GLFWwindow *window, int) {
glfwShowWindow(window);