Index: ui/gfx/screen_mac.mm |
diff --git a/ui/gfx/screen_mac.mm b/ui/gfx/screen_mac.mm |
index 0bbed902472f7a0cad530a0ed400d15210241a0b..a7957c2607be76d9aad82e9ce56c00e598a68614 100644 |
--- a/ui/gfx/screen_mac.mm |
+++ b/ui/gfx/screen_mac.mm |
@@ -89,6 +89,15 @@ gfx::Point Screen::GetCursorScreenPoint() { |
} |
// static |
+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 :-/
|
+ NSWindow* window = [view window]; |
+ if (!window) |
+ return GetPrimaryMonitor(); |
+ NSScreen* match_screen = [window screen]; |
+ return GetMonitorForScreen(match_screen, false /* may not be primary */); |
+} |
+ |
+// static |
gfx::Monitor Screen::GetPrimaryMonitor() { |
// Primary monitor is defined as the monitor with the menubar, |
// which is always at index 0. |