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

Unified Diff: ash/wm/workspace/workspace_layout_manager.cc

Issue 13896026: Stick windows to sides of workspaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dock on left or right edge Created 7 years, 7 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/workspace/workspace_layout_manager.cc
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc
index e4e6c841e0208d8856a54a0cd53a6853d8c3128b..69230152bcb4238b779e2acd06e26a7fec16ac95 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -8,8 +8,10 @@
#include "ash/screen_ash.h"
#include "ash/session_state_delegate.h"
#include "ash/shell.h"
+#include "ash/shell_window_ids.h"
#include "ash/wm/always_on_top_controller.h"
#include "ash/wm/base_layout_manager.h"
+#include "ash/wm/dock/dock_edge_types.h"
#include "ash/wm/window_animations.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
@@ -48,7 +50,7 @@ void BuildWindowBoundsMap(const aura::Window* window, BoundsMap* bounds_map) {
BuildWindowBoundsMap(window->children()[i], bounds_map);
}
-// Resets |window|s bounds from |bounds_map| if currently empty. Recusively
+// Resets |window|s bounds from |bounds_map| if currently empty. Recursively
// invokes this for all children.
void ResetBoundsIfNecessary(const BoundsMap& bounds_map, aura::Window* window) {
if (window->bounds().IsEmpty() && window->GetTargetBounds().IsEmpty()) {
@@ -61,7 +63,7 @@ void ResetBoundsIfNecessary(const BoundsMap& bounds_map, aura::Window* window) {
}
// Resets |window|s bounds from |bounds_map| if |window| is marked as a
-// constrained window. Recusively invokes this for all children.
+// constrained window. Recursively invokes this for all children.
// TODO(sky): this should key off window type.
void ResetConstrainedWindowBoundsIfNecessary(const BoundsMap& bounds_map,
aura::Window* window) {
@@ -97,6 +99,7 @@ WorkspaceLayoutManager::~WorkspaceLayoutManager() {
}
void WorkspaceLayoutManager::OnWindowAddedToLayout(Window* child) {
+ LOG(INFO) << this << " OnWindowAddedToLayout " << child;
// Adjust window bounds in case that the new child is out of the workspace.
AdjustWindowSizeForScreenChange(child, ADJUST_WINDOW_WINDOW_ADDED);
@@ -118,6 +121,7 @@ void WorkspaceLayoutManager::OnWillRemoveWindowFromLayout(Window* child) {
}
void WorkspaceLayoutManager::OnWindowRemovedFromLayout(Window* child) {
+ LOG(INFO) << this << " OnWindowRemovedFromLayout " << child;
workspace_manager()->OnWindowRemovedFromWorkspace(workspace_, child);
}
@@ -241,6 +245,21 @@ void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window,
internal::kAlwaysOnTopControllerKey);
controller->GetContainer(window)->AddChild(window);
}
+
+ if (key == ash::internal::kDockEdges &&
+ GetDockEdges(window) != static_cast<int>(old)) {
+ LOG(INFO) << "Stuck property changed to " << GetDockEdges(window);
+ aura::Window* dock_container = ash::Shell::GetContainer(
+ root_window_,
+ ash::internal::kShellWindowId_DockContainer);
+ DCHECK(dock_container);
+ int edges = GetDockEdges(window) & (DOCK_EDGE_RIGHT | DOCK_EDGE_LEFT);
+ if (edges &&
+ 0 == (static_cast<int>(old) & (DOCK_EDGE_RIGHT | DOCK_EDGE_LEFT))) {
+ LOG(INFO) << "adding " << window << " to dock " << dock_container;
+ dock_container->AddChild(window);
+ }
+ }
}
void WorkspaceLayoutManager::OnWindowDestroying(aura::Window* window) {

Powered by Google App Engine
This is Rietveld 408576698