mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 08:23:29 +00:00
Fix set_window_size not setting the correct size on OSX
This commit is contained in:
parent
3d1d190dcd
commit
38de4d24ef
1 changed files with 10 additions and 0 deletions
|
@ -1494,9 +1494,19 @@ Size2 OS_OSX::get_window_size() const {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const int menuHeight = [[NSStatusBar systemStatusBar] thickness];
|
||||||
|
|
||||||
void OS_OSX::set_window_size(const Size2 p_size) {
|
void OS_OSX::set_window_size(const Size2 p_size) {
|
||||||
|
|
||||||
Size2 size=p_size;
|
Size2 size=p_size;
|
||||||
|
|
||||||
|
// NSRect used by setFrame includes the title bar, so add it to our size.y
|
||||||
|
CGFloat menuBarHeight = [[[NSApplication sharedApplication] mainMenu] menuBarHeight];
|
||||||
|
if (menuBarHeight != 0.f) {
|
||||||
|
size.y+= menuBarHeight;
|
||||||
|
} else {
|
||||||
|
size.y+= menuHeight;
|
||||||
|
}
|
||||||
NSRect frame = [window_object frame];
|
NSRect frame = [window_object frame];
|
||||||
[window_object setFrame:NSMakeRect(frame.origin.x, frame.origin.y, size.x, size.y) display:YES];
|
[window_object setFrame:NSMakeRect(frame.origin.x, frame.origin.y, size.x, size.y) display:YES];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue