OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" | 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" |
6 | 6 |
7 #include "third_party/skia/include/core/SkPath.h" | 7 #include "third_party/skia/include/core/SkPath.h" |
8 #include "third_party/skia/include/core/SkRegion.h" | 8 #include "third_party/skia/include/core/SkRegion.h" |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
689 } | 689 } |
690 | 690 |
691 bool DesktopWindowTreeHostWin::ShouldHandleSystemCommands() const { | 691 bool DesktopWindowTreeHostWin::ShouldHandleSystemCommands() const { |
692 return GetWidget()->widget_delegate()->ShouldHandleSystemCommands(); | 692 return GetWidget()->widget_delegate()->ShouldHandleSystemCommands(); |
693 } | 693 } |
694 | 694 |
695 void DesktopWindowTreeHostWin::HandleAppDeactivated() { | 695 void DesktopWindowTreeHostWin::HandleAppDeactivated() { |
696 native_widget_delegate_->EnableInactiveRendering(); | 696 native_widget_delegate_->EnableInactiveRendering(); |
697 } | 697 } |
698 | 698 |
699 void DesktopWindowTreeHostWin::HandleActivationChanged(bool active) { | 699 void DesktopWindowTreeHostWin::HandleActivationChanged( |
700 bool active, | |
701 HWND window_gaining_or_losing_activation) { | |
700 // This can be invoked from HWNDMessageHandler::Init(), at which point we're | 702 // This can be invoked from HWNDMessageHandler::Init(), at which point we're |
701 // not in a good state and need to ignore it. | 703 // not in a good state and need to ignore it. |
702 // TODO(beng): Do we need this still now the host owns the dispatcher? | 704 // TODO(beng): Do we need this still now the host owns the dispatcher? |
703 if (!dispatcher()) | 705 if (!dispatcher()) |
704 return; | 706 return; |
705 | 707 |
706 if (active) | 708 if (active) |
707 OnHostActivated(); | 709 OnHostActivated(); |
708 desktop_native_widget_aura_->HandleActivationChanged(active); | 710 desktop_native_widget_aura_->HandleActivationChanged(active); |
711 | |
712 if (!::IsWindow(window_gaining_or_losing_activation)) | |
713 window_gaining_or_losing_activation = ::GetForegroundWindow(); | |
714 | |
715 // If the window losing activation is a fullscreen window and it is on the | |
sky
2016/02/19 19:14:49
Update your comment as you no longer look at monit
ananta
2016/02/19 20:07:21
Done.
| |
716 // same monitor as the window being activated, then we reduce the size of the | |
717 // window by 1px (Not fullscreen). This is to work around an apparent bug | |
718 // in the Windows taskbar where in it tracks fullscreen state on a per | |
719 // thread basis. This causes it not be a topmost window when any window on a | |
720 // thread which has a fullscreen window is active. Thus affecting the way | |
721 // these windows interact with the taskbar, i.e by obscuring it, causing | |
722 // autohide to not work correctly, etc. | |
sky
2016/02/19 19:14:48
Your comment here is still a bit vague. What we're
ananta
2016/02/19 20:07:21
Done.
| |
723 if (!active) { | |
724 if (IsFullscreen() && ::IsWindow(window_gaining_or_losing_activation)) { | |
725 // Reduce the bounds of the window by 1px to ensure that Windows does | |
726 // not treat this like a fullscreen window. | |
727 MONITORINFO monitor_info = {sizeof(monitor_info)}; | |
728 GetMonitorInfo(MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTOPRIMARY), | |
729 &monitor_info); | |
730 gfx::Rect shrunk_rect(monitor_info.rcMonitor); | |
731 shrunk_rect.set_height(shrunk_rect.height() - 1); | |
732 // The message handler needs to allow this bounds change to occur. | |
733 message_handler_->set_background_fullscreen_hack(true); | |
734 SetBounds(shrunk_rect); | |
735 } | |
736 } else if (message_handler_->background_fullscreen_hack()) { | |
737 // Restore the bounds of the window to fullscreen. | |
738 DCHECK(IsFullscreen()); | |
739 message_handler_->set_background_fullscreen_hack(false); | |
740 MONITORINFO monitor_info = {sizeof(monitor_info)}; | |
741 GetMonitorInfo(MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTOPRIMARY), | |
742 &monitor_info); | |
743 SetBounds(gfx::Rect(monitor_info.rcMonitor)); | |
744 } | |
709 } | 745 } |
710 | 746 |
711 bool DesktopWindowTreeHostWin::HandleAppCommand(short command) { | 747 bool DesktopWindowTreeHostWin::HandleAppCommand(short command) { |
712 // We treat APPCOMMAND ids as an extension of our command namespace, and just | 748 // We treat APPCOMMAND ids as an extension of our command namespace, and just |
713 // let the delegate figure out what to do... | 749 // let the delegate figure out what to do... |
714 return GetWidget()->widget_delegate() && | 750 return GetWidget()->widget_delegate() && |
715 GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); | 751 GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); |
716 } | 752 } |
717 | 753 |
718 void DesktopWindowTreeHostWin::HandleCancelMode() { | 754 void DesktopWindowTreeHostWin::HandleCancelMode() { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
782 void DesktopWindowTreeHostWin::HandleVisibilityChanging(bool visible) { | 818 void DesktopWindowTreeHostWin::HandleVisibilityChanging(bool visible) { |
783 native_widget_delegate_->OnNativeWidgetVisibilityChanging(visible); | 819 native_widget_delegate_->OnNativeWidgetVisibilityChanging(visible); |
784 } | 820 } |
785 | 821 |
786 void DesktopWindowTreeHostWin::HandleVisibilityChanged(bool visible) { | 822 void DesktopWindowTreeHostWin::HandleVisibilityChanged(bool visible) { |
787 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible); | 823 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible); |
788 } | 824 } |
789 | 825 |
790 void DesktopWindowTreeHostWin::HandleClientSizeChanged( | 826 void DesktopWindowTreeHostWin::HandleClientSizeChanged( |
791 const gfx::Size& new_size) { | 827 const gfx::Size& new_size) { |
792 if (dispatcher()) | 828 if (dispatcher() && !message_handler_->background_fullscreen_hack()) |
793 OnHostResized(new_size); | 829 OnHostResized(new_size); |
794 } | 830 } |
795 | 831 |
796 void DesktopWindowTreeHostWin::HandleFrameChanged() { | 832 void DesktopWindowTreeHostWin::HandleFrameChanged() { |
797 SetWindowTransparency(); | 833 SetWindowTransparency(); |
798 // Replace the frame and layout the contents. | 834 // Replace the frame and layout the contents. |
799 GetWidget()->non_client_view()->UpdateFrame(); | 835 GetWidget()->non_client_view()->UpdateFrame(); |
800 } | 836 } |
801 | 837 |
802 void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) { | 838 void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) { |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
961 | 997 |
962 // static | 998 // static |
963 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 999 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
964 internal::NativeWidgetDelegate* native_widget_delegate, | 1000 internal::NativeWidgetDelegate* native_widget_delegate, |
965 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 1001 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
966 return new DesktopWindowTreeHostWin(native_widget_delegate, | 1002 return new DesktopWindowTreeHostWin(native_widget_delegate, |
967 desktop_native_widget_aura); | 1003 desktop_native_widget_aura); |
968 } | 1004 } |
969 | 1005 |
970 } // namespace views | 1006 } // namespace views |
OLD | NEW |