Index: ui/gfx/screen_mac.mm |
diff --git a/ui/gfx/screen_mac.mm b/ui/gfx/screen_mac.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b38344ac76b85d9217aa67efbcaf663b94f08103 |
--- /dev/null |
+++ b/ui/gfx/screen_mac.mm |
@@ -0,0 +1,20 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ui/gfx/screen.h" |
+ |
+#import <Cocoa/Cocoa.h> |
+ |
+namespace gfx { |
+ |
+// static |
+gfx::Point Screen::GetCursorScreenPoint() { |
+ NSPoint mouseLocation = [NSEvent mouseLocation]; |
+ // Flip coordinates to gfx (0,0 in top-left corner) using primary screen. |
+ NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
+ mouseLocation.y = NSMaxY([screen frame]) - mouseLocation.y; |
+ return gfx::Point(mouseLocation.x, mouseLocation.y); |
+} |
+ |
+} // namespace gfx |