Fix size of OSWindows on macOS (& probably Wayland)

The way SDL handles window coordinates passes through the native platform API's behavior instead of trying to make a consistent API, so the way sizes are handled on macOS is different.
This commit is contained in:
PJB3005
2026-01-31 08:13:19 +01:00
parent 57361e8ffd
commit e7f75ab35d
2 changed files with 3 additions and 2 deletions

View File

@@ -439,7 +439,8 @@ internal partial class Clyde
private static void WinThreadWinSetSize(CmdWinSetSize cmd)
{
SDL.SDL_SetWindowSize(cmd.Window, cmd.W, cmd.H);
var density = SDL.SDL_GetWindowPixelDensity(cmd.Window);
SDL.SDL_SetWindowSize(cmd.Window, (int)(cmd.W / density), (int)(cmd.H / density));
}
private static void WinThreadWinSetVisible(CmdWinSetVisible cmd)

View File

@@ -144,7 +144,7 @@ namespace Robust.Client.UserInterface.Controls
SetPositionFirst();
// Resize the window by our UIScale
ClydeWindow.Size = new((int)(ClydeWindow.Size.X * UIScale), (int)(ClydeWindow.Size.Y * UIScale));
ClydeWindow.Size = new((int)(parameters.Width * UIScale), (int)(parameters.Height * UIScale));
return ClydeWindow;
}