| 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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 // 10.9 is unable to generate a window shadow from the composited CALayer, so | 731 // 10.9 is unable to generate a window shadow from the composited CALayer, so |
| 732 // use Quartz. | 732 // use Quartz. |
| 733 // We don't update the window mask during a live resize, instead it is done | 733 // We don't update the window mask during a live resize, instead it is done |
| 734 // after the resize is completed in viewDidEndLiveResize: in | 734 // after the resize is completed in viewDidEndLiveResize: in |
| 735 // BridgedContentView. | 735 // BridgedContentView. |
| 736 if (base::mac::IsOSMavericks() && ![window_ inLiveResize]) | 736 if (base::mac::IsOSMavericks() && ![window_ inLiveResize]) |
| 737 [bridged_view_ updateWindowMask]; | 737 [bridged_view_ updateWindowMask]; |
| 738 } | 738 } |
| 739 | 739 |
| 740 void BridgedNativeWidget::OnVisibilityChanged() { | 740 void BridgedNativeWidget::OnVisibilityChanged() { |
| 741 OnVisibilityChangedTo([window_ isVisible]); | 741 const bool window_visible = [window_ isVisible]; |
| 742 } | 742 if (window_visible_ == window_visible) |
| 743 | |
| 744 void BridgedNativeWidget::OnVisibilityChangedTo(bool new_visibility) { | |
| 745 if (window_visible_ == new_visibility) | |
| 746 return; | 743 return; |
| 747 | 744 |
| 748 window_visible_ = new_visibility; | 745 window_visible_ = window_visible; |
| 749 | 746 |
| 750 // If arriving via SetVisible(), |wants_to_be_visible_| should already be set. | 747 // If arriving via SetVisible(), |wants_to_be_visible_| should already be set. |
| 751 // If made visible externally (e.g. Cmd+H), just roll with it. Don't try (yet) | 748 // If made visible externally (e.g. Cmd+H), just roll with it. Don't try (yet) |
| 752 // to distinguish being *hidden* externally from being hidden by a parent | 749 // to distinguish being *hidden* externally from being hidden by a parent |
| 753 // window - we might not need that. | 750 // window - we might not need that. |
| 754 if (window_visible_) { | 751 if (window_visible_) { |
| 755 wants_to_be_visible_ = true; | 752 wants_to_be_visible_ = true; |
| 756 | 753 |
| 757 if (parent_) | 754 if (parent_) |
| 758 [parent_->GetNSWindow() addChildWindow:window_ ordered:NSWindowAbove]; | 755 [parent_->GetNSWindow() addChildWindow:window_ ordered:NSWindowAbove]; |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 1304 [bridged_view_ setMouseDownCanMoveWindow:draggable]; |
| 1308 // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 1305 // AppKit will not update its cache of mouseDownCanMoveWindow unless something |
| 1309 // changes. Previously we tried adding an NSView and removing it, but for some | 1306 // changes. Previously we tried adding an NSView and removing it, but for some |
| 1310 // reason it required reposting the mouse-down event, and didn't always work. | 1307 // reason it required reposting the mouse-down event, and didn't always work. |
| 1311 // Calling the below seems to be an effective solution. | 1308 // Calling the below seems to be an effective solution. |
| 1312 [window_ setMovableByWindowBackground:NO]; | 1309 [window_ setMovableByWindowBackground:NO]; |
| 1313 [window_ setMovableByWindowBackground:YES]; | 1310 [window_ setMovableByWindowBackground:YES]; |
| 1314 } | 1311 } |
| 1315 | 1312 |
| 1316 } // namespace views | 1313 } // namespace views |
| OLD | NEW |