diff options
| author | marcelofg55 | 2016-08-02 22:30:19 -0300 |
|---|---|---|
| committer | Rémi Verschelde | 2016-08-03 17:52:10 +0200 |
| commit | fd6f62fd9a02aaf537fe507a1657391091deff4d (patch) | |
| tree | bbafc9a29c745493d215f2c140db553e17f69de6 | |
| parent | cea949180688add09eb9e69f5e405f361dc96d40 (diff) | |
| download | godot-fd6f62fd9a02aaf537fe507a1657391091deff4d.tar.gz godot-fd6f62fd9a02aaf537fe507a1657391091deff4d.tar.zst godot-fd6f62fd9a02aaf537fe507a1657391091deff4d.zip | |
Fix set_window_size not setting the correct size on OSX
(cherry picked from commit 38de4d24efb51e70302fd08c819241db5ec545ad)
| -rw-r--r-- | platform/osx/os_osx.mm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index dc87f767f..ffae536ef 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -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) { 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]; [window_object setFrame:NSMakeRect(frame.origin.x, frame.origin.y, size.x, size.y) display:YES]; }; |
