From 454d170dfb509ce7d83c7a437ff0a097c27c6e2d Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Fri, 20 Dec 2024 18:12:54 +1100 Subject: [PATCH] [mac] setPosition - adjust based on scale factor --- v3/pkg/application/webview_window_darwin.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/v3/pkg/application/webview_window_darwin.go b/v3/pkg/application/webview_window_darwin.go index 5e9386949..bea282f0b 100644 --- a/v3/pkg/application/webview_window_darwin.go +++ b/v3/pkg/application/webview_window_darwin.go @@ -578,10 +578,14 @@ void windowSetPosition(void* nsWindow, int x, int y) { if (screen == NULL) { screen = [NSScreen mainScreen]; } + // Get the scale of the screen + CGFloat scale = [screen backingScaleFactor]; NSRect frame = [window frame]; - frame.origin.x = x; - frame.origin.y = (screen.frame.size.height - frame.size.height) - y; - [window setFrame:frame display:YES]; + // Scale the position + frame.origin.x = x / scale; + frame.origin.y = (screen.frame.size.height - frame.size.height) - (y / scale); + // Set the frame + [window setFrame:frame display:YES]; }