[studio,turbine] Fix DPI scaling for Mac
Build / build (push) Successful in 1m20s

This commit is contained in:
2026-05-22 23:00:50 -05:00
parent ac9bbefa82
commit 7d144eb18a
2 changed files with 7 additions and 5 deletions
+5 -4
View File
@@ -122,7 +122,8 @@ StudioUI::StudioUI(turbine::Context &tctx, ox::StringParam projectDataDir) noexc
m_sctx{*this, tctx}, m_sctx{*this, tctx},
m_projectDataDir{std::move(projectDataDir)} { m_projectDataDir{std::move(projectDataDir)} {
{ {
auto const scale = turbine::isWayland() ? 1.f : turbine::scale(m_tctx); auto const scale = turbine::isWayland() || ox::defines::OS == ox::OS::Darwin ?
1.f : turbine::scale(m_tctx);
ImFontConfig fontCfg; ImFontConfig fontCfg;
fontCfg.FontDataOwnedByAtlas = false; fontCfg.FontDataOwnedByAtlas = false;
auto const &io = ImGui::GetIO(); auto const &io = ImGui::GetIO();
@@ -202,10 +203,10 @@ void StudioUI::handleNavigationChange(ox::StringParam path, ox::StringParam navA
} }
void StudioUI::draw() noexcept { void StudioUI::draw() noexcept {
if (!turbine::isWayland()) { if (turbine::isWayland() || ox::defines::OS == ox::OS::Darwin) {
ig::setDpiScale(ImGui::GetWindowDpiScale());
} else {
ig::setDpiScale(1.f); ig::setDpiScale(1.f);
} else {
ig::setDpiScale(ImGui::GetWindowDpiScale());
} }
glutils::clearScreen(); glutils::clearScreen();
drawMenu(); drawMenu();
+2 -1
View File
@@ -376,7 +376,8 @@ ox::Result<ox::UPtr<Context>> init(
themeImgui(); themeImgui();
float xscale{}, yscale{}; float xscale{}, yscale{};
glfwGetWindowContentScale(ctx->window, &xscale, &yscale); glfwGetWindowContentScale(ctx->window, &xscale, &yscale);
ctx->scale = isWayland() ? 1.f : ox::max(xscale, yscale); ctx->scale = isWayland() || ox::defines::OS == ox::OS::Darwin ?
1.f : ox::max(xscale, yscale);
io.DisplayFramebufferScale = ImVec2{ctx->scale, ctx->scale}; io.DisplayFramebufferScale = ImVec2{ctx->scale, ctx->scale};
auto &style = ImGui::GetStyle(); auto &style = ImGui::GetStyle();
style.ScaleAllSizes(ctx->scale); style.ScaleAllSizes(ctx->scale);