Chromium Code Reviews| Index: ui/views/widget/native_widget_win.cc |
| diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc |
| index 8ce9e9249df0bc5742541146c286dd8fe7ef3c79..41c00195b49d415a24b4e9c1d39a16f05bee638d 100644 |
| --- a/ui/views/widget/native_widget_win.cc |
| +++ b/ui/views/widget/native_widget_win.cc |
| @@ -550,6 +550,10 @@ void NativeWidgetWin::FrameTypeChanged() { |
| DWMNCRP_ENABLED : DWMNCRP_DISABLED; |
| DwmSetWindowAttribute(GetNativeView(), DWMWA_NCRENDERING_POLICY, |
| &policy, sizeof(DWMNCRENDERINGPOLICY)); |
| + |
| + if (remove_standard_frame_) { |
| + UpdateDWMFrame(); |
|
Ben Goodger (Google)
2012/02/07 20:18:57
no braces on single line if
jeremya
2012/02/08 00:35:16
Done.
|
| + } |
| } |
| // Send a frame change notification, since the non-client metrics have |
| @@ -1292,6 +1296,11 @@ LRESULT NativeWidgetWin::OnCreate(CREATESTRUCT* create_struct) { |
| // We should attach IMEs only when we need to input CJK strings. |
| ImmAssociateContextEx(hwnd(), NULL, 0); |
| + if (remove_standard_frame_) { |
| + SendFrameChanged(GetNativeView()); |
| + UpdateDWMFrame(); |
| + } |
| + |
| // We need to allow the delegate to size its contents since the window may not |
| // receive a size notification when its initial bounds are specified at window |
| // creation time. |
| @@ -1641,9 +1650,11 @@ LRESULT NativeWidgetWin::OnNCActivate(BOOL active) { |
| LRESULT NativeWidgetWin::OnNCCalcSize(BOOL mode, LPARAM l_param) { |
| // We only override the default handling if we need to specify a custom |
| // non-client edge width. Note that in most cases "no insets" means no |
| - // custom width, but in fullscreen mode we want a custom width of 0. |
| + // custom width, but in fullscreen mode or when the NonClientFrameView |
| + // requests it, we want a custom width of 0. |
| gfx::Insets insets = GetClientAreaInsets(); |
| - if (insets.empty() && !IsFullscreen()) { |
| + if (insets.empty() && !IsFullscreen() && |
| + !(mode && remove_standard_frame_)) { |
| SetMsgHandled(FALSE); |
| return 0; |
| } |
| @@ -1728,7 +1739,7 @@ LRESULT NativeWidgetWin::OnNCHitTest(const CPoint& point) { |
| // If the DWM is rendering the window controls, we need to give the DWM's |
| // default window procedure first chance to handle hit testing. |
| - if (GetWidget()->ShouldUseNativeFrame()) { |
| + if (!remove_standard_frame_ && GetWidget()->ShouldUseNativeFrame()) { |
| LRESULT result; |
| if (DwmDefWindowProc(GetNativeView(), WM_NCHITTEST, 0, |
| MAKELPARAM(point.x, point.y), &result)) { |
| @@ -2303,6 +2314,7 @@ void NativeWidgetWin::SetInitParams(const Widget::InitParams& params) { |
| set_window_ex_style(window_ex_style() | ex_style); |
| has_non_client_view_ = Widget::RequiresNonClientView(params.type); |
| + remove_standard_frame_ = params.remove_standard_frame; |
| } |
| void NativeWidgetWin::RedrawInvalidRect() { |
| @@ -2376,6 +2388,11 @@ void NativeWidgetWin::ClientAreaSizeChanged() { |
| layered_window_contents_.reset(new gfx::CanvasSkia(s, false)); |
| } |
| +void NativeWidgetWin::UpdateDWMFrame() { |
| + MARGINS m = {10, 10, 10, 10}; |
| + DwmExtendFrameIntoClientArea(GetNativeView(), &m); |
|
Ben Goodger (Google)
2012/02/07 20:18:57
I understand the NCCALCSIZE handling... but what i
jeremya
2012/02/08 00:35:16
Without this, Windows doesn't draw any glass, whic
|
| +} |
| + |
| void NativeWidgetWin::ResetWindowRegion(bool force) { |
| // A native frame uses the native window region, and we don't want to mess |
| // with it. |