win: Don't allow maximzing a unresiazble frameless window

Fixes #857.
This commit is contained in:
Cheng Zhao 2014-12-15 12:51:45 -08:00
parent 85b0885af7
commit 3d30e6ddc4

View file

@ -411,17 +411,15 @@ gfx::Size NativeWindowViews::GetMaximumSize() {
void NativeWindowViews::SetResizable(bool resizable) { void NativeWindowViews::SetResizable(bool resizable) {
#if defined(OS_WIN) #if defined(OS_WIN)
if (has_frame_) { // WS_MAXIMIZEBOX => Maximize button
// WS_MAXIMIZEBOX => Maximize button // WS_MINIMIZEBOX => Minimize button
// WS_MINIMIZEBOX => Minimize button // WS_THICKFRAME => Resize handle
// WS_THICKFRAME => Resize handle DWORD style = ::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE);
DWORD style = ::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE); if (resizable)
if (resizable) style |= WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_THICKFRAME;
style |= WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_THICKFRAME; else
else style = (style & ~(WS_MAXIMIZEBOX | WS_THICKFRAME)) | WS_MINIMIZEBOX;
style = (style & ~(WS_MAXIMIZEBOX | WS_THICKFRAME)) | WS_MINIMIZEBOX; ::SetWindowLong(GetAcceleratedWidget(), GWL_STYLE, style);
::SetWindowLong(GetAcceleratedWidget(), GWL_STYLE, style);
}
#elif defined(USE_X11) #elif defined(USE_X11)
if (resizable != resizable_) { if (resizable != resizable_) {
// On Linux there is no "resizable" property of a window, we have to set // On Linux there is no "resizable" property of a window, we have to set