Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: chrome/browser/ui/app_list/app_list_service_mac.mm

Issue 93863002: Mac App Launcher is positioned on center of dock in certain cases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Require the mouse to be within window range of the dock, not 50 pixels. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..8fdcd88ef0897151eb5af7d537eee41884b0f0a4 100644
--- a/chrome/browser/ui/app_list/app_list_service_mac.mm
+++ b/chrome/browser/ui/app_list/app_list_service_mac.mm
@@ -280,24 +280,29 @@ 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 the window
+ // width/height 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);
+ int snap_distance =
+ dock_location == AppListPositioner::SCREEN_EDGE_BOTTOM ||
+ dock_location == AppListPositioner::SCREEN_EDGE_TOP ?
tapted 2013/12/02 06:28:38 nit: maybe don't worry about _TOP here? since ther
Matt Giuca 2013/12/03 02:21:53 I would prefer for this code to not implicitly map
+ window_size.height() :
+ window_size.width();
+ // 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) > snap_distance) {
+ 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);
}
}

Powered by Google App Engine
This is Rietveld 408576698