Use Chrome default client inset handling
This commit is contained in:
parent
7f4bd79b01
commit
fe8726d775
5 changed files with 6 additions and 35 deletions
|
@ -70,20 +70,6 @@ const int kMenuBarHeight = 25;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
gfx::Rect SubtractBorderSize(gfx::Rect bounds) {
|
|
||||||
gfx::Point borderSize = gfx::Point(
|
|
||||||
GetSystemMetrics(SM_CXSIZEFRAME) - 1, // width
|
|
||||||
GetSystemMetrics(SM_CYSIZEFRAME) - 1); // height
|
|
||||||
gfx::Point dpiAdjustedSize =
|
|
||||||
display::win::ScreenWin::ScreenToDIPPoint(borderSize);
|
|
||||||
|
|
||||||
bounds.set_x(bounds.x() + dpiAdjustedSize.x());
|
|
||||||
bounds.set_y(bounds.y() + dpiAdjustedSize.y());
|
|
||||||
bounds.set_width(bounds.width() - 2 * dpiAdjustedSize.x());
|
|
||||||
bounds.set_height(bounds.height() - 2 * dpiAdjustedSize.y());
|
|
||||||
return bounds;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FlipWindowStyle(HWND handle, bool on, DWORD flag) {
|
void FlipWindowStyle(HWND handle, bool on, DWORD flag) {
|
||||||
DWORD style = ::GetWindowLong(handle, GWL_STYLE);
|
DWORD style = ::GetWindowLong(handle, GWL_STYLE);
|
||||||
if (on)
|
if (on)
|
||||||
|
@ -1279,16 +1265,6 @@ void NativeWindowViews::HandleKeyboardEvent(
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowViews::Layout() {
|
void NativeWindowViews::Layout() {
|
||||||
#if defined(OS_WIN)
|
|
||||||
// Reserve border space for maximized frameless window so we won't have the
|
|
||||||
// content go outside of screen.
|
|
||||||
if (!has_frame() && IsMaximized()) {
|
|
||||||
gfx::Rect bounds = SubtractBorderSize(GetContentsBounds());
|
|
||||||
web_view_->SetBoundsRect(bounds);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const auto size = GetContentsBounds().size();
|
const auto size = GetContentsBounds().size();
|
||||||
const auto menu_bar_bounds =
|
const auto menu_bar_bounds =
|
||||||
menu_bar_ ? gfx::Rect(0, 0, size.width(), kMenuBarHeight) : gfx::Rect();
|
menu_bar_ ? gfx::Rect(0, 0, size.width(), kMenuBarHeight) : gfx::Rect();
|
||||||
|
|
|
@ -23,7 +23,6 @@ WinFrameView::WinFrameView() {
|
||||||
WinFrameView::~WinFrameView() {
|
WinFrameView::~WinFrameView() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gfx::Rect WinFrameView::GetWindowBoundsForClientBounds(
|
gfx::Rect WinFrameView::GetWindowBoundsForClientBounds(
|
||||||
const gfx::Rect& client_bounds) const {
|
const gfx::Rect& client_bounds) const {
|
||||||
return views::GetWindowBoundsForClientBounds(
|
return views::GetWindowBoundsForClientBounds(
|
||||||
|
|
|
@ -25,12 +25,4 @@ bool AtomDesktopWindowTreeHostWin::PreHandleMSG(
|
||||||
return delegate_->PreHandleMSG(message, w_param, l_param, result);
|
return delegate_->PreHandleMSG(message, w_param, l_param, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Override the client area inset
|
|
||||||
* Returning true forces a border of 0 for frameless windows
|
|
||||||
*/
|
|
||||||
bool AtomDesktopWindowTreeHostWin::GetClientAreaInsets(
|
|
||||||
gfx::Insets* insets) const {
|
|
||||||
return !HasFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -27,7 +27,6 @@ class AtomDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin {
|
||||||
protected:
|
protected:
|
||||||
bool PreHandleMSG(
|
bool PreHandleMSG(
|
||||||
UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) override;
|
UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) override;
|
||||||
bool GetClientAreaInsets(gfx::Insets* insets) const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MessageHandlerDelegate* delegate_; // weak ref
|
MessageHandlerDelegate* delegate_; // weak ref
|
||||||
|
|
|
@ -126,7 +126,12 @@
|
||||||
'VCManifestTool': {
|
'VCManifestTool': {
|
||||||
'EmbedManifest': 'true',
|
'EmbedManifest': 'true',
|
||||||
'AdditionalManifestFiles': 'atom/browser/resources/win/atom.manifest',
|
'AdditionalManifestFiles': 'atom/browser/resources/win/atom.manifest',
|
||||||
}
|
},
|
||||||
|
'VCLinkerTool': {
|
||||||
|
'AdditionalOptions': [
|
||||||
|
"/SUBSYSTEM:WINDOWS,5.02"
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'copies': [
|
'copies': [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue