]> khamidou — GitHub mirrors - electron.git/commitdiff
mac: Always call SetSize for framless window
authorCheng Zhao <zcbenz@gmail.com>
Tue, 21 Jul 2015 02:29:05 +0000 (10:29 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 21 Jul 2015 02:29:05 +0000 (10:29 +0800)
atom/browser/native_window_mac.mm

index c0d358bb8f72493e08761e5aa390aca489f6a3fb..8d5cf7d414cfbf2134c629abbb97138cacb2caff 100644 (file)
@@ -357,7 +357,7 @@ NativeWindowMac::NativeWindowMac(
   // On OS X the initial window size doesn't include window frame.
   bool use_content_size = false;
   options.Get(switches::kUseContentSize, &use_content_size);
-  if (has_frame_ && !use_content_size)
+  if (!has_frame_ || !use_content_size)
     SetSize(gfx::Size(width, height));
 
   // Enable the NSView to accept first mouse event.
@@ -494,6 +494,11 @@ gfx::Rect NativeWindowMac::GetBounds() {
 }
 
 void NativeWindowMac::SetContentSize(const gfx::Size& size) {
+  if (!has_frame_) {
+    SetSize(size);
+    return;
+  }
+
   NSRect frame_nsrect = [window_ frame];
   NSSize frame = frame_nsrect.size;
   NSSize content = [window_ contentRectForFrameRect:frame_nsrect].size;