summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-26 19:13:30 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-26 19:13:30 +0000
commit3be5b20f163002c3a2ca15ca298f392be026a22e (patch)
tree8611f0cd513115e38dcbdb1c0afc8e2f0963b676
parentd27ab3ee72bb5dc3c39f385dec7724c769562a0d (diff)
downloadchromium_src-3be5b20f163002c3a2ca15ca298f392be026a22e.zip
chromium_src-3be5b20f163002c3a2ca15ca298f392be026a22e.tar.gz
chromium_src-3be5b20f163002c3a2ca15ca298f392be026a22e.tar.bz2
Tab strip should not resize on close (Vista).
When you close a tab using the mouse, we synthesize a fake WM_MOUSEMOVE message so that the close button that slides under the mouse will highlight. We now use GetMessagePos to read the position of the cursor and SendMessage to dispatch it, otherwise the receiving GetMessagePos call will not calculate the coordinates correctly (coordinates will be relative to the Chrome main window top left point, not the monitor's top left point, causing the tabstrip to resize). BUG=18832 TEST=On Vista, open a bunch of tabs, then start closing the tab in the middle using the mouse. Don't move the mouse at all while doing this and observe that the tab strip doesn't resize. Also, the close button on the tab that slides under the mouse should be highlighted. Review URL: http://codereview.chromium.org/173433 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24493 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/views/tabs/tab_strip.cc30
1 files changed, 13 insertions, 17 deletions
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index 89097e3..9bfb84b 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/views/tabs/tab_strip.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -227,7 +227,7 @@ class TabStrip::TabAnimation : public AnimationDelegate {
const Type type_;
- DISALLOW_EVIL_CONSTRUCTORS(TabAnimation);
+ DISALLOW_COPY_AND_ASSIGN(TabAnimation);
};
///////////////////////////////////////////////////////////////////////////////
@@ -268,7 +268,7 @@ class TabStrip::InsertTabAnimation : public TabStrip::TabAnimation {
private:
int index_;
- DISALLOW_EVIL_CONSTRUCTORS(InsertTabAnimation);
+ DISALLOW_COPY_AND_ASSIGN(InsertTabAnimation);
};
///////////////////////////////////////////////////////////////////////////////
@@ -339,22 +339,18 @@ 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);
+ // Force the close button (that slides under the mouse) to highlight by
+ // saying the mouse just moved, but sending the same coordinates.
+ DWORD pos = GetMessagePos();
+ POINT cursor_point = {GET_X_LPARAM(pos), GET_Y_LPARAM(pos)};
views::Widget* widget = tabstrip_->GetWidget();
- RECT wr;
- GetWindowRect(widget->GetNativeView(), &wr);
- pt.x -= wr.left;
- pt.y -= wr.top;
+ MapWindowPoints(NULL, widget->GetNativeView(), &cursor_point, 1);
static_cast<views::WidgetWin*>(widget)->ResetLastMouseMoveFlag();
// Return to message loop - otherwise we may disrupt some operation that's
// in progress.
- PostMessage(widget->GetNativeView(), WM_MOUSEMOVE, 0,
- MAKELPARAM(pt.x, pt.y));
+ SendMessage(widget->GetNativeView(), WM_MOUSEMOVE, 0,
+ MAKELPARAM(cursor_point.x, cursor_point.y));
#else
NOTIMPLEMENTED();
#endif
@@ -362,7 +358,7 @@ class TabStrip::RemoveTabAnimation : public TabStrip::TabAnimation {
int index_;
- DISALLOW_EVIL_CONSTRUCTORS(RemoveTabAnimation);
+ DISALLOW_COPY_AND_ASSIGN(RemoveTabAnimation);
};
///////////////////////////////////////////////////////////////////////////////
@@ -416,7 +412,7 @@ class TabStrip::MoveTabAnimation : public TabStrip::TabAnimation {
gfx::Rect start_tab_a_bounds_;
gfx::Rect start_tab_b_bounds_;
- DISALLOW_EVIL_CONSTRUCTORS(MoveTabAnimation);
+ DISALLOW_COPY_AND_ASSIGN(MoveTabAnimation);
};
///////////////////////////////////////////////////////////////////////////////
@@ -471,7 +467,7 @@ class TabStrip::ResizeLayoutAnimation : public TabStrip::TabAnimation {
}
}
- DISALLOW_EVIL_CONSTRUCTORS(ResizeLayoutAnimation);
+ DISALLOW_COPY_AND_ASSIGN(ResizeLayoutAnimation);
};
///////////////////////////////////////////////////////////////////////////////