Index: views/screen_win.cc |
=================================================================== |
--- views/screen_win.cc (revision 72590) |
+++ views/screen_win.cc (working copy) |
@@ -33,19 +33,27 @@ |
return gfx::Rect(monitor_info.rcMonitor); |
} |
-// static |
-gfx::Rect Screen::GetMonitorAreaNearestPoint(const gfx::Point& point) { |
+static gfx::Rect GetMonitorAreaOrWorkAreaNearestPoint(const gfx::Point& point, |
+ bool work_area) { |
sky
2011/01/27 00:22:07
align this with ( on previous line.
|
POINT initial_loc = { point.x(), point.y() }; |
HMONITOR monitor = MonitorFromPoint(initial_loc, MONITOR_DEFAULTTONEAREST); |
- if (!monitor) |
- return gfx::Rect(); |
- |
MONITORINFO mi = {0}; |
mi.cbSize = sizeof(mi); |
- GetMonitorInfo(monitor, &mi); |
- return gfx::Rect(mi.rcMonitor); |
+ if (monitor && GetMonitorInfo(monitor, &mi)) |
+ return gfx::Rect(work_area ? mi.rcWork : mi.rcMonitor); |
+ return gfx::Rect(); |
} |
+// static |
+gfx::Rect Screen::GetMonitorWorkAreaNearestPoint(const gfx::Point& point) { |
+ return GetMonitorAreaOrWorkAreaNearestPoint(point, true); |
+} |
+ |
+// static |
+gfx::Rect Screen::GetMonitorAreaNearestPoint(const gfx::Point& point) { |
+ return GetMonitorAreaOrWorkAreaNearestPoint(point, false); |
+} |
+ |
gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() { |
POINT location; |
return GetCursorPos(&location) ? WindowFromPoint(location) : NULL; |