OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/shelf/shelf_view.h" | 5 #include "ash/shelf/shelf_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 int view_index = view_model_->GetIndexOfView(sender); | 1662 int view_index = view_model_->GetIndexOfView(sender); |
1663 // May be -1 while in the process of animating closed. | 1663 // May be -1 while in the process of animating closed. |
1664 if (view_index == -1) | 1664 if (view_index == -1) |
1665 return; | 1665 return; |
1666 | 1666 |
1667 // If the previous menu was closed by the same event as this one, we ignore | 1667 // If the previous menu was closed by the same event as this one, we ignore |
1668 // the call. | 1668 // the call. |
1669 if (!IsUsableEvent(event)) | 1669 if (!IsUsableEvent(event)) |
1670 return; | 1670 return; |
1671 | 1671 |
| 1672 // Don't activate the item twice on double-click. Otherwise the window starts |
| 1673 // animating open due to the first click, then immediately minimizes due to |
| 1674 // the second click. The user most likely intended to open or minimize the |
| 1675 // item once, not do both. |
| 1676 if (event.flags() & ui::EF_IS_DOUBLE_CLICK) |
| 1677 return; |
| 1678 |
1672 { | 1679 { |
1673 ScopedTargetRootWindow scoped_target( | 1680 ScopedTargetRootWindow scoped_target( |
1674 sender->GetWidget()->GetNativeView()->GetRootWindow()); | 1681 sender->GetWidget()->GetNativeView()->GetRootWindow()); |
1675 // Slow down activation animations if shift key is pressed. | 1682 // Slow down activation animations if shift key is pressed. |
1676 scoped_ptr<ui::ScopedAnimationDurationScaleMode> slowing_animations; | 1683 scoped_ptr<ui::ScopedAnimationDurationScaleMode> slowing_animations; |
1677 if (event.IsShiftDown()) { | 1684 if (event.IsShiftDown()) { |
1678 slowing_animations.reset(new ui::ScopedAnimationDurationScaleMode( | 1685 slowing_animations.reset(new ui::ScopedAnimationDurationScaleMode( |
1679 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION)); | 1686 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION)); |
1680 } | 1687 } |
1681 | 1688 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1917 distance = bounds.x() - coordinate.x(); | 1924 distance = bounds.x() - coordinate.x(); |
1918 break; | 1925 break; |
1919 case SHELF_ALIGNMENT_TOP: | 1926 case SHELF_ALIGNMENT_TOP: |
1920 distance = coordinate.y() - bounds.bottom(); | 1927 distance = coordinate.y() - bounds.bottom(); |
1921 break; | 1928 break; |
1922 } | 1929 } |
1923 return distance > 0 ? distance : 0; | 1930 return distance > 0 ? distance : 0; |
1924 } | 1931 } |
1925 | 1932 |
1926 } // namespace ash | 1933 } // namespace ash |
OLD | NEW |