| OLD | NEW |
| 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 28 matching lines...) Expand all Loading... |
| 39 max_area = area; | 39 max_area = area; |
| 40 max_screen = screen; | 40 max_screen = screen; |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 return max_screen; | 44 return max_screen; |
| 45 } | 45 } |
| 46 | 46 |
| 47 gfx::Display GetDisplayForScreen(NSScreen* screen) { | 47 gfx::Display GetDisplayForScreen(NSScreen* screen) { |
| 48 NSRect frame = [screen frame]; | 48 NSRect frame = [screen frame]; |
| 49 // TODO(oshima): Implement ID and Observer. | 49 // TODO(oshima): Implement Observer. |
| 50 gfx::Display display(0, gfx::Rect(NSRectToCGRect(frame))); | 50 |
| 51 int64 displayId = [[[screen deviceDescription] |
| 52 objectForKey:@"NSScreenNumber"] intValue]; |
| 53 gfx::Display display(displayId, gfx::Rect(NSRectToCGRect(frame))); |
| 51 | 54 |
| 52 NSRect visible_frame = [screen visibleFrame]; | 55 NSRect visible_frame = [screen visibleFrame]; |
| 53 NSScreen* primary = [[NSScreen screens] objectAtIndex:0]; | 56 NSScreen* primary = [[NSScreen screens] objectAtIndex:0]; |
| 54 | 57 |
| 55 // Convert work area's coordinate systems. | 58 // Convert work area's coordinate systems. |
| 56 if ([screen isEqual:primary]) { | 59 if ([screen isEqual:primary]) { |
| 57 gfx::Rect work_area = gfx::Rect(NSRectToCGRect(visible_frame)); | 60 gfx::Rect work_area = gfx::Rect(NSRectToCGRect(visible_frame)); |
| 58 work_area.set_y(frame.size.height - visible_frame.origin.y - | 61 work_area.set_y(frame.size.height - visible_frame.origin.y - |
| 59 visible_frame.size.height); | 62 visible_frame.size.height); |
| 60 display.set_work_area(work_area); | 63 display.set_work_area(work_area); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 210 |
| 208 } // namespace | 211 } // namespace |
| 209 | 212 |
| 210 namespace gfx { | 213 namespace gfx { |
| 211 | 214 |
| 212 Screen* CreateNativeScreen() { | 215 Screen* CreateNativeScreen() { |
| 213 return new ScreenMac; | 216 return new ScreenMac; |
| 214 } | 217 } |
| 215 | 218 |
| 216 } | 219 } |
| OLD | NEW |