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

Unified Diff: views/widget/widget.cc

Issue 8477019: Adds Window::MoveChildToFront, with surrounding changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 9 years, 1 month 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/widget/widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/widget/widget.cc
diff --git a/views/widget/widget.cc b/views/widget/widget.cc
index 029b92025cc87ea3ba31e3d4d58e2c365c1388ec..c7fb360e4b1e9bfa1d2159fe21aa9214e51ca290 100644
--- a/views/widget/widget.cc
+++ b/views/widget/widget.cc
@@ -11,6 +11,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/compositor/compositor.h"
#include "ui/gfx/compositor/layer.h"
+#include "ui/gfx/screen.h"
#include "views/controls/menu/menu_controller.h"
#include "views/focus/focus_manager.h"
#include "views/focus/focus_manager_factory.h"
@@ -429,9 +430,16 @@ void Widget::SetSize(const gfx::Size& size) {
native_widget_->SetSize(size);
}
-void Widget::SetBoundsConstrained(const gfx::Rect& bounds,
- Widget* other_widget) {
- native_widget_->SetBoundsConstrained(bounds, other_widget);
+void Widget::SetBoundsConstrained(const gfx::Rect& bounds) {
+ gfx::Rect work_area =
+ gfx::Screen::GetMonitorWorkAreaNearestPoint(bounds.origin());
+ if (work_area.IsEmpty()) {
+ SetBounds(bounds);
+ } else {
+ // Inset the work area slightly.
+ work_area.Inset(10, 10, 10, 10);
+ SetBounds(work_area.AdjustToFit(bounds));
+ }
}
void Widget::MoveAboveWidget(Widget* widget) {
@@ -1153,7 +1161,7 @@ void Widget::SetInitialBounds(const gfx::Rect& bounds) {
native_widget_->CenterWindow(non_client_view_->GetPreferredSize());
} else {
// Use the supplied initial bounds.
- SetBoundsConstrained(bounds, NULL);
+ SetBoundsConstrained(bounds);
}
}
}
« no previous file with comments | « views/widget/widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698