fix: maximized frameless window bleeding to other monitors (#25940)

This commit is contained in:
Cheng Zhao 2020-10-16 06:05:44 +09:00 committed by GitHub
parent 1c44bb8e74
commit 20c6677a9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 61 deletions

View file

@ -6,29 +6,11 @@
#include "base/win/windows_version.h"
#include "shell/browser/native_window_views.h"
#include "ui/display/win/screen_win.h"
#include "ui/views/widget/widget.h"
#include "ui/views/win/hwnd_util.h"
namespace electron {
namespace {
gfx::Insets GetGlassInsets() {
int frame_height =
display::win::ScreenWin::GetSystemMetricsInDIP(SM_CYSIZEFRAME) +
display::win::ScreenWin::GetSystemMetricsInDIP(SM_CXPADDEDBORDER);
int frame_size =
base::win::GetVersion() < base::win::Version::WIN8
? display::win::ScreenWin::GetSystemMetricsInDIP(SM_CXSIZEFRAME)
: 0;
return gfx::Insets(frame_height, frame_size, frame_size, frame_size);
}
} // namespace
const char WinFrameView::kViewClassName[] = "WinFrameView";
WinFrameView::WinFrameView() {}
@ -42,17 +24,6 @@ gfx::Rect WinFrameView::GetWindowBoundsForClientBounds(
client_bounds);
}
gfx::Rect WinFrameView::GetBoundsForClientView() const {
if (window_->IsMaximized() && !window_->has_frame()) {
gfx::Insets insets = GetGlassInsets();
gfx::Rect result(width(), height());
result.Inset(insets);
return result;
} else {
return bounds();
}
}
int WinFrameView::NonClientHitTest(const gfx::Point& point) {
if (window_->has_frame())
return frame_->client_view()->NonClientHitTest(point);

View file

@ -16,7 +16,6 @@ class WinFrameView : public FramelessView {
~WinFrameView() override;
// views::NonClientFrameView:
gfx::Rect GetBoundsForClientView() const override;
gfx::Rect GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const override;
int NonClientHitTest(const gfx::Point& point) override;