Skip to content

Commit c90ea13

Browse files
committed
Viewports: added per-viewport FramebufferScale, Platform_GetWindowFramebufferScale() + Backends: GLFW, SDL2, SDL3, Apple: added support. (#1065, #1542, #1676, #1786, #2826, #3757, #5081, #5580, #5592, #6465, #7273, #7779 etc.)
) Metal backend is not in charge of writing to DpiScale/FramebufferScale (tho it was a neat workaround).
1 parent 63554bc commit c90ea13

File tree

9 files changed

+118
-45
lines changed

9 files changed

+118
-45
lines changed

backends/imgui_impl_glfw.cpp

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
// CHANGELOG
3232
// (minor and older changes stripped away, please see git history for details)
3333
// 2025-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
34-
// 2025-04-26: Disable multi-viewports under Wayland. (#8587)
34+
// 2025-05-15: [Docking] Add Platform_GetWindowFramebufferScale() handler, to allow varying Retina display density on multiple monitors.
35+
// 2025-04-26: [Docking] Disable multi-viewports under Wayland. (#8587)
3536
// 2025-03-10: Map GLFW_KEY_WORLD_1 and GLFW_KEY_WORLD_2 into ImGuiKey_Oem102.
3637
// 2025-03-03: Fixed clipboard handler assertion when using GLFW <= 3.2.1 compiled with asserts enabled.
3738
// 2025-02-21: [Docking] Update monitors and work areas information every frame, as the later may change regardless of monitor changes. (#8415)
@@ -970,20 +971,26 @@ static void ImGui_ImplGlfw_UpdateMonitors()
970971
}
971972
}
972973

974+
static void ImGui_ImplGlfw_GetWindowSizeAndFramebufferScale(GLFWwindow* window, ImVec2* out_size, ImVec2* out_framebuffer_scale)
975+
{
976+
int w, h;
977+
int display_w, display_h;
978+
glfwGetWindowSize(window, &w, &h);
979+
glfwGetFramebufferSize(window, &display_w, &display_h);
980+
if (out_size != nullptr)
981+
*out_size = ImVec2((float)w, (float)h);
982+
if (out_framebuffer_scale != nullptr)
983+
*out_framebuffer_scale = (w > 0 && h > 0) ? ImVec2((float)display_w / (float)w, (float)display_h / (float)h) : ImVec2(1.0f, 1.0f);
984+
}
985+
973986
void ImGui_ImplGlfw_NewFrame()
974987
{
975988
ImGuiIO& io = ImGui::GetIO();
976989
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
977990
IM_ASSERT(bd != nullptr && "Context or backend not initialized! Did you call ImGui_ImplGlfw_InitForXXX()?");
978991

979-
// Setup display size (every frame to accommodate for window resizing)
980-
int w, h;
981-
int display_w, display_h;
982-
glfwGetWindowSize(bd->Window, &w, &h);
983-
glfwGetFramebufferSize(bd->Window, &display_w, &display_h);
984-
io.DisplaySize = ImVec2((float)w, (float)h);
985-
if (w > 0 && h > 0)
986-
io.DisplayFramebufferScale = ImVec2((float)display_w / (float)w, (float)display_h / (float)h);
992+
// Setup main viewport size (every frame to accommodate for window resizing)
993+
ImGui_ImplGlfw_GetWindowSizeAndFramebufferScale(bd->Window, &io.DisplaySize, &io.DisplayFramebufferScale);
987994
ImGui_ImplGlfw_UpdateMonitors();
988995

989996
// Setup time step
@@ -1283,6 +1290,14 @@ static void ImGui_ImplGlfw_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)
12831290
glfwSetWindowSize(vd->Window, (int)size.x, (int)size.y);
12841291
}
12851292

