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

Unified Diff: ui/gfx/screen_mac.mm

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac compile fix Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/screen_mac.mm
diff --git a/ui/gfx/screen_mac.mm b/ui/gfx/screen_mac.mm
index 325c679209d52523ba4d7927768e52384a6d2e13..df3face068ee8b7e0a001b139300f9a0eec315f3 100644
--- a/ui/gfx/screen_mac.mm
+++ b/ui/gfx/screen_mac.mm
@@ -85,7 +85,7 @@ bool Screen::IsDIPEnabled() {
}
// static
-gfx::Point Screen::GetCursorScreenPoint() {
+gfx::Point Screen::GetCursorScreenPoint(gfx::NativeView context) {
NSPoint mouseLocation = [NSEvent mouseLocation];
// Flip coordinates to gfx (0,0 in top-left corner) using primary screen.
NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
@@ -97,19 +97,20 @@ gfx::Point Screen::GetCursorScreenPoint() {
gfx::Display Screen::GetDisplayNearestWindow(gfx::NativeView view) {
NSWindow* window = [view window];
if (!window)
- return GetPrimaryDisplay();
+ return GetPrimaryDisplay(view);
NSScreen* match_screen = [window screen];
return GetDisplayForScreen(match_screen, false /* may not be primary */);
}
// static
-gfx::Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) {
+gfx::Display Screen::GetDisplayMatching(
+ gfx::NativeView context, const gfx::Rect& match_rect) {
NSScreen* match_screen = GetMatchingScreen(match_rect);
return GetDisplayForScreen(match_screen, false /* may not be primary */);
}
// static
-gfx::Display Screen::GetPrimaryDisplay() {
+gfx::Display Screen::GetPrimaryDisplay(gfx::NativeView context) {
// Primary display is defined as the display with the menubar,
// which is always at index 0.
NSScreen* primary = [[NSScreen screens] objectAtIndex:0];
@@ -118,7 +119,7 @@ gfx::Display Screen::GetPrimaryDisplay() {
}
// static
-int Screen::GetNumDisplays() {
+int Screen::GetNumDisplays(gfx::NativeView context) {
// Don't just return the number of online displays. It includes displays
// that mirror other displays, which are not desired in the count. It's
// tempting to use the count returned by CGGetActiveDisplayList, but active
@@ -153,7 +154,8 @@ int Screen::GetNumDisplays() {
}
// static
-gfx::Display Screen::GetDisplayNearestPoint(const gfx::Point& point) {
+gfx::Display Screen::GetDisplayNearestPoint(
+ gfx::NativeView context, const gfx::Point& point) {
NSPoint ns_point = NSPointFromCGPoint(point.ToCGPoint());
NSArray* screens = [NSScreen screens];
@@ -162,7 +164,7 @@ gfx::Display Screen::GetDisplayNearestPoint(const gfx::Point& point) {
if (NSMouseInRect(ns_point, [screen frame], NO))
return GetDisplayForScreen(screen, screen == primary);
}
- return GetPrimaryDisplay();
+ return GetPrimaryDisplay(context);
}
} // namespace gfx

Powered by Google App Engine
This is Rietveld 408576698