Chromium Code Reviews| 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..8fb9819f219fa7980136985d97712cdab80c839e 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,26 @@ 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/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
|
| + // same monitor as the window being activated, then we switch away from full |
| + // screen mode. 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. |
| + // This works correctly across monitors. |
| + if (!active && IsFullscreen() && |
| + ::IsWindow(window_gaining_or_losing_activation)) { |
| + if (MonitorFromWindow(window_gaining_or_losing_activation, |
| + MONITOR_DEFAULTTONEAREST) == |
| + MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTONEAREST)) { |
| + SetFullscreen(false); |
| + } |
| + } |
| } |
| bool DesktopWindowTreeHostWin::HandleAppCommand(short command) { |