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

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

Issue 10537067: mac: Basic HighDPI implementation for web contents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: done 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 | « content/renderer/render_widget.cc ('k') | ui/gfx/screen_win.cc » ('j') | 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // static 82 // static
83 gfx::Point Screen::GetCursorScreenPoint() { 83 gfx::Point Screen::GetCursorScreenPoint() {
84 NSPoint mouseLocation = [NSEvent mouseLocation]; 84 NSPoint mouseLocation = [NSEvent mouseLocation];
85 // Flip coordinates to gfx (0,0 in top-left corner) using primary screen. 85 // Flip coordinates to gfx (0,0 in top-left corner) using primary screen.
86 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; 86 NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
87 mouseLocation.y = NSMaxY([screen frame]) - mouseLocation.y; 87 mouseLocation.y = NSMaxY([screen frame]) - mouseLocation.y;
88 return gfx::Point(mouseLocation.x, mouseLocation.y); 88 return gfx::Point(mouseLocation.x, mouseLocation.y);
89 } 89 }
90 90
91 // static 91 // static
92 gfx::Monitor Screen::GetMonitorNearestWindow(gfx::NativeView view) {
Avi (use Gerrit) 2012/06/08 14:41:43 GetMonitorNearestWindow takes a view!?
Nico 2012/06/08 14:43:05 Yeah :-/
93 NSWindow* window = [view window];
94 if (!window)
95 return GetPrimaryMonitor();
96 NSScreen* match_screen = [window screen];
97 return GetMonitorForScreen(match_screen, false /* may not be primary */);
98 }
99
100 // static
92 gfx::Monitor Screen::GetPrimaryMonitor() { 101 gfx::Monitor Screen::GetPrimaryMonitor() {
93 // Primary monitor is defined as the monitor with the menubar, 102 // Primary monitor is defined as the monitor with the menubar,
94 // which is always at index 0. 103 // which is always at index 0.
95 NSScreen* primary = [[NSScreen screens] objectAtIndex:0]; 104 NSScreen* primary = [[NSScreen screens] objectAtIndex:0];
96 gfx::Monitor monitor = GetMonitorForScreen(primary, true /* primary */); 105 gfx::Monitor monitor = GetMonitorForScreen(primary, true /* primary */);
97 return monitor; 106 return monitor;
98 } 107 }
99 108
100 // static 109 // static
101 gfx::Monitor Screen::GetMonitorMatching(const gfx::Rect& match_rect) { 110 gfx::Monitor Screen::GetMonitorMatching(const gfx::Rect& match_rect) {
(...skipping 30 matching lines...) Expand all
132 // The primary display in a mirrored set will be counted, but those that 141 // The primary display in a mirrored set will be counted, but those that
133 // mirror it will not be. 142 // mirror it will not be.
134 ++display_count; 143 ++display_count;
135 } 144 }
136 } 145 }
137 146
138 return display_count; 147 return display_count;
139 } 148 }
140 149
141 } // namespace gfx 150 } // namespace gfx
OLDNEW
« no previous file with comments | « content/renderer/render_widget.cc ('k') | ui/gfx/screen_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698