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::Screen* screen = gfx::Screen::GetScreen(); |
88 gfx::Screen* screen = | 88 gfx::Point cursor = screen->GetCursorScreenPoint(); |
89 gfx::Screen::GetScreenFor(view->GetWidget()->GetNativeView()); | |
90 gfx::Display display = screen->GetDisplayNearestPoint(cursor); | 89 gfx::Display display = screen->GetDisplayNearestPoint(cursor); |
91 | 90 |
92 view->SetBubbleArrow(views::BubbleBorder::FLOAT); | 91 view->SetBubbleArrow(views::BubbleBorder::FLOAT); |
93 | 92 |
94 AppListPositioner::ScreenEdge edge; | 93 AppListPositioner::ScreenEdge edge; |
95 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 94 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
96 // In the Unity desktop environment, special case SCREEN_EDGE_LEFT. It is | 95 // In the Unity desktop environment, special case SCREEN_EDGE_LEFT. It is |
97 // always on the left side in Unity, but ShelfLocationInDisplay will not | 96 // always on the left side in Unity, but ShelfLocationInDisplay will not |
98 // detect this if the shelf is hidden. | 97 // detect this if the shelf is hidden. |
99 // TODO(mgiuca): Apply this special case in Gnome Shell also. The same logic | 98 // 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 | 99 // applies, but we currently have no way to detect whether Gnome Shell is |
101 // running. | 100 // running. |
102 views::LinuxUI* ui = views::LinuxUI::instance(); | 101 views::LinuxUI* ui = views::LinuxUI::instance(); |
103 if (ui && ui->UnityIsRunning()) | 102 if (ui && ui->UnityIsRunning()) |
104 edge = AppListPositioner::SCREEN_EDGE_LEFT; | 103 edge = AppListPositioner::SCREEN_EDGE_LEFT; |
105 else | 104 else |
106 #endif | 105 #endif |
107 edge = ShelfLocationInDisplay(display); | 106 edge = ShelfLocationInDisplay(display); |
108 view->SetAnchorPoint(FindAnchorPoint(view->GetPreferredSize(), | 107 view->SetAnchorPoint(FindAnchorPoint(view->GetPreferredSize(), |
109 display, | 108 display, |
110 cursor, | 109 cursor, |
111 edge, | 110 edge, |
112 view->ShouldCenterWindow())); | 111 view->ShouldCenterWindow())); |
113 } | 112 } |
OLD | NEW |