mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 23:21:58 +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) {
|
void SetPosition(void* inctx, int x, int y) {
|
||||||
WailsContext *ctx = (__bridge WailsContext*) inctx;
|
WailsContext *ctx = (__bridge WailsContext*) inctx;
|
||||||
ON_MAIN_THREAD(
|
ON_MAIN_THREAD(
|
||||||
[ctx SetSize:x :y];
|
[ctx SetPosition:x :y];
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,9 +42,9 @@
|
|||||||
|
|
||||||
NSScreen* screen = [self getCurrentScreen];
|
NSScreen* screen = [self getCurrentScreen];
|
||||||
NSRect windowFrame = [self.mainWindow frame];
|
NSRect windowFrame = [self.mainWindow frame];
|
||||||
NSRect screenFrame = [screen visibleFrame];
|
NSRect screenFrame = [screen frame];
|
||||||
windowFrame.origin.x += screenFrame.origin.x + (float)x;
|
windowFrame.origin.x = screenFrame.origin.x + (float)x;
|
||||||
windowFrame.origin.y += (screenFrame.origin.y + screenFrame.size.height) - windowFrame.size.height - (float)y;
|
windowFrame.origin.y = (screenFrame.origin.y + screenFrame.size.height) - windowFrame.size.height - (float)y;
|
||||||
|
|
||||||
[self.mainWindow setFrame:windowFrame display:TRUE animate:FALSE];
|
[self.mainWindow setFrame:windowFrame display:TRUE animate:FALSE];
|
||||||
}
|
}
|
||||||
|
@ -228,6 +228,7 @@ int main(int argc, const char * argv[]) {
|
|||||||
AppendSubmenu(m, submenu);
|
AppendSubmenu(m, submenu);
|
||||||
UpdateMenuItem(menuITem, 1);
|
UpdateMenuItem(menuITem, 1);
|
||||||
SetAsApplicationMenu(result, m);
|
SetAsApplicationMenu(result, m);
|
||||||
|
SetPosition(result, 100, 100);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user