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

Unified Diff: ash/wm/dock/docked_window_layout_manager.cc

Issue 594383002: Change behaviour of the Alt-] and Alt-[ keys so that it cycles through SnapLeft/SnapRight to DockLe… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@event
Patch Set: Address DockLeft/DockRight issues Created 6 years, 3 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
Index: ash/wm/dock/docked_window_layout_manager.cc
diff --git a/ash/wm/dock/docked_window_layout_manager.cc b/ash/wm/dock/docked_window_layout_manager.cc
index b6a0c69227b716dc41bff261e46051749c340c77..1657505049e2cb58ef3312f3ff8fcd256c752d0f 100644
--- a/ash/wm/dock/docked_window_layout_manager.cc
+++ b/ash/wm/dock/docked_window_layout_manager.cc
@@ -416,6 +416,7 @@ DockedWindowLayoutManager::DockedWindowLayoutManager(
WORKSPACE_WINDOW_STATE_FULL_SCREEN),
docked_width_(0),
alignment_(DOCKED_ALIGNMENT_NONE),
+ preferred_alignment_(DOCKED_ALIGNMENT_NONE),
last_active_window_(NULL),
last_action_time_(base::Time::Now()),
background_widget_(new DockedBackgroundWidget(dock_container_)) {
@@ -595,6 +596,11 @@ DockedAlignment DockedWindowLayoutManager::CalculateAlignment(
return DOCKED_ALIGNMENT_NONE;
}
+void DockedWindowLayoutManager::SetPreferredAlignment(
+ DockedAlignment preferred_alignment) {
+ preferred_alignment_ = preferred_alignment;
varkha 2014/09/29 21:04:34 This is simple enough to qualify for a header inli
dtapuska 2014/09/30 14:40:49 Done.
+}
+
bool DockedWindowLayoutManager::CanDockWindow(
aura::Window* window,
DockedAlignment desired_alignment) {
@@ -692,8 +698,10 @@ void DockedWindowLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
// A window can be added without proper bounds when window is moved to another
// display via API or due to display configuration change, so the alignment
// is set based on which edge is closer in the new display.
- if (alignment_ == DOCKED_ALIGNMENT_NONE)
- alignment_ = GetEdgeNearestWindow(child);
+ if (alignment_ == DOCKED_ALIGNMENT_NONE) {
+ alignment_ = preferred_alignment_ != DOCKED_ALIGNMENT_NONE ?
+ preferred_alignment_ : GetEdgeNearestWindow(child);
+ }
MaybeMinimizeChildrenExcept(child);
child->AddObserver(this);
wm::GetWindowState(child)->AddObserver(this);
@@ -854,6 +862,8 @@ void DockedWindowLayoutManager::OnPreWindowStateTypeChange(
MinimizeDockedWindow(window_state);
} else if (old_type == wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED) {
RestoreDockedWindow(window_state);
+ } else if (old_type == wm::WINDOW_STATE_TYPE_MINIMIZED) {
+ NOTREACHED() << "Minimized window in docked layout manager";
}
}

Powered by Google App Engine
This is Rietveld 408576698