mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
fix: More window focus event issues
This commit is contained in:
@@ -380,6 +380,26 @@ namespace hex {
|
||||
ImHexApi::Fonts::getDefaultFont().push();
|
||||
io.FontDefault = ImHexApi::Fonts::getDefaultFont();
|
||||
|
||||
{
|
||||
static bool lastAnyWindowFocused = false;
|
||||
bool anyWindowFocused = glfwGetWindowAttrib(m_window, GLFW_FOCUSED);
|
||||
|
||||
if (!anyWindowFocused) {
|
||||
const auto platformIo = ImGui::GetPlatformIO();
|
||||
for (auto *viewport : platformIo.Viewports) {
|
||||
if (platformIo.Platform_GetWindowFocus(viewport)) {
|
||||
anyWindowFocused = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lastAnyWindowFocused != anyWindowFocused)
|
||||
EventWindowFocused::post(anyWindowFocused);
|
||||
|
||||
lastAnyWindowFocused = anyWindowFocused;
|
||||
}
|
||||
|
||||
// Start new ImGui Frame
|
||||
ImGui_ImplOpenGL3_NewFrame();
|
||||
ImGui_ImplGlfw_NewFrame();
|
||||
@@ -397,12 +417,6 @@ 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);
|
||||
|
||||
Reference in New Issue
Block a user