diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-19 20:24:25 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-19 20:24:25 +0000 |
commit | 55050e7cdd1f725e3e50a75c31f1204dc8f4cd37 (patch) | |
tree | 29cd789fa0d3d4b897ac713159883468eae658be /views | |
parent | f4ca6ede54f63288a6aba8a40a609194d692dda0 (diff) | |
download | chromium_src-55050e7cdd1f725e3e50a75c31f1204dc8f4cd37.zip chromium_src-55050e7cdd1f725e3e50a75c31f1204dc8f4cd37.tar.gz chromium_src-55050e7cdd1f725e3e50a75c31f1204dc8f4cd37.tar.bz2 |
Fix Chrome overlapping an autohide taskbar in certain cases. Original patch by Satish Sampath (see http://codereview.chromium.org/1566054 ), r=me.
BUG=28042
TEST=Set taskbar to autohide and open a maximized Chrome window. Toggle visibility of the Chrome window using the appropriate taskbar button, make sure that the taskbar stays up on screen after many attempts and never hides.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44941 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/window/window_win.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/views/window/window_win.cc b/views/window/window_win.cc index d357768..554a9c7 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -761,6 +761,23 @@ LRESULT WindowWin::OnNCCalcSize(BOOL mode, LPARAM l_param) { // disappear. HMONITOR monitor = MonitorFromWindow(GetNativeView(), MONITOR_DEFAULTTONULL); + if (!monitor) { + // We might end up here if the window was previously minimized and the + // user clicks on the taskbar button to restore it in the previously + // maximized position. In that case WM_NCCALCSIZE is sent before the + // window coordinates are restored to their previous values, so our + // (left,top) would probably be (-32000,-32000) like all minimized + // windows. So the above MonitorFromWindow call fails, but if we check + // the window rect given with WM_NCCALCSIZE (which is our previous + // restored window position) we will get the correct monitor handle. + monitor = MonitorFromRect(client_rect, MONITOR_DEFAULTTONULL); + if (!monitor) { + // This is probably an extreme case that we won't hit, but if we don't + // intersect any monitor, let us not adjust the client rect since our + // window will not be visible anyway. + return 0; + } + } if (win_util::EdgeHasTopmostAutoHideTaskbar(ABE_LEFT, monitor)) client_rect->left += win_util::kAutoHideTaskbarThicknessPx; if (win_util::EdgeHasTopmostAutoHideTaskbar(ABE_TOP, monitor)) { |