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 #include <map> | 10 #include <map> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 class ScreenMac : public gfx::Screen { | 85 class ScreenMac : public gfx::Screen { |
86 public: | 86 public: |
87 ScreenMac() { | 87 ScreenMac() { |
88 displays_ = BuildDisplaysFromQuartz(); | 88 displays_ = BuildDisplaysFromQuartz(); |
89 | 89 |
90 CGDisplayRegisterReconfigurationCallback( | 90 CGDisplayRegisterReconfigurationCallback( |
91 ScreenMac::DisplayReconfigurationCallBack, this); | 91 ScreenMac::DisplayReconfigurationCallBack, this); |
92 } | 92 } |
93 | 93 |
94 bool IsDIPEnabled() override { return true; } | |
95 | |
96 gfx::Point GetCursorScreenPoint() override { | 94 gfx::Point GetCursorScreenPoint() override { |
97 NSPoint mouseLocation = [NSEvent mouseLocation]; | 95 NSPoint mouseLocation = [NSEvent mouseLocation]; |
98 // Flip coordinates to gfx (0,0 in top-left corner) using primary screen. | 96 // Flip coordinates to gfx (0,0 in top-left corner) using primary screen. |
99 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 97 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
100 mouseLocation.y = NSMaxY([screen frame]) - mouseLocation.y; | 98 mouseLocation.y = NSMaxY([screen frame]) - mouseLocation.y; |
101 return gfx::Point(mouseLocation.x, mouseLocation.y); | 99 return gfx::Point(mouseLocation.x, mouseLocation.y); |
102 } | 100 } |
103 | 101 |
104 gfx::NativeWindow GetWindowUnderCursor() override { | 102 gfx::NativeWindow GetWindowUnderCursor() override { |
105 NOTIMPLEMENTED(); | 103 NOTIMPLEMENTED(); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 264 |
267 namespace gfx { | 265 namespace gfx { |
268 | 266 |
269 #if !defined(USE_AURA) | 267 #if !defined(USE_AURA) |
270 Screen* CreateNativeScreen() { | 268 Screen* CreateNativeScreen() { |
271 return new ScreenMac; | 269 return new ScreenMac; |
272 } | 270 } |
273 #endif | 271 #endif |
274 | 272 |
275 } | 273 } |
OLD | NEW |