OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/views/custom_frame_window.h" | 5 #include "chrome/views/custom_frame_window.h" |
6 | 6 |
7 #include "base/gfx/point.h" | 7 #include "base/gfx/point.h" |
8 #include "base/gfx/size.h" | 8 #include "base/gfx/size.h" |
9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 ScopedRedrawLock lock(this); | 1142 ScopedRedrawLock lock(this); |
1143 DefWindowProc(GetHWND(), WM_NCLBUTTONDOWN, ht_component, | 1143 DefWindowProc(GetHWND(), WM_NCLBUTTONDOWN, ht_component, |
1144 MAKELPARAM(point.x, point.y)); | 1144 MAKELPARAM(point.x, point.y)); |
1145 SetMsgHandled(TRUE); | 1145 SetMsgHandled(TRUE); |
1146 } | 1146 } |
1147 */ | 1147 */ |
1148 break; | 1148 break; |
1149 } | 1149 } |
1150 } | 1150 } |
1151 | 1151 |
1152 void CustomFrameWindow::OnNCMButtonDown(UINT ht_component, | |
1153 const CPoint& point) { | |
1154 if (ht_component == HTCAPTION) { | |
1155 // When there's only one window and only one tab, the tab area is reported | |
1156 // to be part of the caption area of the window. However users should still | |
1157 // be able to middle click that tab to close it so we need to make sure | |
1158 // these messages reach the View system. | |
1159 ProcessNCMousePress(point, MK_MBUTTON); | |
1160 SetMsgHandled(FALSE); | |
1161 return; | |
1162 } | |
1163 WidgetWin::OnNCMButtonDown(ht_component, point); | |
1164 } | |
1165 | |
1166 LRESULT CustomFrameWindow::OnNCUAHDrawCaption(UINT msg, WPARAM w_param, | 1152 LRESULT CustomFrameWindow::OnNCUAHDrawCaption(UINT msg, WPARAM w_param, |
1167 LPARAM l_param) { | 1153 LPARAM l_param) { |
1168 // See comment in widget_win.h at the definition of WM_NCUAHDRAWCAPTION for | 1154 // See comment in widget_win.h at the definition of WM_NCUAHDRAWCAPTION for |
1169 // an explanation about why we need to handle this message. | 1155 // an explanation about why we need to handle this message. |
1170 SetMsgHandled(TRUE); | 1156 SetMsgHandled(TRUE); |
1171 return 0; | 1157 return 0; |
1172 } | 1158 } |
1173 | 1159 |
1174 LRESULT CustomFrameWindow::OnNCUAHDrawFrame(UINT msg, WPARAM w_param, | 1160 LRESULT CustomFrameWindow::OnNCUAHDrawFrame(UINT msg, WPARAM w_param, |
1175 LPARAM l_param) { | 1161 LPARAM l_param) { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 | 1298 |
1313 void CustomFrameWindow::ProcessNCMousePress(const CPoint& point, int flags) { | 1299 void CustomFrameWindow::ProcessNCMousePress(const CPoint& point, int flags) { |
1314 CPoint temp = point; | 1300 CPoint temp = point; |
1315 MapWindowPoints(HWND_DESKTOP, GetHWND(), &temp, 1); | 1301 MapWindowPoints(HWND_DESKTOP, GetHWND(), &temp, 1); |
1316 UINT message_flags = 0; | 1302 UINT message_flags = 0; |
1317 if ((GetKeyState(VK_CONTROL) & 0x80) == 0x80) | 1303 if ((GetKeyState(VK_CONTROL) & 0x80) == 0x80) |
1318 message_flags |= MK_CONTROL; | 1304 message_flags |= MK_CONTROL; |
1319 if ((GetKeyState(VK_SHIFT) & 0x80) == 0x80) | 1305 if ((GetKeyState(VK_SHIFT) & 0x80) == 0x80) |
1320 message_flags |= MK_SHIFT; | 1306 message_flags |= MK_SHIFT; |
1321 message_flags |= flags; | 1307 message_flags |= flags; |
1322 ProcessMousePressed(temp, message_flags, false); | 1308 ProcessMousePressed(temp, message_flags, false, false); |
1323 } | 1309 } |
1324 | 1310 |
1325 } // namespace views | 1311 } // namespace views |
1326 | |
OLD | NEW |