summaryrefslogtreecommitdiffstats
path: root/chrome/views/custom_frame_window.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-17 23:58:44 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-17 23:58:44 +0000
commit7321e58f2c6c308e7ff117443acad9a73b5b7592 (patch)
tree3430879bd44d891d643f947e19a5983366b8b6ed /chrome/views/custom_frame_window.cc
parentf340e881d7059db7284d07ab4cd19d82739212c3 (diff)
downloadchromium_src-7321e58f2c6c308e7ff117443acad9a73b5b7592.zip
chromium_src-7321e58f2c6c308e7ff117443acad9a73b5b7592.tar.gz
chromium_src-7321e58f2c6c308e7ff117443acad9a73b5b7592.tar.bz2
Allow middle click on the only tab with one window open.
http://crbug.com/3466 Review URL: http://codereview.chromium.org/7506 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3580 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/custom_frame_window.cc')
-rw-r--r--chrome/views/custom_frame_window.cc37
1 files changed, 27 insertions, 10 deletions
diff --git a/chrome/views/custom_frame_window.cc b/chrome/views/custom_frame_window.cc
index 472a9bb..0febe17 100644
--- a/chrome/views/custom_frame_window.cc
+++ b/chrome/views/custom_frame_window.cc
@@ -1189,16 +1189,7 @@ void CustomFrameWindow::OnNCLButtonDown(UINT ht_component,
// view! Ick! By handling this message we prevent Windows from doing this
// undesirable thing, but that means we need to roll the sys-command
// handling ourselves.
- CPoint temp = point;
- MapWindowPoints(HWND_DESKTOP, GetHWND(), &temp, 1);
- UINT flags = 0;
- if ((GetKeyState(VK_CONTROL) & 0x80) == 0x80)
- flags |= MK_CONTROL;
- if ((GetKeyState(VK_SHIFT) & 0x80) == 0x80)
- flags |= MK_SHIFT;
- flags |= MK_LBUTTON;
- ProcessMousePressed(temp, flags, false);
- SetMsgHandled(TRUE);
+ ProcessNCMousePress(point, MK_LBUTTON);
return;
}
default:
@@ -1207,6 +1198,20 @@ void CustomFrameWindow::OnNCLButtonDown(UINT ht_component,
}
}
+void CustomFrameWindow::OnNCMButtonDown(UINT ht_component,
+ const CPoint& point) {
+ if (ht_component == HTCAPTION) {
+ // When there's only one window and only one tab, the tab area is reported
+ // to be part of the caption area of the window. However users should still
+ // be able to middle click that tab to close it so we need to make sure
+ // these messages reach the View system.
+ ProcessNCMousePress(point, MK_MBUTTON);
+ SetMsgHandled(FALSE);
+ return;
+ }
+ ContainerWin::OnNCMButtonDown(ht_component, point);
+}
+
LRESULT CustomFrameWindow::OnNCUAHDrawCaption(UINT msg, WPARAM w_param,
LPARAM l_param) {
// See comment in hwnd_view_container.h at the definition of
@@ -1318,5 +1323,17 @@ void CustomFrameWindow::ResetWindowRegion() {
DeleteObject(current_rgn);
}
+void CustomFrameWindow::ProcessNCMousePress(const CPoint& point, int flags) {
+ CPoint temp = point;
+ MapWindowPoints(HWND_DESKTOP, GetHWND(), &temp, 1);
+ UINT message_flags = 0;
+ if ((GetKeyState(VK_CONTROL) & 0x80) == 0x80)
+ message_flags |= MK_CONTROL;
+ if ((GetKeyState(VK_SHIFT) & 0x80) == 0x80)
+ message_flags |= MK_SHIFT;
+ message_flags |= flags;
+ ProcessMousePressed(temp, message_flags, false);
+}
+
} // namespace views