]> khamidou — GitHub mirrors - electron.git/commitdiff
osx: Set resizable flag when creating window
authorCheng Zhao <zcbenz@gmail.com>
Tue, 6 Oct 2015 07:23:23 +0000 (15:23 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 6 Oct 2015 07:23:23 +0000 (15:23 +0800)
Setting resizable for frameless window before it is shown will change
its size.

atom/browser/native_window.cc
atom/browser/native_window_mac.mm

index 981804cb22c9beb77586c17f5e41253611c97b3b..dd4694b3bd6b5d350ccc196642dd6ad0e7c245e5 100644 (file)
@@ -134,10 +134,12 @@ void NativeWindow::InitFromOptions(const mate::Dictionary& options) {
   } else {
     SetSizeConstraints(size_constraints);
   }
+#if defined(OS_WIN) || defined(USE_X11)
   bool resizable;
   if (options.Get(switches::kResizable, &resizable)) {
     SetResizable(resizable);
   }
+#endif
   bool top;
   if (options.Get(switches::kAlwaysOnTop, &top) && top) {
     SetAlwaysOnTop(true);
index 5f867d9b1a6c1dba595b134c284b0e1525dec783..6420345da9b63812fe06d9941395e0adba420129 100644 (file)
@@ -350,6 +350,8 @@ NativeWindowMac::NativeWindowMac(
 
   bool useStandardWindow = true;
   options.Get(switches::kStandardWindow, &useStandardWindow);
+  bool resizable = true;
+  options.Get(switches::kResizable, &resizable);
 
   // New title bar styles are available in Yosemite or newer
   std::string titleBarStyle;
@@ -357,10 +359,13 @@ NativeWindowMac::NativeWindowMac(
     options.Get(switches::kTitleBarStyle, &titleBarStyle);
 
   NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask |
-                         NSMiniaturizableWindowMask | NSResizableWindowMask;
+                         NSMiniaturizableWindowMask;
   if (!useStandardWindow || transparent() || !has_frame()) {
     styleMask |= NSTexturedBackgroundWindowMask;
   }
+  if (resizable) {
+    styleMask |= NSResizableWindowMask;
+  }
   if ((titleBarStyle == "hidden") || (titleBarStyle == "hidden-inset")) {
     styleMask |= NSFullSizeContentViewWindowMask;
     styleMask |= NSUnifiedTitleAndToolbarWindowMask;