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

Side by Side Diff: ui/gfx/screen_mac.mm

Issue 10580042: Fix for screen_mac::GetDisplayNearestPoint. The input point may not (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 8 years, 6 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698