| Index: ui/gfx/screen_win.cc
|
| diff --git a/ui/gfx/screen_win.cc b/ui/gfx/screen_win.cc
|
| index 2873b72114d35ea9ae74086e2a10d7a3398df433..ea74c8245f742ce70071d8520827b85a56d92830 100644
|
| --- a/ui/gfx/screen_win.cc
|
| +++ b/ui/gfx/screen_win.cc
|
| @@ -6,6 +6,17 @@
|
|
|
| #include <windows.h>
|
|
|
| +namespace {
|
| +
|
| +MONITORINFO GetMonitorInfoForMonitor(HMONITOR monitor) {
|
| + MONITORINFO monitor_info = { 0 };
|
| + monitor_info.cbSize = sizeof(monitor_info);
|
| + GetMonitorInfo(monitor, &monitor_info);
|
| + return monitor_info;
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| namespace gfx {
|
|
|
| // static
|
| @@ -55,6 +66,26 @@ gfx::Rect Screen::GetMonitorAreaNearestPoint(const gfx::Point& point) {
|
| }
|
|
|
| // static
|
| +gfx::Rect Screen::GetPrimaryMonitorWorkArea() {
|
| + return gfx::Rect(GetMonitorInfoForMonitor(MonitorFromWindow(NULL,
|
| + MONITOR_DEFAULTTOPRIMARY)).rcWork);
|
| +}
|
| +
|
| +// static
|
| +gfx::Rect Screen::GetPrimaryMonitorBounds() {
|
| + return gfx::Rect(GetMonitorInfoForMonitor(MonitorFromWindow(NULL,
|
| + MONITOR_DEFAULTTOPRIMARY)).rcMonitor);
|
| +}
|
| +
|
| +// static
|
| +gfx::Rect Screen::GetMonitorWorkAreaMatching(const gfx::Rect& match_rect) {
|
| + RECT other_bounds_rect = match_rect.ToRECT();
|
| + MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect(
|
| + &other_bounds_rect, MONITOR_DEFAULTTONEAREST));
|
| + return gfx::Rect(monitor_info.rcWork);
|
| +}
|
| +
|
| +// static
|
| gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() {
|
| POINT location;
|
| return GetCursorPos(&location) ? WindowFromPoint(location) : NULL;
|
|
|