5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 23:02:19 +08:00

[mac] Fix SetPosition

This commit is contained in:
Lea Anthony 2021-10-30 16:31:06 +11:00
parent 4be4946756
commit 1dd957f461
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
3 changed files with 6 additions and 5 deletions

View File

@ -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];
);
}

View File

@ -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];
}

View File

@ -228,6 +228,7 @@ int main(int argc, const char * argv[]) {
AppendSubmenu(m, submenu);
UpdateMenuItem(menuITem, 1);
SetAsApplicationMenu(result, m);
SetPosition(result, 100, 100);