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/cocoa/bridged_native_widget.mm

Issue 2312133002: MacViews: Fix flashing of opaque non-modal windows on display. (Closed)
Patch Set: Created 4 years, 3 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/cocoa/bridged_native_widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/cocoa/bridged_native_widget.mm
diff --git a/ui/views/cocoa/bridged_native_widget.mm b/ui/views/cocoa/bridged_native_widget.mm
index 16bf01b7b0360f689e97a2e853376936661a08c3..d4e0125716d49df204a2ff73a0446574c4832144 100644
--- a/ui/views/cocoa/bridged_native_widget.mm
+++ b/ui/views/cocoa/bridged_native_widget.mm
@@ -571,6 +571,19 @@ NSComparisonResult SubviewSorter(NSViewComparatorValue lhs,
return;
}
+ // Non-modal windows are not animated. Hence opaque non-modal windows can
+ // appear with a "flash" if they are made visible before the frame from the
+ // compositor arrives. To get around this, set the alpha value of the window
+ // to 0, till we receive the correct frame from the compositor. Also, ignore
+ // mouse clicks till then.
+ // TODO(karandeepb): Investigate whether similar technique is needed for other
+ // dialog types.
+ if ([window_ isOpaque] && !native_widget_mac_->GetWidget()->IsModal()) {
+ initial_visibility_suppressed_ = true;
+ [window_ setAlphaValue:0.0];
+ [window_ setIgnoresMouseEvents:YES];
+ }
+
if (new_state == SHOW_AND_ACTIVATE_WINDOW) {
[window_ makeKeyAndOrderFront:nil];
[NSApp activateIgnoringOtherApps:YES];
@@ -1100,6 +1113,12 @@ NSComparisonResult SubviewSorter(NSViewComparatorValue lhs,
if (!compositor_widget_->HasFrameOfSize(GetClientAreaSize()))
return;
+ if (initial_visibility_suppressed_) {
+ initial_visibility_suppressed_ = false;
+ [window_ setAlphaValue:1.0];
+ [window_ setIgnoresMouseEvents:NO];
+ }
+
if (invalidate_shadow_on_frame_swap_) {
invalidate_shadow_on_frame_swap_ = false;
[window_ invalidateShadow];
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698