1293+
static ImVec2 ImGui_ImplGlfw_GetWindowFramebufferScale(ImGuiViewport* viewport)
1294+
{
1295+
ImGui_ImplGlfw_ViewportData* vd = (ImGui_ImplGlfw_ViewportData*)viewport->PlatformUserData;
1296+
ImVec2 framebuffer_scale;
1297+
ImGui_ImplGlfw_GetWindowSizeAndFramebufferScale(vd->Window, nullptr, &framebuffer_scale);
1298+
return framebuffer_scale;
1299+
}
1300+
12861301
static void ImGui_ImplGlfw_SetWindowTitle(ImGuiViewport* viewport, const char* title)
12871302
{
12881303
ImGui_ImplGlfw_ViewportData* vd = (ImGui_ImplGlfw_ViewportData*)viewport->PlatformUserData;
@@ -1381,6 +1396,7 @@ static void ImGui_ImplGlfw_InitMultiViewportSupport()
13811396
platform_io.Platform_GetWindowPos = ImGui_ImplGlfw_GetWindowPos;
13821397
platform_io.Platform_SetWindowSize = ImGui_ImplGlfw_SetWindowSize;
13831398
platform_io.Platform_GetWindowSize = ImGui_ImplGlfw_GetWindowSize;
1399+
platform_io.Platform_GetWindowFramebufferScale = ImGui_ImplGlfw_GetWindowFramebufferScale;
13841400
platform_io.Platform_SetWindowFocus = ImGui_ImplGlfw_SetWindowFocus;
13851401
platform_io.Platform_GetWindowFocus = ImGui_ImplGlfw_GetWindowFocus;
13861402
platform_io.Platform_GetWindowMinimized = ImGui_ImplGlfw_GetWindowMinimized;

backends/imgui_impl_metal.mm

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -485,13 +485,12 @@ static void ImGui_ImplMetal_RenderWindow(ImGuiViewport* viewport, void*)
485485
}
486486
data->FirstFrame = false;
487487

488-
viewport->DpiScale = (float)window.backingScaleFactor;
489-
if (data->MetalLayer.contentsScale != viewport->DpiScale)
488+
float fb_scale = (float)window.backingScaleFactor;
489+
if (data->MetalLayer.contentsScale != fb_scale)
490490
{
491-
data->MetalLayer.contentsScale = viewport->DpiScale;
492-
data->MetalLayer.drawableSize = MakeScaledSize(window.frame.size, viewport->DpiScale);
491+
data->MetalLayer.contentsScale = fb_scale;
492+
data->MetalLayer.drawableSize = MakeScaledSize(window.frame.size, fb_scale);
493493
}
494-
viewport->DrawData->FramebufferScale = ImVec2(viewport->DpiScale, viewport->DpiScale);
495494
#endif
496495

497496
id <CAMetalDrawable> drawable = [data->MetalLayer nextDrawable];

backends/imgui_impl_osx.mm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
// CHANGELOG
3636
// (minor and older changes stripped away, please see git history for details)
3737
// 2025-XX-XX: Added support for multiple windows via the ImGuiPlatformIO interface.
38+
// 2025-05-15: [Docking] Add Platform_GetWindowFramebufferScale() handler, to allow varying Retina display density on multiple monitors.
3839
// 2025-03-21: Fill gamepad inputs and set ImGuiBackendFlags_HasGamepad regardless of ImGuiConfigFlags_NavEnableGamepad being set.
3940
// 2025-01-20: Removed notification observer when shutting down. (#8331)
4041
// 2024-08-22: moved some OS/backend related function pointers from ImGuiIO to ImGuiPlatformIO:
@@ -1021,6 +1022,14 @@ static void ImGui_ImplOSX_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)
10211022
[window setFrame:rect display:YES];
10221023
}
10231024

