diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-19 14:58:40 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-19 14:58:40 +0000 |
commit | dc3785502ba13caa8680579d948f476cbb991f3a (patch) | |
tree | 8291afa474499aab4550fa54686f0baca420db69 /chrome/browser/dock_info.cc | |
parent | 159f77627c71bc666863cde38a358281d8b5fe0d (diff) | |
download | chromium_src-dc3785502ba13caa8680579d948f476cbb991f3a.zip chromium_src-dc3785502ba13caa8680579d948f476cbb991f3a.tar.gz chromium_src-dc3785502ba13caa8680579d948f476cbb991f3a.tar.bz2 |
Changes docking behavior to not offer a maximize drop target if there
is a maxmized tabbed browser on the monitor already. I don't feel this
is the right long term behavior, but until we figure that out I'm
going with this.
BUG=4878
TEST=maximize a tabbed browser, drag a tab out of the tabbed browser
toward the top of the screen and make sure you aren't offered a
dock target. Now restore the tabbed browser, drag a tab toward the
top of the screen and make sure you are offered a maximized drop
target.
Review URL: http://codereview.chromium.org/14858
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7301 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dock_info.cc')
-rw-r--r-- | chrome/browser/dock_info.cc | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/chrome/browser/dock_info.cc b/chrome/browser/dock_info.cc index 74a631a..f21ec73 100644 --- a/chrome/browser/dock_info.cc +++ b/chrome/browser/dock_info.cc @@ -6,6 +6,9 @@ #include "base/basictypes.h" #include "base/logging.h" +#include "chrome/browser/browser.h" +#include "chrome/browser/browser_list.h" +#include "chrome/browser/browser_window.h" #include "chrome/browser/views/frame/browser_view.h" namespace { @@ -84,6 +87,25 @@ bool IsCloseToMonitorPoint(const gfx::Point& screen_loc, return *in_enable_area || (max_delta_y < kMaximizeHotSpotDeltaY); } +// Returns true if there is a maximized tabbed browser on the monitor +// |monitor|. +bool IsMaximizedTabbedBrowserOnMonitor(HMONITOR monitor) { + for (BrowserList::const_iterator i = BrowserList::begin(); + i != BrowserList::end(); ++i) { + Browser* browser = *i; + if (browser->type() == Browser::TYPE_NORMAL) { + HWND browser_hwnd = + reinterpret_cast<HWND>(browser->window()->GetNativeHandle()); + if (IsZoomed(browser_hwnd) && + MonitorFromWindow(browser_hwnd, MONITOR_DEFAULTTONEAREST) == + monitor) { + return true; + } + } + } + return false; +} + // BaseWindowFinder ----------------------------------------------------------- // Base class used to locate a window. This is intended to be used with the @@ -320,13 +342,13 @@ DockInfo DockInfo::GetDockInfoAtPoint(const gfx::Point& screen_point, int mid_y = (m_bounds.top + m_bounds.bottom) / 2; bool result = - info.CheckMonitorPoint(screen_point, mid_x, m_bounds.top, + info.CheckMonitorPoint(monitor, screen_point, mid_x, m_bounds.top, DockInfo::MAXIMIZE) || - info.CheckMonitorPoint(screen_point, mid_x, m_bounds.bottom, + info.CheckMonitorPoint(monitor, screen_point, mid_x, m_bounds.bottom, DockInfo::BOTTOM_HALF) || - info.CheckMonitorPoint(screen_point, m_bounds.left, mid_y, + info.CheckMonitorPoint(monitor, screen_point, m_bounds.left, mid_y, DockInfo::LEFT_HALF) || - info.CheckMonitorPoint(screen_point, m_bounds.right, mid_y, + info.CheckMonitorPoint(monitor, screen_point, m_bounds.right, mid_y, DockInfo::RIGHT_HALF); return info; @@ -468,11 +490,14 @@ void DockInfo::AdjustOtherWindowBounds() const { SWP_NOACTIVATE | SWP_NOOWNERZORDER); } -bool DockInfo::CheckMonitorPoint(const gfx::Point& screen_loc, +bool DockInfo::CheckMonitorPoint(HMONITOR monitor, + const gfx::Point& screen_loc, int x, int y, Type type) { - if (IsCloseToMonitorPoint(screen_loc, x, y, type, &in_enable_area_)) { + if (IsCloseToMonitorPoint(screen_loc, x, y, type, &in_enable_area_) && + (type != MAXIMIZE || + !IsMaximizedTabbedBrowserOnMonitor(monitor))) { hot_spot_.SetPoint(x, y); type_ = type; return true; |