fix: Windows 7 frame showing for frameless non-resizable windows (#35365)

This commit is contained in:
Raymond Zhao 2022-10-13 08:39:40 -07:00 committed by GitHub
parent 79454dc50d
commit ce138fe969
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 45 deletions

View file

@ -280,24 +280,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
new ElectronDesktopWindowTreeHostLinux(this, native_widget);
#endif
// Ref https://github.com/electron/electron/issues/30760
// Set the can_resize param before initializing the widget.
// When resizable_ is true, this causes the WS_THICKFRAME style
// to be passed into CreateWindowEx and SetWindowLong calls in
// WindowImpl::Init and HwndMessageHandler::SizeConstraintsChanged
// respectively. As a result, the Windows 7 frame doesn't show,
// but it isn't clear why this is the case.
// When resizable_ is false, WS_THICKFRAME is not passed into the
// SetWindowLong call, so the Windows 7 frame still shows.
// One workaround would be to call set_can_resize(true) here,
// and then move the SetCanResize(resizable_) call after the
// SetWindowLong call around line 365, but that's a much larger change.
set_can_resize(true);
widget()->Init(std::move(params));
// When the workaround above is not needed anymore, only this
// call should be necessary.
// With the workaround in place, this call doesn't do anything.
SetCanResize(resizable_);
bool fullscreen = false;