From 1dd957f461d62ee1be7b115df43bf3e68094d756 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sat, 30 Oct 2021 16:31:06 +1100 Subject: [PATCH] [mac] Fix SetPosition --- v2/internal/frontend/desktop/darwin/Application.m | 2 +- v2/internal/frontend/desktop/darwin/WailsContext.m | 8 ++++---- v2/internal/frontend/desktop/darwin/main.m | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/v2/internal/frontend/desktop/darwin/Application.m b/v2/internal/frontend/desktop/darwin/Application.m index a4d5ee553..f296382ac 100644 --- a/v2/internal/frontend/desktop/darwin/Application.m +++ b/v2/internal/frontend/desktop/darwin/Application.m @@ -83,7 +83,7 @@ void SetMaxSize(void* inctx, int width, int height) { void SetPosition(void* inctx, int x, int y) { WailsContext *ctx = (__bridge WailsContext*) inctx; ON_MAIN_THREAD( - [ctx SetSize:x :y]; + [ctx SetPosition:x :y]; ); } diff --git a/v2/internal/frontend/desktop/darwin/WailsContext.m b/v2/internal/frontend/desktop/darwin/WailsContext.m index 9ddab5666..c0cbd2207 100644 --- a/v2/internal/frontend/desktop/darwin/WailsContext.m +++ b/v2/internal/frontend/desktop/darwin/WailsContext.m @@ -42,10 +42,10 @@ NSScreen* screen = [self getCurrentScreen]; NSRect windowFrame = [self.mainWindow frame]; - NSRect screenFrame = [screen visibleFrame]; - windowFrame.origin.x += screenFrame.origin.x + (float)x; - windowFrame.origin.y += (screenFrame.origin.y + screenFrame.size.height) - windowFrame.size.height - (float)y; - + NSRect screenFrame = [screen frame]; + windowFrame.origin.x = screenFrame.origin.x + (float)x; + windowFrame.origin.y = (screenFrame.origin.y + screenFrame.size.height) - windowFrame.size.height - (float)y; + [self.mainWindow setFrame:windowFrame display:TRUE animate:FALSE]; } diff --git a/v2/internal/frontend/desktop/darwin/main.m b/v2/internal/frontend/desktop/darwin/main.m index f98af2dcd..3b78740e8 100644 --- a/v2/internal/frontend/desktop/darwin/main.m +++ b/v2/internal/frontend/desktop/darwin/main.m @@ -228,6 +228,7 @@ int main(int argc, const char * argv[]) { AppendSubmenu(m, submenu); UpdateMenuItem(menuITem, 1); SetAsApplicationMenu(result, m); + SetPosition(result, 100, 100);