summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-18 21:56:32 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-18 21:56:32 +0000
commit9c3bc43e11903390e309060690440b605cd5b687 (patch)
tree32565bc2c08b9ab36257a37a7a86afd58763f8c1
parent41741a96ce6b7b3cfca3d59ef3bb59064dc939e0 (diff)
downloadchromium_src-9c3bc43e11903390e309060690440b605cd5b687.zip
chromium_src-9c3bc43e11903390e309060690440b605cd5b687.tar.gz
chromium_src-9c3bc43e11903390e309060690440b605cd5b687.tar.bz2
Changes tab dragging code to continue iterating through windows if
window's rect contains the point but the window region doesn't. This is necessary as some apps create a window the size of the desktop and set a window region on it. Without this check we don't allow docking when these apps are running. BUG=6149 TEST=see bug Review URL: http://codereview.chromium.org/21476 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9974 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/dock_info.cc35
1 files changed, 27 insertions, 8 deletions
diff --git a/chrome/browser/dock_info.cc b/chrome/browser/dock_info.cc
index 79a4197..e1c394c 100644
--- a/chrome/browser/dock_info.cc
+++ b/chrome/browser/dock_info.cc
@@ -159,14 +159,30 @@ class TopMostFinder : public BaseWindowFinder {
return true;
}
- if (::IsWindowVisible(hwnd)) {
- CRect r;
- if (::GetWindowRect(hwnd, &r) && r.PtInRect(screen_loc_.ToPOINT())) {
- // Not the topmost, stop iterating.
- return true;
- }
+ if (!::IsWindowVisible(hwnd)) {
+ // The window isn't visible, keep iterating.
+ return false;
}
- return false;
+
+ CRect r;
+ if (!::GetWindowRect(hwnd, &r) || !r.PtInRect(screen_loc_.ToPOINT())) {
+ // The window doesn't contain the point, keep iterating.
+ return false;
+ }
+
+ // hwnd is at the point. Make sure the point is within the windows region.
+ if (GetWindowRgn(hwnd, tmp_region_.Get()) == ERROR) {
+ // There's no region on the window and the window contains the point. Stop
+ // iterating.
+ return true;
+ }
+
+ // The region is relative to the window's rect.
+ BOOL is_point_in_region = PtInRegion(tmp_region_.Get(),
+ screen_loc_.x() - r.left, screen_loc_.y() - r.top);
+ tmp_region_ = CreateRectRgn(0, 0, 0, 0);
+ // Stop iterating if the region contains the point.
+ return !!is_point_in_region;
}
private:
@@ -176,7 +192,8 @@ class TopMostFinder : public BaseWindowFinder {
: BaseWindowFinder(ignore),
target_(window),
screen_loc_(screen_loc),
- is_top_most_(false) {
+ is_top_most_(false),
+ tmp_region_(CreateRectRgn(0, 0, 0, 0)) {
EnumWindows(WindowCallbackProc, reinterpret_cast<LPARAM>(this));
}
@@ -190,6 +207,8 @@ class TopMostFinder : public BaseWindowFinder {
// in ShouldStopIterating if target_ is passed in.
bool is_top_most_;
+ ScopedHRGN tmp_region_;
+
DISALLOW_COPY_AND_ASSIGN(TopMostFinder);
};