1025+
static ImVec2 ImGui_ImplOSX_GetWindowFramebufferScale(ImGuiViewport* viewport)
1026+
{
1027+
ImGui_ImplOSX_ViewportData* vd = (ImGui_ImplOSX_ViewportData*)viewport->PlatformUserData;
1028+
NSWindow* window = vd->Window;
1029+
const float fb_scale = (float)[window backingScaleFactor];
1030+
return ImVec2(fb_scale, fb_scale);
1031+
}
1032+
10241033
static void ImGui_ImplOSX_SetWindowFocus(ImGuiViewport* viewport)
10251034
{
10261035
ImGui_ImplOSX_Data* bd = ImGui_ImplOSX_GetBackendData();
@@ -1110,6 +1119,7 @@ static void ImGui_ImplOSX_InitMultiViewportSupport()
11101119
platform_io.Platform_GetWindowPos = ImGui_ImplOSX_GetWindowPos;
11111120
platform_io.Platform_SetWindowSize = ImGui_ImplOSX_SetWindowSize;
11121121
platform_io.Platform_GetWindowSize = ImGui_ImplOSX_GetWindowSize;
1122+
platform_io.Platform_GetWindowFramebufferScale = ImGui_ImplOSX_GetWindowFramebufferScale;
11131123
platform_io.Platform_SetWindowFocus = ImGui_ImplOSX_SetWindowFocus;
11141124
platform_io.Platform_GetWindowFocus = ImGui_ImplOSX_GetWindowFocus;
11151125
platform_io.Platform_GetWindowMinimized = ImGui_ImplOSX_GetWindowMinimized;

backends/imgui_impl_sdl2.cpp

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
// CHANGELOG
2727
// (minor and older changes stripped away, please see git history for details)
2828
// 2025-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
29+
// 2025-05-15: [Docking] Add Platform_GetWindowFramebufferScale() handler, to allow varying Retina display density on multiple monitors.
2930
// 2025-04-09: [Docking] Revert update monitors and work areas information every frame. Only do it on Windows. (#8415, #8558)
3031
// 2025-04-09: Don't attempt to call SDL_CaptureMouse() on drivers where we don't call SDL_GetGlobalMouseState(). (#8561)
3132
// 2025-03-21: Fill gamepad inputs and set ImGuiBackendFlags_HasGamepad regardless of ImGuiConfigFlags_NavEnableGamepad being set.
@@ -939,29 +940,35 @@ static void ImGui_ImplSDL2_UpdateMonitors()
939940
}
940941
}
941942

942-
void ImGui_ImplSDL2_NewFrame()
943+
static void ImGui_ImplSDL2_GetWindowSizeAndFramebufferScale(SDL_Window* window, SDL_Renderer* renderer, ImVec2* out_size, ImVec2* out_framebuffer_scale)
943944
{
944-
ImGui_ImplSDL2_Data* bd = ImGui_ImplSDL2_GetBackendData();
945-
IM_ASSERT(bd != nullptr && "Context or backend not initialized! Did you call ImGui_ImplSDL2_Init()?");
946-
ImGuiIO& io = ImGui::GetIO();
947-
948-
// Setup display size (every frame to accommodate for window resizing)
949945
int w, h;
950946
int display_w, display_h;
951-
SDL_GetWindowSize(bd->Window, &w, &h);
952-
if (SDL_GetWindowFlags(bd->Window) & SDL_WINDOW_MINIMIZED)
947+
SDL_GetWindowSize(window, &w, &h);
948+
if (SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED)
953949
w = h = 0;
954-
if (bd->Renderer != nullptr)
955-
SDL_GetRendererOutputSize(bd->Renderer, &display_w, &display_h);
950+
if (renderer != nullptr)
951+
SDL_GetRendererOutputSize(renderer, &display_w, &display_h);
956952
#if SDL_HAS_VULKAN
957-
else if (SDL_GetWindowFlags(bd->Window) & SDL_WINDOW_VULKAN)
958-
SDL_Vulkan_GetDrawableSize(bd->Window, &display_w, &display_h);
953+
else if (SDL_GetWindowFlags(window) & SDL_WINDOW_VULKAN)
954+
SDL_Vulkan_GetDrawableSize(window, &display_w, &display_h);
959955
#endif
960956
else
961-
SDL_GL_GetDrawableSize(bd->Window, &display_w, &display_h);
962-
io.DisplaySize = ImVec2((float)w, (float)h);
963-
if (w > 0 && h > 0)
964-
io.DisplayFramebufferScale = ImVec2((float)display_w / w, (float)display_h / h);
957+
SDL_GL_GetDrawableSize(window, &display_w, &display_h);
958+
if (out_size != nullptr)
959+
*out_size = ImVec2((float)w, (float)h);
960+
if (out_framebuffer_scale != nullptr)
961+
*out_framebuffer_scale = (w > 0 && h > 0) ? ImVec2((float)display_w / w, (float)display_h / h) : ImVec2(1.0f, 1.0f);
962+
}
963+
964+
void ImGui_ImplSDL2_NewFrame()
965+
{
966+
ImGui_ImplSDL2_Data* bd = ImGui_ImplSDL2_GetBackendData();
967+
IM_ASSERT(bd != nullptr && "Context or backend not initialized! Did you call ImGui_ImplSDL2_Init()?");
968+
ImGuiIO& io = ImGui::GetIO();
969+
970+
// Setup main viewport size (every frame to accommodate for window resizing)
971+
ImGui_ImplSDL2_GetWindowSizeAndFramebufferScale(bd->Window, bd->Renderer, &io.DisplaySize, &io.DisplayFramebufferScale);
965972

966973
// Update monitors
967974
#ifdef WIN32
@@ -1147,6 +1154,15 @@ static void ImGui_ImplSDL2_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)
11471154
SDL_SetWindowSize(vd->Window, (int)size.x, (int)size.y);
11481155
}
11491156

