diff options
author | ianet@chromium.org <ianet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-30 04:56:06 +0000 |
---|---|---|
committer | ianet@chromium.org <ianet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-30 04:56:06 +0000 |
commit | ea98c37dcee0cccf16a634ec0679c44067496889 (patch) | |
tree | 70ec43a5c8fa453f47e5a3a17df3794323ec87bd /ui | |
parent | a8617d050d52a5aec2e693e18d49f5cb5af9d8e9 (diff) | |
download | chromium_src-ea98c37dcee0cccf16a634ec0679c44067496889.zip chromium_src-ea98c37dcee0cccf16a634ec0679c44067496889.tar.gz chromium_src-ea98c37dcee0cccf16a634ec0679c44067496889.tar.bz2 |
Handle Tile\Cascade\Stack window managment operations on Windows
Bug=900
Test=Right-click on the tray and select 'Cascade'. Chrome should cascade along with other windows
Review URL: https://chromiumcodereview.appspot.com/11946005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179528 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/base/win/window_impl.cc | 10 | ||||
-rw-r--r-- | ui/views/win/hwnd_message_handler.cc | 16 | ||||
-rw-r--r-- | ui/views/win/hwnd_message_handler.h | 3 |
3 files changed, 28 insertions, 1 deletions
diff --git a/ui/base/win/window_impl.cc b/ui/base/win/window_impl.cc index d494efa..abc0709 100644 --- a/ui/base/win/window_impl.cc +++ b/ui/base/win/window_impl.cc @@ -177,6 +177,16 @@ void WindowImpl::Init(HWND parent, const gfx::Rect& bounds) { reinterpret_cast<wchar_t*>(atom), NULL, window_style_, x, y, width, height, parent, NULL, NULL, this); + + // First nccalcszie (during CreateWindow) for captioned windows is + // deliberately ignored so force a second one here to get the right + // non-client set up. + if (hwnd && (window_style_ & WS_CAPTION)) { + SetWindowPos(hwnd, NULL, 0, 0, 0, 0, + SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | + SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW); + } + if (!hwnd_ && GetLastError() == 0) { base::debug::Alias(&destroyed); base::debug::Alias(&hwnd); diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc index 23cc5e2..6914dcd 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -388,7 +388,8 @@ HWNDMessageHandler::HWNDMessageHandler(HWNDMessageHandlerDelegate* delegate) use_layered_buffer_(false), layered_alpha_(255), ALLOW_THIS_IN_INITIALIZER_LIST(paint_layered_window_factory_(this)), - can_update_layered_window_(true) { + can_update_layered_window_(true), + is_first_nccalc_(true) { } HWNDMessageHandler::~HWNDMessageHandler() { @@ -1618,6 +1619,19 @@ LRESULT HWNDMessageHandler::OnNCCalcSize(BOOL mode, LPARAM l_param) { // non-client edge width. Note that in most cases "no insets" means no // custom width, but in fullscreen mode or when the NonClientFrameView // requests it, we want a custom width of 0. + + // Let User32 handle the first nccalcsize for captioned windows + // so it updates its internal structures (specifically caption-present) + // Without this Tile & Cascade windows won't work. + // See http://code.google.com/p/chromium/issues/detail?id=900 + if (is_first_nccalc_) { + is_first_nccalc_ = false; + if (GetWindowLong(hwnd(), GWL_STYLE) & WS_CAPTION) { + SetMsgHandled(FALSE); + return 0; + } + } + gfx::Insets insets = GetClientAreaInsets(); if (insets.empty() && !fullscreen_handler_->fullscreen() && !(mode && remove_standard_frame_)) { diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h index 96b9931..b75003e 100644 --- a/ui/views/win/hwnd_message_handler.h +++ b/ui/views/win/hwnd_message_handler.h @@ -461,6 +461,9 @@ class VIEWS_EXPORT HWNDMessageHandler : public ui::WindowImpl, // store if necessary. bool can_update_layered_window_; + // True the first time nccalc is called on a sizable widget + bool is_first_nccalc_; + DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler); }; |