summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2016-08-03 07:33:44 +0200
committerGitHub <noreply@github.com>2016-08-03 07:33:44 +0200
commit01ac237ab717e51db84f9c25b1fbe8141ff8cca0 (patch)
tree9e22dee1491d85beecefdf2ee7cbef2d0c9dacd5
parente51f4725fef586077fa1abfc56873b0f87d8b27d (diff)
parent38de4d24efb51e70302fd08c819241db5ec545ad (diff)
Merge pull request #6021 from marcelofg55/master
Fix set_window_size not setting the correct size on OSX
-rw-r--r--platform/osx/os_osx.mm10
1 files changed, 10 insertions, 0 deletions
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index dc87f767f6..ffae536ef0 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];
};