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

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

Issue 641453003: Add metrics for the number of attached displays. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from isherman. Created 6 years, 1 month 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
« no previous file with comments | « ui/gfx/gfx.gyp ('k') | 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 #include <map> 10 #include <map>
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 virtual ~ScreenMac() {
95 CGDisplayRemoveReconfigurationCallback(
96 ScreenMac::DisplayReconfigurationCallBack, this);
97 }
98
94 gfx::Point GetCursorScreenPoint() override { 99 gfx::Point GetCursorScreenPoint() override {
95 NSPoint mouseLocation = [NSEvent mouseLocation]; 100 NSPoint mouseLocation = [NSEvent mouseLocation];
96 // Flip coordinates to gfx (0,0 in top-left corner) using primary screen. 101 // Flip coordinates to gfx (0,0 in top-left corner) using primary screen.
97 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; 102 NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
98 mouseLocation.y = NSMaxY([screen frame]) - mouseLocation.y; 103 mouseLocation.y = NSMaxY([screen frame]) - mouseLocation.y;
99 return gfx::Point(mouseLocation.x, mouseLocation.y); 104 return gfx::Point(mouseLocation.x, mouseLocation.y);
100 } 105 }
101 106
102 gfx::NativeWindow GetWindowUnderCursor() override { 107 gfx::NativeWindow GetWindowUnderCursor() override {
103 NOTIMPLEMENTED(); 108 NOTIMPLEMENTED();
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 269
265 namespace gfx { 270 namespace gfx {
266 271
267 #if !defined(USE_AURA) 272 #if !defined(USE_AURA)
268 Screen* CreateNativeScreen() { 273 Screen* CreateNativeScreen() {
269 return new ScreenMac; 274 return new ScreenMac;
270 } 275 }
271 #endif 276 #endif
272 277
273 } 278 }
OLDNEW
« no previous file with comments | « ui/gfx/gfx.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698