Merge pull request #10280 from electron/fix-10280
Fix 'BrowserWindow module window states resizable state works for a frameless window'
This commit is contained in:
commit
dede3d6213
2 changed files with 15 additions and 4 deletions
|
@ -304,11 +304,16 @@ NativeWindowViews::NativeWindowViews(
|
|||
::SetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE, ex_style);
|
||||
#endif
|
||||
|
||||
// TODO(zcbenz): This was used to force using native frame on Windows 2003, we
|
||||
// should check whether setting it in InitParams can work.
|
||||
if (has_frame()) {
|
||||
// TODO(zcbenz): This was used to force using native frame on Windows 2003,
|
||||
// we should check whether setting it in InitParams can work.
|
||||
window_->set_frame_type(views::Widget::FrameType::FRAME_TYPE_FORCE_NATIVE);
|
||||
window_->FrameTypeChanged();
|
||||
#if defined(OS_WIN)
|
||||
// thickFrame also works for normal window.
|
||||
if (!thick_frame_)
|
||||
FlipWindowStyle(GetAcceleratedWidget(), false, WS_THICKFRAME);
|
||||
#endif
|
||||
}
|
||||
|
||||
gfx::Size size = bounds.size();
|
||||
|
@ -577,6 +582,12 @@ gfx::Size NativeWindowViews::GetContentSize() {
|
|||
void NativeWindowViews::SetContentSizeConstraints(
|
||||
const extensions::SizeConstraints& size_constraints) {
|
||||
NativeWindow::SetContentSizeConstraints(size_constraints);
|
||||
#if defined(OS_WIN)
|
||||
// Changing size constraints would force adding the WS_THICKFRAME style, so
|
||||
// do nothing if thickFrame is false.
|
||||
if (!thick_frame_)
|
||||
return;
|
||||
#endif
|
||||
// widget_delegate() is only available after Init() is called, we make use of
|
||||
// this to determine whether native widget has initialized.
|
||||
if (window_ && window_->widget_delegate())
|
||||
|
@ -589,7 +600,7 @@ void NativeWindowViews::SetContentSizeConstraints(
|
|||
|
||||
void NativeWindowViews::SetResizable(bool resizable) {
|
||||
#if defined(OS_WIN)
|
||||
if (has_frame())
|
||||
if (has_frame() && thick_frame_)
|
||||
FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME);
|
||||
#elif defined(USE_X11)
|
||||
if (resizable != resizable_) {
|
||||
|
|
|
@ -1962,7 +1962,7 @@ describe('BrowserWindow module', function () {
|
|||
assert.equal(w.isResizable(), true)
|
||||
})
|
||||
|
||||
xit('works for a frameless window', () => {
|
||||
it('works for a frameless window', () => {
|
||||
w.destroy()
|
||||
w = new BrowserWindow({show: false, frame: false})
|
||||
assert.equal(w.isResizable(), true)
|
||||
|
|
Loading…
Reference in a new issue