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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 // BridgedContentView. | 777 // BridgedContentView. |
778 if (base::mac::IsOSMavericks() && ![window_ inLiveResize]) | 778 if (base::mac::IsOSMavericks() && ![window_ inLiveResize]) |
779 [bridged_view_ updateWindowMask]; | 779 [bridged_view_ updateWindowMask]; |
780 } | 780 } |
781 | 781 |
782 void BridgedNativeWidget::OnPositionChanged() { | 782 void BridgedNativeWidget::OnPositionChanged() { |
783 native_widget_mac_->GetWidget()->OnNativeWidgetMove(); | 783 native_widget_mac_->GetWidget()->OnNativeWidgetMove(); |
784 } | 784 } |
785 | 785 |
786 void BridgedNativeWidget::OnVisibilityChanged() { | 786 void BridgedNativeWidget::OnVisibilityChanged() { |
787 OnVisibilityChangedTo([window_ isVisible]); | 787 const bool window_visible = [window_ isVisible]; |
788 } | 788 if (window_visible_ == window_visible) |
789 | |
790 void BridgedNativeWidget::OnVisibilityChangedTo(bool new_visibility) { | |
791 if (window_visible_ == new_visibility) | |
792 return; | 789 return; |
793 | 790 |
794 window_visible_ = new_visibility; | 791 window_visible_ = window_visible; |
795 | 792 |
796 // If arriving via SetVisible(), |wants_to_be_visible_| should already be set. | 793 // If arriving via SetVisible(), |wants_to_be_visible_| should already be set. |
797 // If made visible externally (e.g. Cmd+H), just roll with it. Don't try (yet) | 794 // If made visible externally (e.g. Cmd+H), just roll with it. Don't try (yet) |
798 // to distinguish being *hidden* externally from being hidden by a parent | 795 // to distinguish being *hidden* externally from being hidden by a parent |
799 // window - we might not need that. | 796 // window - we might not need that. |
800 if (window_visible_) { | 797 if (window_visible_) { |
801 wants_to_be_visible_ = true; | 798 wants_to_be_visible_ = true; |
802 | 799 |
803 if (parent_) | 800 if (parent_) |
804 [parent_->GetNSWindow() addChildWindow:window_ ordered:NSWindowAbove]; | 801 [parent_->GetNSWindow() addChildWindow:window_ ordered:NSWindowAbove]; |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 1354 [bridged_view_ setMouseDownCanMoveWindow:draggable]; |
1358 // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 1355 // AppKit will not update its cache of mouseDownCanMoveWindow unless something |
1359 // changes. Previously we tried adding an NSView and removing it, but for some | 1356 // changes. Previously we tried adding an NSView and removing it, but for some |
1360 // reason it required reposting the mouse-down event, and didn't always work. | 1357 // reason it required reposting the mouse-down event, and didn't always work. |
1361 // Calling the below seems to be an effective solution. | 1358 // Calling the below seems to be an effective solution. |
1362 [window_ setMovableByWindowBackground:NO]; | 1359 [window_ setMovableByWindowBackground:NO]; |
1363 [window_ setMovableByWindowBackground:YES]; | 1360 [window_ setMovableByWindowBackground:YES]; |
1364 } | 1361 } |
1365 | 1362 |
1366 } // namespace views | 1363 } // namespace views |
OLD | NEW |