]> khamidou — GitHub mirrors - electron.git/commitdiff
win: Fix the resizable flag, closed #316.
authorCheng Zhao <zcbenz@gmail.com>
Tue, 20 May 2014 15:37:14 +0000 (23:37 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 20 May 2014 15:37:14 +0000 (23:37 +0800)
atom/browser/native_window_win.cc

index 28dd6dea918501b11c32139a860929d45ad86d61..27b0d634e67f3a26fac24d24a060163b6c0f32e0 100644 (file)
@@ -205,6 +205,8 @@ NativeWindowWin::NativeWindowWin(content::WebContents* web_contents,
       web_view_(new views::WebView(NULL)),
       use_content_size_(false),
       resizable_(true) {
+  options->GetBoolean(switches::kResizable, &resizable_);
+
   views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
   params.delegate = this;
   params.native_widget = new MenuCommandNativeWidget(this);
@@ -327,6 +329,15 @@ gfx::Size NativeWindowWin::GetMaximumSize() {
 
 void NativeWindowWin::SetResizable(bool resizable) {
   resizable_ = resizable;
+
+  // WS_MAXIMIZEBOX => Maximize/Minimize button
+  // WS_THICKFRAME => Resize handle
+  DWORD style = ::GetWindowLong(GetNativeWindow(), GWL_STYLE);
+  if (resizable)
+    style |= WS_MAXIMIZEBOX | WS_THICKFRAME;
+  else
+    style &= ~(WS_MAXIMIZEBOX | WS_THICKFRAME);
+  ::SetWindowLong(GetNativeWindow(), GWL_STYLE, style);
 }
 
 bool NativeWindowWin::IsResizable() {