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:
parent
4be4946756
commit
1dd957f461
@ -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];
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -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];
|
||||
}
|
||||
|
||||
|
@ -228,6 +228,7 @@ int main(int argc, const char * argv[]) {
|
||||
AppendSubmenu(m, submenu);
|
||||
UpdateMenuItem(menuITem, 1);
|
||||
SetAsApplicationMenu(result, m);
|
||||
SetPosition(result, 100, 100);
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user