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

Unified Diff: chrome/browser/dock_info.cc

Issue 21476: Changes tab dragging code to continue iterating through windows if... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dock_info.cc
===================================================================
--- chrome/browser/dock_info.cc (revision 9878)
+++ chrome/browser/dock_info.cc (working copy)
@@ -159,14 +159,30 @@
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 @@
: 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 @@
// in ShouldStopIterating if target_ is passed in.
bool is_top_most_;
+ ScopedHRGN tmp_region_;
+
DISALLOW_COPY_AND_ASSIGN(TopMostFinder);
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698