From 8fab9f8c13c251d6d391a75e320f32d9e018efcd Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 28 Jul 2018 15:05:06 +0300 Subject: [PATCH] - set default window size to 80% of screen in Cocoa backend --- src/posix/cocoa/i_video.mm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index 534393019..b5da95db1 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -493,12 +493,19 @@ void SystemGLFrameBuffer::SetWindowedMode() const NSSize minimumFrameSize = NSMakeSize(minimumFrameWidth, minimumFrameHeight); [m_window setMinSize:minimumFrameSize]; - const bool isFrameValid = win_x >= 0 && win_y >= 0 + const bool isFrameValid = win_x != -1 && win_y != -1 && win_w >= minimumFrameWidth && win_h >= minimumFrameHeight; - const NSRect frameSize = isFrameValid - ? NSMakeRect(win_x, win_y, win_w, win_h) - : NSMakeRect(0, 0, vid_defwidth, vid_defheight); + if (!isFrameValid) + { + const NSRect screenSize = [[NSScreen mainScreen] frame]; + win_x = screenSize.origin.x + screenSize.size.width / 10; + win_y = screenSize.origin.y + screenSize.size.height / 10; + win_w = screenSize.size.width * 8 / 10; + win_h = screenSize.size.height * 8 / 10 + GetTitleBarHeight(); + } + + const NSRect frameSize = NSMakeRect(win_x, win_y, win_w, win_h); [m_window setFrame:frameSize display:YES]; [m_window enterFullscreenOnZoom]; [m_window exitAppOnClose];