diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-29 23:55:47 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-29 23:55:47 +0000 |
commit | 5cba04324b2f0f724b51a56bec561eaff7791858 (patch) | |
tree | df86cb76c7703b893e2353ca77dfea8dc7f39ea7 /chrome/browser/views/tabs | |
parent | 047f6227bb49d5e315c2da557255035eb22c846f (diff) | |
download | chromium_src-5cba04324b2f0f724b51a56bec561eaff7791858.zip chromium_src-5cba04324b2f0f724b51a56bec561eaff7791858.tar.gz chromium_src-5cba04324b2f0f724b51a56bec561eaff7791858.tar.bz2 |
Use GetMessagePos instead of GetCursorPos to avoid unwanted detached tabs.
The problem with GetCursorPos is that it queries the mouse position right now,
which means that the values may not be consistent with the values reported via
windows messages. GetMessagePos on the other hand returns the mouse position
as last reported via the message loop.
With this change, I'm unable to reproduce unwanted detached tabs even under
heavy system load.
R=ben
BUG=2993
TEST=While your system is heavily loaded, click on a tab, release the mouse
button and then move the mouse downward. Do this as quickly as you can, and
the tab should stay put.
Review URL: http://codereview.chromium.org/160364
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22024 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/tabs')
-rw-r--r-- | chrome/browser/views/tabs/dragged_tab_controller.cc | 5 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.cc | 8 |
2 files changed, 7 insertions, 6 deletions
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc index 9a55152..6213111 100644 --- a/chrome/browser/views/tabs/dragged_tab_controller.cc +++ b/chrome/browser/views/tabs/dragged_tab_controller.cc @@ -1110,9 +1110,8 @@ void DraggedTabController::EnsureDraggedView() { gfx::Point DraggedTabController::GetCursorScreenPoint() const { #if defined(OS_WIN) - POINT pt; - GetCursorPos(&pt); - return gfx::Point(pt); + DWORD pos = GetMessagePos(); + return gfx::Point(LOWORD(pos), HIWORD(pos)); #else gint x, y; gdk_display_get_pointer(gdk_display_get_default(), NULL, &x, &y, NULL); diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index 839f0b3..09025b5 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -339,6 +339,9 @@ class TabStrip::RemoveTabAnimation : public TabStrip::TabAnimation { } #if defined(OS_WIN) + // NOTE: It is important that this fake WM_MOUSEMOVE not move the mouse + // anywhere, so we need to know the current mouse position. Hence, we use + // GetCursorPos instead of GetMessagePos. POINT pt; GetCursorPos(&pt); views::Widget* widget = tabstrip_->GetWidget(); @@ -1277,9 +1280,8 @@ bool TabStrip::IsCursorInTabStripZone() { bounds.set_height(bounds.height() + kTabStripAnimationVSlop); #if defined(OS_WIN) - CPoint cursor_point_c; - GetCursorPos(&cursor_point_c); - gfx::Point cursor_point(cursor_point_c); + DWORD pos = GetMessagePos(); + gfx::Point cursor_point(LOWORD(pos), HIWORD(pos)); #elif defined(OS_LINUX) // TODO: make sure this is right with multiple monitors. GdkScreen* screen = gdk_screen_get_default(); |