fix: allow chromium to handle WM_NCCALCSIZE for frameless windows (#21164)

This commit is contained in:
Robo 2019-11-19 06:07:10 -08:00 committed by GitHub
parent c8ed22def3
commit 73467f00e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 205 additions and 206 deletions

View file

@ -4,6 +4,8 @@
#include "shell/browser/ui/win/atom_desktop_window_tree_host_win.h"
#include "ui/base/win/hwnd_metrics.h"
namespace electron {
AtomDesktopWindowTreeHostWin::AtomDesktopWindowTreeHostWin(
@ -29,4 +31,17 @@ bool AtomDesktopWindowTreeHostWin::HasNativeFrame() const {
return true;
}
bool AtomDesktopWindowTreeHostWin::GetClientAreaInsets(gfx::Insets* insets,
HMONITOR monitor) const {
if (IsMaximized() && !native_window_view_->has_frame()) {
// Windows automatically adds a standard width border to all sides when a
// window is maximized.
int frame_thickness = ui::GetFrameThickness(monitor) - 1;
*insets = gfx::Insets(frame_thickness, frame_thickness, frame_thickness,
frame_thickness);
return true;
}
return false;
}
} // namespace electron

View file

@ -25,6 +25,8 @@ class AtomDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin {
LPARAM l_param,
LRESULT* result) override;
bool HasNativeFrame() const override;
bool GetClientAreaInsets(gfx::Insets* insets,
HMONITOR monitor) const override;
private:
NativeWindowViews* native_window_view_; // weak ref