Chromium Code Reviews| Index: ui/views/view.cc |
| diff --git a/ui/views/view.cc b/ui/views/view.cc |
| index 98e3b44b210a9652d9abf9a81f277fa4edd7421d..d75012dceedb65b112e3254b9b303fff76c1e431 100644 |
| --- a/ui/views/view.cc |
| +++ b/ui/views/view.cc |
| @@ -57,6 +57,12 @@ bool use_acceleration_when_possible = true; |
| bool use_acceleration_when_possible = false; |
| #endif |
| +#if defined(OS_WIN) |
| +bool context_menu_on_mouse_press = false; |
| +#else |
| +bool context_menu_on_mouse_press = true; |
| +#endif |
| + |
| // Saves the drawing state, and restores the state when going out of scope. |
| class ScopedCanvas { |
| public: |
| @@ -2046,6 +2052,16 @@ bool View::ProcessMousePressed(const ui::MouseEvent& event) { |
| if (!enabled) |
| return result; |
| + if (event.IsOnlyRightMouseButton() && context_menu_controller_ && |
| + context_menu_on_mouse_press) { |
|
sadrul
2013/03/04 23:22:04
Note the WARNING on 2050.
I think you should firs
varunjain
2013/03/05 00:04:28
Ha! I missed that warning. Although, the GetDragIn
sadrul
2013/03/05 16:30:11
Good catch. Perhaps GetDragInfo() should be cached
varunjain
2013/03/05 21:14:21
Done.
|
| + gfx::Point location(event.location()); |
| + if (HitTestPoint(location)) { |
| + ConvertPointToScreen(this, &location); |
| + ShowContextMenu(location, true); |
| + return true; |
| + } |
| + } |
| + |
| if (drag_operations != ui::DragDropTypes::DRAG_NONE) { |
| GetDragInfo()->PossibleDrag(event.location()); |
| return true; |
| @@ -2076,7 +2092,8 @@ bool View::ProcessMouseDragged(const ui::MouseEvent& event) { |
| } |
| void View::ProcessMouseReleased(const ui::MouseEvent& event) { |
| - if (context_menu_controller_ && event.IsOnlyRightMouseButton()) { |
| + if (!context_menu_on_mouse_press && context_menu_controller_ && |
| + event.IsOnlyRightMouseButton()) { |
| // Assume that if there is a context menu controller we won't be deleted |
| // from mouse released. |
| gfx::Point location(event.location()); |