1157+
static ImVec2 ImGui_ImplSDL2_GetWindowFramebufferScale(ImGuiViewport* viewport)
1158+
{
1159+
// FIXME: SDL_Renderer does not support multi-viewport.
1160+
ImGui_ImplSDL2_ViewportData* vd = (ImGui_ImplSDL2_ViewportData*)viewport->PlatformUserData;
1161+
ImVec2 framebuffer_scale;
1162+
ImGui_ImplSDL2_GetWindowSizeAndFramebufferScale(vd->Window, nullptr, nullptr, &framebuffer_scale);
1163+
return framebuffer_scale;
1164+
}
1165+
11501166
static void ImGui_ImplSDL2_SetWindowTitle(ImGuiViewport* viewport, const char* title)
11511167
{
11521168
ImGui_ImplSDL2_ViewportData* vd = (ImGui_ImplSDL2_ViewportData*)viewport->PlatformUserData;
@@ -1220,6 +1236,7 @@ static void ImGui_ImplSDL2_InitMultiViewportSupport(SDL_Window* window, void* sd
12201236
platform_io.Platform_GetWindowPos = ImGui_ImplSDL2_GetWindowPos;
12211237
platform_io.Platform_SetWindowSize = ImGui_ImplSDL2_SetWindowSize;
12221238
platform_io.Platform_GetWindowSize = ImGui_ImplSDL2_GetWindowSize;
1239+
platform_io.Platform_GetWindowFramebufferScale = ImGui_ImplSDL2_GetWindowFramebufferScale;
12231240
platform_io.Platform_SetWindowFocus = ImGui_ImplSDL2_SetWindowFocus;
12241241
platform_io.Platform_GetWindowFocus = ImGui_ImplSDL2_GetWindowFocus;
12251242
platform_io.Platform_GetWindowMinimized = ImGui_ImplSDL2_GetWindowMinimized;

backends/imgui_impl_sdl3.cpp

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
// CHANGELOG
2525
// (minor and older changes stripped away, please see git history for details)
2626
// 2025-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
27+
// 2025-05-15: [Docking] Add Platform_GetWindowFramebufferScale() handler, to allow varying Retina display density on multiple monitors.
2728
// 2025-05-06: [Docking] macOS: fixed secondary viewports not appearing on other monitors before of parenting.
2829
// 2025-04-09: [Docking] Revert update monitors and work areas information every frame. Only do it on Windows. (#8415, #8558)
2930
// 2025-04-22: IME: honor ImGuiPlatformImeData->WantTextInput as an alternative way to call SDL_StartTextInput(), without IME being necessarily visible.
@@ -901,22 +902,28 @@ static void ImGui_ImplSDL3_UpdateMonitors()
901902
SDL_free(displays);
902903
}
903904

905+
static void ImGui_ImplSDL3_GetWindowSizeAndFramebufferScale(SDL_Window* window, ImVec2* out_size, ImVec2* out_framebuffer_scale)
906+
{
907+
int w, h;
908+
int display_w, display_h;
909+
SDL_GetWindowSize(window, &w, &h);
910+
if (SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED)
911+
w = h = 0;
912+
SDL_GetWindowSizeInPixels(window, &display_w, &display_h);
913+
if (out_size != nullptr)
914+
*out_size = ImVec2((float)w, (float)h);
915+
if (out_framebuffer_scale != nullptr)
916+
*out_framebuffer_scale = (w > 0 && h > 0) ? ImVec2((float)display_w / w, (float)display_h / h) : ImVec2(1.0f, 1.0f);
917+
}
918+
904919
void ImGui_ImplSDL3_NewFrame()
905920
{
906921
ImGui_ImplSDL3_Data* bd = ImGui_ImplSDL3_GetBackendData();
907922
IM_ASSERT(bd != nullptr && "Context or backend not initialized! Did you call ImGui_ImplSDL3_Init()?");
908923
ImGuiIO& io = ImGui::GetIO();
909924

910-
// Setup display size (every frame to accommodate for window resizing)
911-
int w, h;
912-
int display_w, display_h;
913-
SDL_GetWindowSize(bd->Window, &w, &h);
914-
if (SDL_GetWindowFlags(bd->Window) & SDL_WINDOW_MINIMIZED)
915-
w = h = 0;
916-
SDL_GetWindowSizeInPixels(bd->Window, &display_w, &display_h);
917-
io.DisplaySize = ImVec2((float)w, (float)h);
918-
if (w > 0 && h > 0)
919-
io.DisplayFramebufferScale = ImVec2((float)display_w / w, (float)display_h / h);
925+
// Setup main viewport size (every frame to accommodate for window resizing)
926+
ImGui_ImplSDL3_GetWindowSizeAndFramebufferScale(bd->Window, &io.DisplaySize, &io.DisplayFramebufferScale);
920927

921928
// Update monitors
922929
#ifdef WIN32
@@ -1117,6 +1124,14 @@ static void ImGui_ImplSDL3_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)
11171124
SDL_SetWindowSize(vd->Window, (int)size.x, (int)size.y);
11181125
}
11191126

