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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc

Issue 1707233002: Reduce the fullscreen window height by 1px on activation loss. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
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
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/18 17:18:47 Is there a reason not to do this any time the acti
ananta 2016/02/18 20:29:28 We only want to do this if we are losing activatio
sky 2016/02/18 22:12:40 I'm asking why not do this: if (!active && IsFull
716 // same monitor as the window being activated, then we switch away from full
717 // screen mode. This is to work around an apparent bug in the Windows taskbar
718 // where in it tracks fullscreen state on a per thread basis. This causes it
719 // not be a topmost window when any window on a thread which has a fullscreen
720 // window is active. Thus affecting the way these windows interact with the
721 // taskbar, i.e by obscuring it, causing autohide to not work correctly, etc.
722 // This works correctly across monitors.
723 if (!active && IsFullscreen() &&
724 ::IsWindow(window_gaining_or_losing_activation)) {
725 if (MonitorFromWindow(window_gaining_or_losing_activation,
726 MONITOR_DEFAULTTONEAREST) ==
727 MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTONEAREST)) {
728 SetFullscreen(false);
729 }
730 }
709 } 731 }
710 732
711 bool DesktopWindowTreeHostWin::HandleAppCommand(short command) { 733 bool DesktopWindowTreeHostWin::HandleAppCommand(short command) {
712 // We treat APPCOMMAND ids as an extension of our command namespace, and just 734 // We treat APPCOMMAND ids as an extension of our command namespace, and just
713 // let the delegate figure out what to do... 735 // let the delegate figure out what to do...
714 return GetWidget()->widget_delegate() && 736 return GetWidget()->widget_delegate() &&
715 GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); 737 GetWidget()->widget_delegate()->ExecuteWindowsCommand(command);
716 } 738 }
717 739
718 void DesktopWindowTreeHostWin::HandleCancelMode() { 740 void DesktopWindowTreeHostWin::HandleCancelMode() {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 983
962 // static 984 // static
963 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( 985 DesktopWindowTreeHost* DesktopWindowTreeHost::Create(
964 internal::NativeWidgetDelegate* native_widget_delegate, 986 internal::NativeWidgetDelegate* native_widget_delegate,
965 DesktopNativeWidgetAura* desktop_native_widget_aura) { 987 DesktopNativeWidgetAura* desktop_native_widget_aura) {
966 return new DesktopWindowTreeHostWin(native_widget_delegate, 988 return new DesktopWindowTreeHostWin(native_widget_delegate,
967 desktop_native_widget_aura); 989 desktop_native_widget_aura);
968 } 990 }
969 991
970 } // namespace views 992 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698