OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/widget/native_widget_win.h" | 5 #include "views/widget/native_widget_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 | 9 |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 if (message == WM_RBUTTONUP && is_right_mouse_pressed_on_caption_) { | 1482 if (message == WM_RBUTTONUP && is_right_mouse_pressed_on_caption_) { |
1483 is_right_mouse_pressed_on_caption_ = false; | 1483 is_right_mouse_pressed_on_caption_ = false; |
1484 ReleaseCapture(); | 1484 ReleaseCapture(); |
1485 // |point| is in window coordinates, but WM_NCHITTEST and TrackPopupMenu() | 1485 // |point| is in window coordinates, but WM_NCHITTEST and TrackPopupMenu() |
1486 // expect screen coordinates. | 1486 // expect screen coordinates. |
1487 CPoint screen_point(l_param); | 1487 CPoint screen_point(l_param); |
1488 MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_point, 1); | 1488 MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_point, 1); |
1489 w_param = SendMessage(GetNativeView(), WM_NCHITTEST, 0, | 1489 w_param = SendMessage(GetNativeView(), WM_NCHITTEST, 0, |
1490 MAKELPARAM(screen_point.x, screen_point.y)); | 1490 MAKELPARAM(screen_point.x, screen_point.y)); |
1491 if (w_param == HTCAPTION || w_param == HTSYSMENU) { | 1491 if (w_param == HTCAPTION || w_param == HTSYSMENU) { |
1492 UINT flags = TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD; | 1492 ui::ShowSystemMenu(GetNativeView(), screen_point.x, screen_point.y); |
1493 if (base::i18n::IsRTL()) | |
1494 flags |= TPM_RIGHTALIGN; | |
1495 HMENU system_menu = GetSystemMenu(GetNativeView(), FALSE); | |
1496 int id = TrackPopupMenu(system_menu, flags, screen_point.x, | |
1497 screen_point.y, 0, GetNativeView(), NULL); | |
1498 ExecuteSystemMenuCommand(id); | |
1499 return 0; | 1493 return 0; |
1500 } | 1494 } |
1501 } else if (message == WM_NCLBUTTONDOWN && | 1495 } else if (message == WM_NCLBUTTONDOWN && |
1502 !GetWidget()->ShouldUseNativeFrame()) { | 1496 !GetWidget()->ShouldUseNativeFrame()) { |
1503 switch (w_param) { | 1497 switch (w_param) { |
1504 case HTCLOSE: | 1498 case HTCLOSE: |
1505 case HTMINBUTTON: | 1499 case HTMINBUTTON: |
1506 case HTMAXBUTTON: { | 1500 case HTMAXBUTTON: { |
1507 // When the mouse is pressed down in these specific non-client areas, | 1501 // When the mouse is pressed down in these specific non-client areas, |
1508 // we need to tell the RootView to send the mouse pressed event (which | 1502 // we need to tell the RootView to send the mouse pressed event (which |
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2534 return (GetKeyState(VK_LBUTTON) & 0x80) || | 2528 return (GetKeyState(VK_LBUTTON) & 0x80) || |
2535 (GetKeyState(VK_RBUTTON) & 0x80) || | 2529 (GetKeyState(VK_RBUTTON) & 0x80) || |
2536 (GetKeyState(VK_MBUTTON) & 0x80) || | 2530 (GetKeyState(VK_MBUTTON) & 0x80) || |
2537 (GetKeyState(VK_XBUTTON1) & 0x80) || | 2531 (GetKeyState(VK_XBUTTON1) & 0x80) || |
2538 (GetKeyState(VK_XBUTTON2) & 0x80); | 2532 (GetKeyState(VK_XBUTTON2) & 0x80); |
2539 } | 2533 } |
2540 | 2534 |
2541 } // namespace internal | 2535 } // namespace internal |
2542 | 2536 |
2543 } // namespace views | 2537 } // namespace views |
OLD | NEW |