Index: ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc |
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc |
index f79b3c42baf5477962e15f31e634c799c5c5eb2d..22a12b7595fe875801a57887c16b827c881cb406 100644 |
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc |
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc |
@@ -696,7 +696,9 @@ void DesktopWindowTreeHostWin::HandleAppDeactivated() { |
native_widget_delegate_->EnableInactiveRendering(); |
} |
-void DesktopWindowTreeHostWin::HandleActivationChanged(bool active) { |
+void DesktopWindowTreeHostWin::HandleActivationChanged( |
+ bool active, |
+ HWND window_gaining_or_losing_activation) { |
// This can be invoked from HWNDMessageHandler::Init(), at which point we're |
// not in a good state and need to ignore it. |
// TODO(beng): Do we need this still now the host owns the dispatcher? |
@@ -706,6 +708,40 @@ void DesktopWindowTreeHostWin::HandleActivationChanged(bool active) { |
if (active) |
OnHostActivated(); |
desktop_native_widget_aura_->HandleActivationChanged(active); |
+ |
+ if (!::IsWindow(window_gaining_or_losing_activation)) |
+ window_gaining_or_losing_activation = ::GetForegroundWindow(); |
+ |
+ // 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.
|
+ // same monitor as the window being activated, then we reduce the size of the |
+ // window by 1px (Not fullscreen). This is to work around an apparent bug |
+ // in the Windows taskbar where in it tracks fullscreen state on a per |
+ // thread basis. This causes it not be a topmost window when any window on a |
+ // thread which has a fullscreen window is active. Thus affecting the way |
+ // these windows interact with the taskbar, i.e by obscuring it, causing |
+ // 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.
|
+ if (!active) { |
+ if (IsFullscreen() && ::IsWindow(window_gaining_or_losing_activation)) { |
+ // Reduce the bounds of the window by 1px to ensure that Windows does |
+ // not treat this like a fullscreen window. |
+ MONITORINFO monitor_info = {sizeof(monitor_info)}; |
+ GetMonitorInfo(MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTOPRIMARY), |
+ &monitor_info); |
+ gfx::Rect shrunk_rect(monitor_info.rcMonitor); |
+ shrunk_rect.set_height(shrunk_rect.height() - 1); |
+ // The message handler needs to allow this bounds change to occur. |
+ message_handler_->set_background_fullscreen_hack(true); |
+ SetBounds(shrunk_rect); |
+ } |
+ } else if (message_handler_->background_fullscreen_hack()) { |
+ // Restore the bounds of the window to fullscreen. |
+ DCHECK(IsFullscreen()); |
+ message_handler_->set_background_fullscreen_hack(false); |
+ MONITORINFO monitor_info = {sizeof(monitor_info)}; |
+ GetMonitorInfo(MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTOPRIMARY), |
+ &monitor_info); |
+ SetBounds(gfx::Rect(monitor_info.rcMonitor)); |
+ } |
} |
bool DesktopWindowTreeHostWin::HandleAppCommand(short command) { |
@@ -789,7 +825,7 @@ void DesktopWindowTreeHostWin::HandleVisibilityChanged(bool visible) { |
void DesktopWindowTreeHostWin::HandleClientSizeChanged( |
const gfx::Size& new_size) { |
- if (dispatcher()) |
+ if (dispatcher() && !message_handler_->background_fullscreen_hack()) |
OnHostResized(new_size); |
} |