Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1882)

Unified Diff: ui/views/widget/native_widget_win.cc

Issue 9254046: Custom frame UI for platform apps on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rearchitect to use NonClientFrameView Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/native_widget_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2f601a8be9646cb8e01245a6f8e3bc0580497b1c 100644
--- a/ui/views/widget/native_widget_win.cc
+++ b/ui/views/widget/native_widget_win.cc
@@ -814,7 +814,7 @@ void NativeWidgetWin::SetBounds(const gfx::Rect& bounds) {
if (style & WS_MAXIMIZE)
SetWindowLong(GWL_STYLE, style & ~WS_MAXIMIZE);
SetWindowPos(NULL, bounds.x(), bounds.y(), bounds.width(), bounds.height(),
- SWP_NOACTIVATE | SWP_NOZORDER);
+ SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
jeremya 2012/02/06 00:58:32 I added this to make the call to SetInitialBounds(
}
void NativeWidgetWin::SetSize(const gfx::Size& size) {
@@ -1641,9 +1641,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 && ShouldRemoveStandardFrame())) {
SetMsgHandled(FALSE);
return 0;
}
@@ -1728,7 +1730,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 (!ShouldRemoveStandardFrame() && GetWidget()->ShouldUseNativeFrame()) {
LRESULT result;
if (DwmDefWindowProc(GetNativeView(), WM_NCHITTEST, 0,
MAKELPARAM(point.x, point.y), &result)) {
@@ -2361,6 +2363,14 @@ bool NativeWidgetWin::WidgetSizeIsClientSize() const {
return IsZoomed() || (widget && widget->ShouldUseNativeFrame());
}
+bool NativeWidgetWin::ShouldRemoveStandardFrame() const {
+ NonClientFrameView* frame_view = GetWidget()->non_client_view()->frame_view();
jeremya 2012/02/06 00:58:32 I've hit some problems (hopefully none of which re
+ gfx::Rect client_area = frame_view->GetBoundsForClientView();
+ gfx::Rect window_area =
+ frame_view->GetWindowBoundsForClientBounds(client_area);
+ return client_area == window_area;
+}
+
void NativeWidgetWin::ClientAreaSizeChanged() {
RECT r;
if (WidgetSizeIsClientSize())
@@ -2374,6 +2384,11 @@ void NativeWidgetWin::ClientAreaSizeChanged() {
delegate_->OnNativeWidgetSizeChanged(s);
if (use_layered_buffer_)
layered_window_contents_.reset(new gfx::CanvasSkia(s, false));
+
+ if (ShouldRemoveStandardFrame()) {
+ MARGINS m = {10, 10, 10, 10};
+ DwmExtendFrameIntoClientArea(GetNativeView(), &m);
jeremya 2012/02/06 00:58:32 This is appropriate for the specific case of the S
+ }
}
void NativeWidgetWin::ResetWindowRegion(bool force) {
« no previous file with comments | « ui/views/widget/native_widget_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698