| OLD | NEW |
| 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 Loading... |
| 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 (layer() && [window_ isOpaque] && | 581 if (layer() && [window_ isOpaque] && !window_visible_ && |
| 582 !native_widget_mac_->GetWidget()->IsModal()) { | 582 !native_widget_mac_->GetWidget()->IsModal()) { |
| 583 initial_visibility_suppressed_ = true; | 583 initial_visibility_suppressed_ = true; |
| 584 [window_ setAlphaValue:0.0]; | 584 [window_ setAlphaValue:0.0]; |
| 585 [window_ setIgnoresMouseEvents:YES]; | 585 [window_ setIgnoresMouseEvents:YES]; |
| 586 } | 586 } |
| 587 | 587 |
| 588 if (new_state == SHOW_AND_ACTIVATE_WINDOW) { | 588 if (new_state == SHOW_AND_ACTIVATE_WINDOW) { |
| 589 [window_ makeKeyAndOrderFront:nil]; | 589 [window_ makeKeyAndOrderFront:nil]; |
| 590 [NSApp activateIgnoringOtherApps:YES]; | 590 [NSApp activateIgnoringOtherApps:YES]; |
| 591 } else { | 591 } else { |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 1390 [bridged_view_ setMouseDownCanMoveWindow:draggable]; |
| 1391 // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 1391 // AppKit will not update its cache of mouseDownCanMoveWindow unless something |
| 1392 // changes. Previously we tried adding an NSView and removing it, but for some | 1392 // changes. Previously we tried adding an NSView and removing it, but for some |
| 1393 // reason it required reposting the mouse-down event, and didn't always work. | 1393 // reason it required reposting the mouse-down event, and didn't always work. |
| 1394 // Calling the below seems to be an effective solution. | 1394 // Calling the below seems to be an effective solution. |
| 1395 [window_ setMovableByWindowBackground:NO]; | 1395 [window_ setMovableByWindowBackground:NO]; |
| 1396 [window_ setMovableByWindowBackground:YES]; | 1396 [window_ setMovableByWindowBackground:YES]; |
| 1397 } | 1397 } |
| 1398 | 1398 |
| 1399 } // namespace views | 1399 } // namespace views |
| OLD | NEW |