diff --git a/extern/imgui_patched/backends/imgui_impl_sdl.cpp b/extern/imgui_patched/backends/imgui_impl_sdl.cpp index e7ae8d072..00c55ae80 100644 --- a/extern/imgui_patched/backends/imgui_impl_sdl.cpp +++ b/extern/imgui_patched/backends/imgui_impl_sdl.cpp @@ -65,6 +65,7 @@ #include "imgui.h" #include "imgui_impl_sdl.h" +#include #include // SDL @@ -288,6 +289,7 @@ bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event) if (!platform_io.Monitors.empty() && platform_io.Monitors[0].DpiScale > 1.0f) { // The Framebuffer is scaled by an integer ceiling of the actual ratio, so 2.0 not 1.685 on Mac! + //printf("multiply by %f\n",platform_io.Monitors[0].DpiScale); mouse_pos.x *= std::ceil(platform_io.Monitors[0].DpiScale); mouse_pos.y *= std::ceil(platform_io.Monitors[0].DpiScale); } @@ -690,10 +692,11 @@ void ImGui_ImplSDL2_NewFrame() // On Apple and Wayland, The window size is reported in Low DPI, even when running in high DPI mode ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO(); - if (!platform_io.Monitors.empty() /*&& platform_io.Monitors[0].DpiScale > 1.0f*/ && display_h != h) + if (!platform_io.Monitors.empty() /*&& platform_io.Monitors[0].DpiScale > 1.0f*/ && display_h != h && w != 0) { io.DisplayFramebufferScale = ImVec2(1.0f, 1.0f); io.DisplaySize = ImVec2((float)display_w, (float)display_h); + //printf("write %d/%d to DpiScale\n",display_w,w); platform_io.Monitors[0].DpiScale=(float)display_w/(float)w; } diff --git a/src/gui/debugWindow.cpp b/src/gui/debugWindow.cpp index 68130d9dc..447ea12d5 100644 --- a/src/gui/debugWindow.cpp +++ b/src/gui/debugWindow.cpp @@ -378,6 +378,14 @@ void FurnaceGUI::drawDebug() { } ImGui::TreePop(); } + if (ImGui::TreeNode("Window Debug")) { + ImGui::Text("Screen: %dx%d+%d+%d",scrW,scrH,scrX,scrY); + ImGui::Text("Screen (Conf): %dx%d+%d+%d",scrConfW,scrConfH,scrConfX,scrConfY); + ImGui::Text("Canvas: %dx%d",canvasW,canvasH); + ImGui::Text("Maximized: %d",scrMax); + ImGui::Text("System Managed Scale: %d",sysManagedScale); + ImGui::TreePop(); + } if (ImGui::TreeNode("Playground")) { if (pgSys<0 || pgSys>=e->song.systemLen) pgSys=0; if (ImGui::BeginCombo("Chip",fmt::sprintf("%d. %s",pgSys+1,e->getSystemName(e->song.system[pgSys])).c_str())) { diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 45c4f018b..34baa7778 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1,3 +1,4 @@ +#include #define _USE_MATH_DEFINES // OK, sorry for inserting the define here but I'm so tired of this extension /** @@ -3074,6 +3075,7 @@ bool FurnaceGUI::loop() { // update config x/y/w/h values based on scrMax state if (updateWindow) { + logV("updateWindow is true"); if (!scrMax) { scrConfX=scrX; scrConfY=scrY; @@ -3082,7 +3084,11 @@ bool FurnaceGUI::loop() { } // update canvas size as well - SDL_GetRendererOutputSize(sdlRend,&canvasW,&canvasH); + if (SDL_GetRendererOutputSize(sdlRend,&canvasW,&canvasH)!=0) { + logW("updateWindow: error while getting output size! %s",SDL_GetError()); + } else { + logV("updateWindow: canvas size %dx%d",canvasW,canvasH); + } } wantCaptureKeyboard=ImGui::GetIO().WantTextInput;