From: Cheng Zhao Date: Mon, 5 Oct 2015 11:32:23 +0000 (+0800) Subject: osx: Fix converting size for frameless window X-Git-Tag: v0.33.7~26^2~4^2~16 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=279407f7a300e0914b5fdc6b0b6cb0fb3b23a2f8;p=electron.git osx: Fix converting size for frameless window --- diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index 76f9b0d0..70c3cfc0 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -789,12 +789,18 @@ void NativeWindowMac::HandleKeyboardEvent( } gfx::Size NativeWindowMac::ContentSizeToWindowSize(const gfx::Size& size) { + if (!has_frame()) + return size; + NSRect content = NSMakeRect(0, 0, size.width(), size.height()); NSRect frame = [window_ frameRectForContentRect:content]; return gfx::Size(frame.size); } gfx::Size NativeWindowMac::WindowSizeToContentSize(const gfx::Size& size) { + if (!has_frame()) + return size; + NSRect frame = NSMakeRect(0, 0, size.width(), size.height()); NSRect content = [window_ contentRectForFrameRect:frame]; return gfx::Size(content.size);