Open ChaseLewis opened 4 years ago
I was able to fix the issue with the below codein imgui.cpp. I'm not familiar enough with ImGui's inner workings to know if this is reliable enough to be merged in or if there are more callback I should listen too since I noticed there is also a Render_SetWindowSize that is listened to in a few places.
static void ImGui::UpdateViewportPlatformMonitor(ImGuiViewportP* viewport)
{
ImGuiContext& g = *GImGui;
short newPlatformMonitor = (short)FindPlatformMonitorForRect(viewport->GetMainRect());
if(viewport->PlatformMonitor != -1 && newPlatformMonitor != viewport->PlatformMonitor && g.PlatformIO.Platform_SetWindowSize) {
g.PlatformIO.Platform_SetWindowSize(viewport, viewport->Size);
}
viewport->PlatformMonitor = newPlatformMonitor;
}
Version/Branch of Dear ImGui:
Version: v.1.78 Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_opengl3.cpp + imgui_impl_GLFW.cpp Compiler: MSVC Operating System: Windows 10
My Issue/Question:
If I drag a subwindow from 1 monitor to another with different resolution the viewport of the window gets messed up. Resizing the window fixes the viewport. It does not get fixed until a user manually resizes it though. If you drop the subwindow onto the main window it fixes itself without requiring any viewport changes.
Is there a way to hook into the window drop event and make it auto resize viewport?
Screenshots/Video https://imgur.com/a/CLdfGv4
Standalone, minimal, complete and verifiable example: