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

Unified 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: Update comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_win.h ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f7b588133a5fe61ddfbaee9938ba9e6279ee3ae6 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,43 @@ void DesktopWindowTreeHostWin::HandleActivationChanged(bool active) {
if (active)
OnHostActivated();
desktop_native_widget_aura_->HandleActivationChanged(active);
+
+ if (!::IsWindow(window_gaining_or_losing_activation))
sky 2016/02/19 21:17:00 Is there a reason not to put all this logic in HWN
ananta 2016/02/19 21:24:18 I did not want to add state to HWNDMessageHandler.
+ window_gaining_or_losing_activation = ::GetForegroundWindow();
+
+ // If the window losing activation is a fullscreen window, we reduce the size
+ // of the window by 1px. i.e. 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
+ // maximized window on a thread which has a fullscreen window is active. This
+ // affects the way these windows interact with the taskbar, they obscure it
+ // when maximized, autohide does not work correctly, etc.
+ // By reducing the size of the fullscreen window by 1px, we ensure that the
+ // taskbar no longer treats the window and in turn the thread as a fullscreen
+ // thread. This in turn ensures that maximized windows on the same thread
+ /// don't obscure the taskbar, etc.
+ 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 +828,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);
}
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_win.h ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698