diff options
Diffstat (limited to 'chrome/views/custom_frame_window.cc')
-rw-r--r-- | chrome/views/custom_frame_window.cc | 37 |
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 |