ソースを参照

Merge pull request #47 from Haze-xyz/fix-software-cursor

Keep the software mouse cursor visible below 1920x1080
stan 3 週間 前
コミット
7ff4f746d5
1 ファイル変更4 行追加0 行削除
  1. 4 0
      Sunrise/src/core/ui/theme/sunrise_ui_theme.cpp

+ 4 - 0
Sunrise/src/core/ui/theme/sunrise_ui_theme.cpp

@@ -1,5 +1,6 @@
 #include "sunrise_ui_theme.h"
 
+#include <algorithm>
 #include <imgui.h>
 
 #include "../scaling/dpi/ui_dpi_scaling.h"
@@ -107,6 +108,9 @@ void apply() noexcept {
     // Scaling a fresh default style stops repeated monitor changes from building up error.
     const float scale = scaling::dpi::current();
     style.ScaleAllSizes(scale);
+    // ScaleAllSizes truncates this one to a whole number, so any factor below 1 zeroes it and the
+    // cursor draws with no area. Below the authored geometry it holds its authored size instead.
+    style.MouseCursorScale = (std::max)(1.0F, style.MouseCursorScale);
     style.FontSizeBase = fontSizeBase;
     style.FontScaleMain = scale;
     ImGui::GetStyle() = style;