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 "ui/gfx/screen.h" | 5 #include "ui/gfx/screen.h" |
6 | 6 |
7 #import <ApplicationServices/ApplicationServices.h> | 7 #import <ApplicationServices/ApplicationServices.h> |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 @interface NSScreen (LionAPI) | 10 @interface NSScreen (LionAPI) |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // static | 150 // static |
151 gfx::Display Screen::GetDisplayNearestPoint(const gfx::Point& point) { | 151 gfx::Display Screen::GetDisplayNearestPoint(const gfx::Point& point) { |
152 NSPoint ns_point = NSPointFromCGPoint(point.ToCGPoint()); | 152 NSPoint ns_point = NSPointFromCGPoint(point.ToCGPoint()); |
153 | 153 |
154 NSArray* screens = [NSScreen screens]; | 154 NSArray* screens = [NSScreen screens]; |
155 NSScreen* primary = [screens objectAtIndex:0]; | 155 NSScreen* primary = [screens objectAtIndex:0]; |
156 for (NSScreen* screen in screens) { | 156 for (NSScreen* screen in screens) { |
157 if (NSMouseInRect(ns_point, [screen frame], NO)) | 157 if (NSMouseInRect(ns_point, [screen frame], NO)) |
158 return GetDisplayForScreen(screen, screen == primary); | 158 return GetDisplayForScreen(screen, screen == primary); |
159 } | 159 } |
160 NOTREACHED(); | 160 return GetPrimaryDisplay(); |
161 return gfx::Display(); | |
162 } | 161 } |
163 | 162 |
164 } // namespace gfx | 163 } // namespace gfx |
OLD | NEW |