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 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/gfx/monitor.h" | 10 #include "ui/gfx/monitor.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 POINT location; | 46 POINT location; |
47 return GetCursorPos(&location) ? WindowFromPoint(location) : NULL; | 47 return GetCursorPos(&location) ? WindowFromPoint(location) : NULL; |
48 } | 48 } |
49 | 49 |
50 // static | 50 // static |
51 int Screen::GetNumMonitors() { | 51 int Screen::GetNumMonitors() { |
52 return GetSystemMetrics(SM_CMONITORS); | 52 return GetSystemMetrics(SM_CMONITORS); |
53 } | 53 } |
54 | 54 |
55 // static | 55 // static |
56 gfx::Monitor Screen::GetMonitorNearestWindow(gfx::NativeWindow window) { | 56 gfx::Monitor Screen::GetMonitorNearestWindow(gfx::NativeView window) { |
57 MONITORINFO monitor_info; | 57 MONITORINFO monitor_info; |
58 monitor_info.cbSize = sizeof(monitor_info); | 58 monitor_info.cbSize = sizeof(monitor_info); |
59 GetMonitorInfo(MonitorFromWindow(window, MONITOR_DEFAULTTONEAREST), | 59 GetMonitorInfo(MonitorFromWindow(window, MONITOR_DEFAULTTONEAREST), |
60 &monitor_info); | 60 &monitor_info); |
61 return GetMonitor(monitor_info); | 61 return GetMonitor(monitor_info); |
62 } | 62 } |
63 | 63 |
64 // static | 64 // static |
65 gfx::Monitor Screen::GetMonitorNearestPoint(const gfx::Point& point) { | 65 gfx::Monitor Screen::GetMonitorNearestPoint(const gfx::Point& point) { |
66 POINT initial_loc = { point.x(), point.y() }; | 66 POINT initial_loc = { point.x(), point.y() }; |
(...skipping 17 matching lines...) Expand all Loading... |
84 | 84 |
85 // static | 85 // static |
86 gfx::Monitor Screen::GetMonitorMatching(const gfx::Rect& match_rect) { | 86 gfx::Monitor Screen::GetMonitorMatching(const gfx::Rect& match_rect) { |
87 RECT other_bounds_rect = match_rect.ToRECT(); | 87 RECT other_bounds_rect = match_rect.ToRECT(); |
88 MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect( | 88 MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect( |
89 &other_bounds_rect, MONITOR_DEFAULTTONEAREST)); | 89 &other_bounds_rect, MONITOR_DEFAULTTONEAREST)); |
90 return GetMonitor(monitor_info); | 90 return GetMonitor(monitor_info); |
91 } | 91 } |
92 | 92 |
93 } // namespace gfx | 93 } // namespace gfx |
OLD | NEW |