OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/gfx/screen.h" | |
6 | |
7 #import <Cocoa/Cocoa.h> | |
8 | |
9 namespace gfx { | |
10 | |
11 // static | |
12 gfx::Point Screen::GetCursorScreenPoint() { | |
13 NSPoint mouseLocation = [NSEvent mouseLocation]; | |
14 // Flip coordinates to gfx (0,0 in top-left corner) using primary screen. | |
15 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | |
jennb
2011/09/21 17:48:19
Is it safe to use screen 0 even if the mouse is on
| |
16 mouseLocation.y = NSMaxY([screen frame]) - mouseLocation.y; | |
17 return gfx::Point(mouseLocation.x, mouseLocation.y); | |
18 } | |
19 | |
20 } // namespace gfx | |
OLD | NEW |