OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/views/app_list/linux/app_list_linux.h" | 5 #include "chrome/browser/ui/views/app_list/linux/app_list_linux.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "ui/app_list/app_list_switches.h" | 8 #include "ui/app_list/app_list_switches.h" |
9 #include "ui/app_list/views/app_list_view.h" | 9 #include "ui/app_list/views/app_list_view.h" |
10 #include "ui/gfx/screen.h" | 10 #include "ui/gfx/screen.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 ? view_size.height() | 77 ? view_size.height() |
78 : view_size.width(); | 78 : view_size.width(); |
79 if (positioner.GetCursorDistanceFromShelf(edge, cursor) > snap_distance) | 79 if (positioner.GetCursorDistanceFromShelf(edge, cursor) > snap_distance) |
80 return positioner.GetAnchorPointForShelfCorner(edge); | 80 return positioner.GetAnchorPointForShelfCorner(edge); |
81 | 81 |
82 return positioner.GetAnchorPointForShelfCursor(edge, cursor); | 82 return positioner.GetAnchorPointForShelfCursor(edge, cursor); |
83 } | 83 } |
84 | 84 |
85 // static | 85 // static |
86 void AppListLinux::MoveNearCursor(app_list::AppListView* view) { | 86 void AppListLinux::MoveNearCursor(app_list::AppListView* view) { |
87 gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint(); | 87 gfx::Point cursor = gfx::Screen::GetScreen()->GetCursorScreenPoint(); |
88 gfx::Screen* screen = | 88 gfx::Screen* screen = |
89 gfx::Screen::GetScreenFor(view->GetWidget()->GetNativeView()); | 89 gfx::Screen::GetScreenFor(view->GetWidget()->GetNativeView()); |
90 gfx::Display display = screen->GetDisplayNearestPoint(cursor); | 90 gfx::Display display = screen->GetDisplayNearestPoint(cursor); |
91 | 91 |
92 view->SetBubbleArrow(views::BubbleBorder::FLOAT); | 92 view->SetBubbleArrow(views::BubbleBorder::FLOAT); |
93 | 93 |
94 AppListPositioner::ScreenEdge edge; | 94 AppListPositioner::ScreenEdge edge; |
95 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 95 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
96 // In the Unity desktop environment, special case SCREEN_EDGE_LEFT. It is | 96 // In the Unity desktop environment, special case SCREEN_EDGE_LEFT. It is |
97 // always on the left side in Unity, but ShelfLocationInDisplay will not | 97 // always on the left side in Unity, but ShelfLocationInDisplay will not |
98 // detect this if the shelf is hidden. | 98 // detect this if the shelf is hidden. |
99 // TODO(mgiuca): Apply this special case in Gnome Shell also. The same logic | 99 // TODO(mgiuca): Apply this special case in Gnome Shell also. The same logic |
100 // applies, but we currently have no way to detect whether Gnome Shell is | 100 // applies, but we currently have no way to detect whether Gnome Shell is |
101 // running. | 101 // running. |
102 views::LinuxUI* ui = views::LinuxUI::instance(); | 102 views::LinuxUI* ui = views::LinuxUI::instance(); |
103 if (ui && ui->UnityIsRunning()) | 103 if (ui && ui->UnityIsRunning()) |
104 edge = AppListPositioner::SCREEN_EDGE_LEFT; | 104 edge = AppListPositioner::SCREEN_EDGE_LEFT; |
105 else | 105 else |
106 #endif | 106 #endif |
107 edge = ShelfLocationInDisplay(display); | 107 edge = ShelfLocationInDisplay(display); |
108 view->SetAnchorPoint(FindAnchorPoint(view->GetPreferredSize(), | 108 view->SetAnchorPoint(FindAnchorPoint(view->GetPreferredSize(), |
109 display, | 109 display, |
110 cursor, | 110 cursor, |
111 edge, | 111 edge, |
112 view->ShouldCenterWindow())); | 112 view->ShouldCenterWindow())); |
113 } | 113 } |
OLD | NEW |