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

Side by Side Diff: ui/views/cocoa/bridged_native_widget.mm

Issue 2343433005: MacViews: Modify condition for setting window alpha to 0 on initial 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ui/views/cocoa/bridged_native_widget.h" 5 #import "ui/views/cocoa/bridged_native_widget.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 return; 571 return;
572 } 572 }
573 573
574 // Non-modal windows are not animated. Hence opaque non-modal windows can 574 // Non-modal windows are not animated. Hence opaque non-modal windows can
575 // appear with a "flash" if they are made visible before the frame from the 575 // appear with a "flash" if they are made visible before the frame from the
576 // compositor arrives. To get around this, set the alpha value of the window 576 // compositor arrives. To get around this, set the alpha value of the window
577 // to 0, till we receive the correct frame from the compositor. Also, ignore 577 // to 0, till we receive the correct frame from the compositor. Also, ignore
578 // mouse clicks till then. 578 // mouse clicks till then.
579 // TODO(karandeepb): Investigate whether similar technique is needed for other 579 // TODO(karandeepb): Investigate whether similar technique is needed for other
580 // dialog types. 580 // dialog types.
581 if ([window_ isOpaque] && !native_widget_mac_->GetWidget()->IsModal()) { 581 if (layer() && [window_ isOpaque] &&
tapted 2016/09/19 07:35:34 This reminds me a bit of https://codereview.chromi
karandeepb 2016/09/20 08:04:51 NativeWidgetAura initializes the layer before show
582 !native_widget_mac_->GetWidget()->IsModal()) {
582 initial_visibility_suppressed_ = true; 583 initial_visibility_suppressed_ = true;
583 [window_ setAlphaValue:0.0]; 584 [window_ setAlphaValue:0.0];
584 [window_ setIgnoresMouseEvents:YES]; 585 [window_ setIgnoresMouseEvents:YES];
585 } 586 }
586 587
587 if (new_state == SHOW_AND_ACTIVATE_WINDOW) { 588 if (new_state == SHOW_AND_ACTIVATE_WINDOW) {
588 [window_ makeKeyAndOrderFront:nil]; 589 [window_ makeKeyAndOrderFront:nil];
589 [NSApp activateIgnoringOtherApps:YES]; 590 [NSApp activateIgnoringOtherApps:YES];
590 } else { 591 } else {
591 // ui::SHOW_STATE_INACTIVE is typically used to avoid stealing focus from a 592 // ui::SHOW_STATE_INACTIVE is typically used to avoid stealing focus from a
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 [bridged_view_ setMouseDownCanMoveWindow:draggable]; 1385 [bridged_view_ setMouseDownCanMoveWindow:draggable];
1385 // AppKit will not update its cache of mouseDownCanMoveWindow unless something 1386 // AppKit will not update its cache of mouseDownCanMoveWindow unless something
1386 // changes. Previously we tried adding an NSView and removing it, but for some 1387 // changes. Previously we tried adding an NSView and removing it, but for some
1387 // reason it required reposting the mouse-down event, and didn't always work. 1388 // reason it required reposting the mouse-down event, and didn't always work.
1388 // Calling the below seems to be an effective solution. 1389 // Calling the below seems to be an effective solution.
1389 [window_ setMovableByWindowBackground:NO]; 1390 [window_ setMovableByWindowBackground:NO];
1390 [window_ setMovableByWindowBackground:YES]; 1391 [window_ setMovableByWindowBackground:YES];
1391 } 1392 }
1392 1393
1393 } // namespace views 1394 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698