wolfpld / tracy

Frame profiler
https://tracy.nereid.pl/
Other
10.14k stars 678 forks source link

Wrong window size on MacOS #513

Closed cBournhonesque closed 1 year ago

cBournhonesque commented 1 year ago

Hi, I just tried using tracy on mac os 13.1 The application looks great, unfortunately it doesn't resize to my window size. Half of the UI is 'clipped on the right', and I couldn't find a way to make it take the entire window.

This is what I see: (this is my entire screen)

image
wolfpld commented 1 year ago

See https://bitbucket.org/wolfpld/tracy/issues/42/cannot-scroll-down-capture-on-macos

topolarity commented 1 year ago

As a workaround as you can set the environment variable TRACY_DPI_SCALE=1.0

Fonts will be blurry and the scrollbar is still missing, but the scaling of the window elements will be improved.

maleadt commented 1 year ago

Fonts will be blurry and the scrollbar is still missing, but the scaling of the window elements will be improved.

With the following patch, I get crisp fonts without having to set TRACY_DPI_SCALE:

diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp
index f967353f..7ef00984 100644
--- a/profiler/src/main.cpp
+++ b/profiler/src/main.cpp
@@ -136,6 +136,11 @@ static void SetupDPIScale( float scale, ImFont*& cb_fixedWidth, ImFont*& cb_bigF
 {
     LoadFonts( scale, cb_fixedWidth, cb_bigFont, cb_smallFont );

+    // macOS HiDPI hack
+    ImGuiIO& io = ImGui::GetIO();
+    io.FontGlobalScale = 1.0f / dpiScale;
+    scale = 1.0f;

     auto& style = ImGui::GetStyle();
     style = ImGuiStyle();
     ImGui::StyleColorsDark();