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

Unified Diff: ash/wm/window_state.cc

Issue 255063004: Ignoring minimum size requirements for maximized windows, full screen windows and too small screens (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: The panel layout manager was also required Created 6 years, 8 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 | « ash/wm/panels/panel_layout_manager.cc ('k') | ash/wm/window_state_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_state.cc
diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc
index f0bed4ba0f38d31bdabbde0bf9f6c6b1b9f646b0..7c5c1674f14b050f4593608c1fa278d72e571221 100644
--- a/ash/wm/window_state.cc
+++ b/ash/wm/window_state.cc
@@ -24,6 +24,7 @@
#include "ui/compositor/layer_tree_owner.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/display.h"
+#include "ui/gfx/screen.h"
#include "ui/wm/core/window_util.h"
namespace ash {
@@ -357,7 +358,21 @@ void WindowState::NotifyPostStateTypeChange(
}
void WindowState::SetBoundsDirect(const gfx::Rect& bounds) {
- BoundsSetter().SetBounds(window_, bounds);
+ gfx::Rect actual_new_bounds(bounds);
+ // Ensure we don't go smaller than our minimum bounds in "normal" window
+ // modes
+ if (window_->delegate() && !IsMaximized() && !IsFullscreen()) {
+ // Get the minimum usable size of the minimum size and the screen size.
+ gfx::Size min_size = window_->delegate()->GetMinimumSize();
+ min_size.SetToMin(gfx::Screen::GetScreenFor(
+ window_)->GetDisplayNearestWindow(window_).work_area().size());
+
+ actual_new_bounds.set_width(
+ std::max(min_size.width(), actual_new_bounds.width()));
+ actual_new_bounds.set_height(
+ std::max(min_size.height(), actual_new_bounds.height()));
+ }
+ BoundsSetter().SetBounds(window_, actual_new_bounds);
}
void WindowState::SetBoundsConstrained(const gfx::Rect& bounds) {
« no previous file with comments | « ash/wm/panels/panel_layout_manager.cc ('k') | ash/wm/window_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698