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

Unified Diff: ui/views/win/hwnd_message_handler.cc

Issue 1903223005: Fix for 593676 - Minimizes/eliminates momentary flash of Windows frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit; formatting Created 4 years, 6 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/win/hwnd_message_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/win/hwnd_message_handler.cc
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index 6c926d5166018a53c6e9c4b1c93b403f31e15f12..b035fd32716f75454a44aa5dd02b652a0c6dceba 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -523,6 +523,16 @@ void HWNDMessageHandler::SetBounds(const gfx::Rect& bounds_in_pixels,
SetBoundsInternal(bounds_in_pixels, force_size_changed);
}
+void HWNDMessageHandler::SetDwmFrameExtension(DwmFrameState state) {
+ if (!delegate_->HasFrame() && ui::win::IsAeroGlassEnabled() &&
+ (window_ex_style() & WS_EX_COMPOSITED) == 0) {
+ MARGINS m = {0, 0, 0, 0};
+ if (state == DwmFrameState::ON)
+ m = {0, 0, 1, 0};
+ DwmExtendFrameIntoClientArea(hwnd(), &m);
+ }
+}
+
void HWNDMessageHandler::SetSize(const gfx::Size& size) {
SetWindowPos(hwnd(), NULL, 0, 0, size.width(), size.height(),
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
@@ -2361,8 +2371,10 @@ void HWNDMessageHandler::OnWindowPosChanging(WINDOWPOS* window_pos) {
if (window_pos->flags & SWP_SHOWWINDOW)
delegate_->HandleVisibilityChanging(true);
- else if (window_pos->flags & SWP_HIDEWINDOW)
+ else if (window_pos->flags & SWP_HIDEWINDOW) {
+ SetDwmFrameExtension(DwmFrameState::OFF);
delegate_->HandleVisibilityChanging(false);
+ }
SetMsgHandled(FALSE);
}
@@ -2370,16 +2382,13 @@ void HWNDMessageHandler::OnWindowPosChanging(WINDOWPOS* window_pos) {
void HWNDMessageHandler::OnWindowPosChanged(WINDOWPOS* window_pos) {
if (DidClientAreaSizeChange(window_pos))
ClientAreaSizeChanged();
- if (!delegate_->HasFrame() && window_pos->flags & SWP_FRAMECHANGED &&
- ui::win::IsAeroGlassEnabled() &&
- (window_ex_style() & WS_EX_COMPOSITED) == 0) {
- MARGINS m = {10, 10, 10, 10};
- DwmExtendFrameIntoClientArea(hwnd(), &m);
- }
+ if (window_pos->flags & SWP_FRAMECHANGED)
+ SetDwmFrameExtension(DwmFrameState::ON);
if (window_pos->flags & SWP_SHOWWINDOW) {
delegate_->HandleVisibilityChanged(true);
if (direct_manipulation_helper_)
direct_manipulation_helper_->Activate(hwnd());
+ SetDwmFrameExtension(DwmFrameState::ON);
} else if (window_pos->flags & SWP_HIDEWINDOW) {
delegate_->HandleVisibilityChanged(false);
if (direct_manipulation_helper_)
« no previous file with comments | « ui/views/win/hwnd_message_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698