summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/browser_window_cocoa.mm
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-21 21:30:29 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-21 21:30:29 +0000
commitdd6ef5991cf5f4b2b822db46832e0d78874efc24 (patch)
tree1f0f0a4e626a2ce33d5a80a6741c6b29387b1fb6 /chrome/browser/cocoa/browser_window_cocoa.mm
parent7316e3e557994729c709b2d227303183bd918569 (diff)
downloadchromium_src-dd6ef5991cf5f4b2b822db46832e0d78874efc24.zip
chromium_src-dd6ef5991cf5f4b2b822db46832e0d78874efc24.tar.gz
chromium_src-dd6ef5991cf5f4b2b822db46832e0d78874efc24.tar.bz2
[Mac] Properly flip coordinate systems in BrowserWindowCocoa.
BUG=http://crbug.com/18707 TEST=New windows on secondary monitors should cascade correctly. Review URL: http://codereview.chromium.org/314006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29709 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/browser_window_cocoa.mm')
-rw-r--r--chrome/browser/cocoa/browser_window_cocoa.mm7
1 files changed, 4 insertions, 3 deletions
diff --git a/chrome/browser/cocoa/browser_window_cocoa.mm b/chrome/browser/cocoa/browser_window_cocoa.mm
index 38b001e..cc231c6 100644
--- a/chrome/browser/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/cocoa/browser_window_cocoa.mm
@@ -44,8 +44,8 @@ void BrowserWindowCocoa::Show() {
void BrowserWindowCocoa::SetBounds(const gfx::Rect& bounds) {
NSRect cocoa_bounds = NSMakeRect(bounds.x(), 0, bounds.width(),
bounds.height());
- // flip coordinates
- NSScreen* screen = [window_ screen];
+ // Flip coordinates based on the primary screen.
+ NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
cocoa_bounds.origin.y =
[screen frame].size.height - bounds.height() - bounds.y();
@@ -139,8 +139,9 @@ void BrowserWindowCocoa::SetStarredState(bool is_starred) {
gfx::Rect BrowserWindowCocoa::GetRestoredBounds() const {
// TODO(pinkerton): not sure if we can get the non-zoomed bounds, or if it
// really matters. We may want to let Cocoa handle all this for us.
+ // Flip coordinates based on the primary screen.
+ NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
NSRect frame = [window_ frame];
- NSScreen* screen = [window_ screen];
gfx::Rect bounds(frame.origin.x, 0, frame.size.width, frame.size.height);
bounds.set_y([screen frame].size.height - frame.origin.y - frame.size.height);
return bounds;