summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzturner@chromium.org <zturner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-14 00:10:40 +0000
committerzturner@chromium.org <zturner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-14 00:10:40 +0000
commit45a336a3f7313025e4a9dcf4cdb60126d2927b26 (patch)
treefc096c38c4f414ebe5acec36f0bcca500a1df6e5
parentfdbb54f57808da981d0e265b1bd622cb7aa571cb (diff)
downloadchromium_src-45a336a3f7313025e4a9dcf4cdb60126d2927b26.zip
chromium_src-45a336a3f7313025e4a9dcf4cdb60126d2927b26.tar.gz
chromium_src-45a336a3f7313025e4a9dcf4cdb60126d2927b26.tar.bz2
Fix z-order problem and cleanup a few nits.
Original patch: https://codereview.chromium.org/59043012/ The issue this patch addresses is that if a user has multiple chrome windows open (e.g. press Ctrl+N a few times), and then change the chrome theme or windows desktop theme, after the theme is changed the windows will be non-deterministically re-arranged in the z-order. BUG=312535, 311405 Review URL: https://codereview.chromium.org/60743003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234968 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ui/views/win/hwnd_message_handler.cc28
1 files changed, 13 insertions, 15 deletions
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index 6dcd9d0..1908232 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -784,24 +784,22 @@ void HWNDMessageHandler::FrameTypeChanged() {
// which will also trigger a redraw.
ResetWindowRegion(true, false);
- ::SetWindowPos(hwnd(), NULL, 0, 0, 0, 0,
- SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
-
// The non-client view needs to update too.
delegate_->HandleFrameChanged();
- // For some reason, we need to hide the window after we change the frame type.
- // If we don't, the client area will be filled with black. This is somehow
- // related to an interaction between SetWindowRgn and Dwm, but it's not clear
- // exactly what.
- if (IsVisible()) {
- SetWindowPos(hwnd(), NULL, 0, 0, 0, 0,
- SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW);
- SetWindowPos(hwnd(), NULL, 0, 0, 0, 0,
- SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
- }
+ if (IsVisible() && !delegate_->IsUsingCustomFrame()) {
+ // For some reason, we need to hide the window after we change from a custom
+ // frame to a native frame. If we don't, the client area will be filled
+ // with black. This seems to be related to an interaction between DWM and
+ // SetWindowRgn, but the details aren't clear. Additionally, we need to
+ // specify SWP_NOZORDER here, otherwise if you have multiple chrome windows
+ // open they will re-appear with a non-deterministic Z-order.
+ UINT flags = SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER;
+ SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW);
+ SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW);
- UpdateWindow(hwnd());
+ UpdateWindow(hwnd());
+ }
// WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want
// to notify our children too, since we can have MDI child windows who need to
@@ -1090,7 +1088,7 @@ bool HWNDMessageHandler::GetClientAreaInsets(gfx::Insets* insets) const {
return true;
}
- *insets = gfx::Insets(0, 0, 0, 0);
+ *insets = gfx::Insets();
return true;
}