Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: views/screen_win.cc

Issue 6380007: Don't allow new windows to be created outside the monitor's work area.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/screen_gtk.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/screen_win.cc
===================================================================
--- views/screen_win.cc (revision 72746)
+++ 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) {
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;
« no previous file with comments | « views/screen_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698