1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

ImGui Multiviewport fixes

- set ImGuiConfigFlags_ViewportsEnable
- correct render loop logic with viewport api calls, SetNextWindowViewport(), UpdatePlatformWindows(), RenderPlatformWindowsDefault()
- Fix: coords in abs space now, SetNextWindowPos()

NOTE:
- I have viewports turned on by default so you can easy test (comment out io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; and you get old behavior)
- Jankiness with multiviewports isn't bc perf hit; it's bc profiler reduces it's tick rate when it's not in focus. So, that bit of logic needs to be updated if you really care
- I haven't encountered any issues over past week but discount that by 50% since i'm new to tracy. No promises some UI wasn't regresssed
- Key things to watch out for is enabling viewports turns ImGui into using absolute monitor coords instead of window coords (ie SetPosition(0,0) => monitor top left, not window top/left
This commit is contained in:
ikrima
2020-05-04 02:17:15 -07:00
parent 1d74c400ac
commit 1b5879e176
2 changed files with 17 additions and 3 deletions
+3 -1
View File
@@ -489,8 +489,10 @@ bool View::DrawImpl()
style.WindowPadding = ImVec2( 4.f, 4.f );
style.Colors[ImGuiCol_WindowBg] = ImVec4( 0.129f, 0.137f, 0.11f, 1.f );
ImGui::SetNextWindowPos( ImVec2( 0, 0 ) );
ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(viewport->Pos);
ImGui::SetNextWindowSize( ImVec2( m_rootWidth, m_rootHeight ) );
ImGui::SetNextWindowViewport(viewport->ID);
ImGui::Begin( "Timeline view###Profiler", nullptr, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDocking );
style.WindowRounding = wrPrev;