Chromium Code Reviews| Index: chrome/browser/ui/app_list/app_list_service_mac.mm |
| diff --git a/chrome/browser/ui/app_list/app_list_service_mac.mm b/chrome/browser/ui/app_list/app_list_service_mac.mm |
| index 01130b30b4209c53af62cf2c8cd103a2a1156021..4ce33732a623902e52dca940100024b40ab727f7 100644 |
| --- a/chrome/browser/ui/app_list/app_list_service_mac.mm |
| +++ b/chrome/browser/ui/app_list/app_list_service_mac.mm |
| @@ -75,6 +75,10 @@ namespace { |
| // Version of the app list shortcut version installed. |
| const int kShortcutVersion = 1; |
| +// If the mouse cursor is less than this distance, in pixels, away from the |
| +// dock, it is considered to be in the dock for the purpose of anchoring. |
| +const int kSnapDistance = 50; |
|
tapted
2013/11/29 02:12:51
I think this should be at least window width for a
tapted
2013/11/29 06:05:59
Did you see this?
Matt Giuca
2013/12/02 05:02:03
Yes, I made a note to get to it on Monday.
Yes, I
|
| + |
| // Duration of show and hide animations. |
| const NSTimeInterval kAnimationDuration = 0.2; |
| @@ -280,24 +284,24 @@ void AppListServiceMac::FindAnchorPoint(const gfx::Size& window_size, |
| NSPoint* target_origin, |
| NSPoint* start_origin) { |
| AppListPositioner positioner(display, window_size, 0); |
| - AppListPositioner::ScreenEdge dock_location = |
| - AppListPositioner::SCREEN_EDGE_UNKNOWN; |
| + AppListPositioner::ScreenEdge dock_location = DockLocationInDisplay(display); |
| + |
| gfx::Point anchor; |
| - if (!cursor_is_visible) { |
| + // Snap to the dock edge. If the cursor is greater than kSnapDistance away or |
| + // not visible, anchor to the center of the dock. Otherwise, anchor to the |
| + // cursor position. |
| + if (dock_location == AppListPositioner::SCREEN_EDGE_UNKNOWN) { |
| anchor = positioner.GetAnchorPointForScreenCorner( |
| AppListPositioner::SCREEN_CORNER_BOTTOM_LEFT); |
| } else { |
| - dock_location = DockLocationInDisplay(display); |
| - |
| - // Snap to the dock edge, anchored to the cursor position. |
| - if (dock_location == AppListPositioner::SCREEN_EDGE_UNKNOWN) { |
| - anchor = positioner.GetAnchorPointForScreenCorner( |
| - AppListPositioner::SCREEN_CORNER_BOTTOM_LEFT); |
| + // Subtract the dock area since the display's default work_area will not |
| + // subtract it if the dock is set to auto-hide, and the app list should |
| + // never overlap the dock. |
| + AdjustWorkAreaForDock(display, &positioner, dock_location); |
| + if (!cursor_is_visible || positioner.GetCursorDistanceFromShelf( |
| + dock_location, cursor) > kSnapDistance) { |
| + anchor = positioner.GetAnchorPointForShelfCenter(dock_location); |
| } else { |
| - // Subtract the dock area since the display's default work_area will not |
| - // subtract it if the dock is set to auto-hide, and the app list should |
| - // never overlap the dock. |
| - AdjustWorkAreaForDock(display, &positioner, dock_location); |
| anchor = positioner.GetAnchorPointForShelfCursor(dock_location, cursor); |
| } |
| } |