1127+
static ImVec2 ImGui_ImplSDL3_GetWindowFramebufferScale(ImGuiViewport* viewport)
1128+
{
1129+
ImGui_ImplSDL3_ViewportData* vd = (ImGui_ImplSDL3_ViewportData*)viewport->PlatformUserData;
1130+
ImVec2 framebuffer_scale;
1131+
ImGui_ImplSDL3_GetWindowSizeAndFramebufferScale(vd->Window, nullptr, &framebuffer_scale);
1132+
return framebuffer_scale;
1133+
}
1134+
11201135
static void ImGui_ImplSDL3_SetWindowTitle(ImGuiViewport* viewport, const char* title)
11211136
{
11221137
ImGui_ImplSDL3_ViewportData* vd = (ImGui_ImplSDL3_ViewportData*)viewport->PlatformUserData;
@@ -1187,6 +1202,7 @@ static void ImGui_ImplSDL3_InitMultiViewportSupport(SDL_Window* window, void* sd
11871202
platform_io.Platform_GetWindowPos = ImGui_ImplSDL3_GetWindowPos;
11881203
platform_io.Platform_SetWindowSize = ImGui_ImplSDL3_SetWindowSize;
11891204
platform_io.Platform_GetWindowSize = ImGui_ImplSDL3_GetWindowSize;
1205+
platform_io.Platform_GetWindowFramebufferScale = ImGui_ImplSDL3_GetWindowFramebufferScale;
11901206
platform_io.Platform_SetWindowFocus = ImGui_ImplSDL3_SetWindowFocus;
11911207
platform_io.Platform_GetWindowFocus = ImGui_ImplSDL3_GetWindowFocus;
11921208
platform_io.Platform_GetWindowMinimized = ImGui_ImplSDL3_GetWindowMinimized;

docs/CHANGELOG.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,20 @@ Other changes:
129129

130130
Docking+Viewports Branch:
131131

132-
- Backends: Win32: Viewports: fixed an issue when closing a window from
132+
- Viewports: added per-viewport FramebufferScale for Retina display multi-monitor support.
133+
Backend must provide platform_io.platform_io.Platform_GetWindowFramebufferScale handler.
134+
This effectively fixes clipping/rendering on multi-monitors with varying Retina scale.
135+
(this per-se doesn't fix the font quality which requires setting RasterizerDensity
136+
separately. More on this later as it should soon become automatic).
137+
(#1065, #1542, #1676, #1786, #2826, #3757, #5081, #5580, #5592, #6465, #7273, #7779 etc.)
138+
- Backends: Win32: Viewports: fixed an issue when closing a window from
133139
the OS close button (with io.ConfigViewportsNoDecoration=false) while
134140
user code is discarding the 'bool *p_open=false output' from Begin().
135141
Because we allowed the Win32 window to close early, Windows destroyed
136142
it and our imgui window became not visible even though user code was
137143
still submitting it.
144+
- Backends: GLFW, SDL2, SDL3, Apple: provide Platform_GetWindowFramebufferScale handler,
145+
(#1065, #1542, #1676, #1786, #2826, #3757, #5081, #5580, #5592, #6465, #7273, #7779 etc.)
138146
- Backends: SDLGPU3 for SDL3: added multi-viewport support. (#8573) [@Lekoopapaul]
139147
- Backends: SDL2, SDL3: revert updating monitors and work areas info every
140148
frame. Only do it on Windows to detect task-bar resize until we get an

examples/example_apple_opengl2/main.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
77
// - Introduction, links and more at the top of imgui.cpp
88

9+
// FIXME: Multi-viewports is not yet functional in this example. May need backend rework/coordination.
10+
911
#import <Cocoa/Cocoa.h>
1012
#import <OpenGL/gl.h>
1113
#import <OpenGL/glu.h>

imgui.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5719,7 +5719,7 @@ static void InitViewportDrawData(ImGuiViewportP* viewport)
57195719
draw_data->TotalVtxCount = draw_data->TotalIdxCount = 0;
57205720
draw_data->DisplayPos = viewport->Pos;
57215721
draw_data->DisplaySize = is_minimized ? ImVec2(0.0f, 0.0f) : viewport->Size;
5722-
draw_data->FramebufferScale = io.DisplayFramebufferScale; // FIXME-VIEWPORT: This may vary on a per-monitor/viewport basis?
5722+
draw_data->FramebufferScale = (viewport->FramebufferScale.x != 0.0f) ? viewport->FramebufferScale : io.DisplayFramebufferScale;
57235723
draw_data->OwnerViewport = viewport;
57245724
}
57255725

@@ -16015,6 +16015,8 @@ static void ImGui::UpdateViewportsNewFrame()
1601516015
viewport->Pos = viewport->LastPlatformPos = g.PlatformIO.Platform_GetWindowPos(viewport);
1601616016
if (viewport->PlatformRequestResize)
1601716017
viewport->Size = viewport->LastPlatformSize = g.PlatformIO.Platform_GetWindowSize(viewport);
16018+
if (g.PlatformIO.Platform_GetWindowFramebufferScale != NULL)
16019+
viewport->FramebufferScale = g.PlatformIO.Platform_GetWindowFramebufferScale(viewport);
1601816020
}
1601916021
}
1602016022

@@ -22313,8 +22315,9 @@ void ImGui::DebugNodeViewport(ImGuiViewportP* viewport)
2231322315
if (open)
2231422316
{
2231522317
ImGuiWindowFlags flags = viewport->Flags;
22316-
BulletText("Main Pos: (%.0f,%.0f), Size: (%.0f,%.0f)\nWorkArea Inset Left: %.0f Top: %.0f, Right: %.0f, Bottom: %.0f\nMonitor: %d, DpiScale: %.0f%%",
22318+
BulletText("Main Pos: (%.0f,%.0f), Size: (%.0f,%.0f)\nFrameBufferScale: (%.2f,%.2f)\nWorkArea Inset Left: %.0f Top: %.0f, Right: %.0f, Bottom: %.0f\nMonitor: %d, DpiScale: %.0f%%",
2231722319
viewport->Pos.x, viewport->Pos.y, viewport->Size.x, viewport->Size.y,
22320+
viewport->FramebufferScale.x, viewport->FramebufferScale.y,
2231822321
viewport->WorkInsetMin.x, viewport->WorkInsetMin.y, viewport->WorkInsetMax.x, viewport->WorkInsetMax.y,
2231922322
viewport->PlatformMonitor, viewport->DpiScale * 100.0f);
2232022323
if (viewport->Idx > 0) { SameLine(); if (SmallButton("Reset Pos")) { viewport->Pos = ImVec2(200, 200); viewport->UpdateWorkRect(); if (viewport->Window) viewport->Window->Pos = viewport->Pos; } }

0 commit comments

Comments
 (0)