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

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

Issue 13896026: Stick windows to sides of workspaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Docking with dock width=0 (more comments) 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_window_resizer.cc
diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc
index 25430933827c63762fb0e9b7dcc1cc1d348f5370..762cf93f7f017563737eab987a6d134858bc9de6 100644
--- a/ash/wm/workspace/workspace_window_resizer.cc
+++ b/ash/wm/workspace/workspace_window_resizer.cc
@@ -16,6 +16,8 @@
#include "ash/shell_window_ids.h"
#include "ash/wm/coordinate_conversion.h"
#include "ash/wm/default_window_resizer.h"
+#include "ash/wm/dock/dock_layout_manager.h"
+#include "ash/wm/dock/dock_window_resizer.h"
#include "ash/wm/drag_window_resizer.h"
#include "ash/wm/panels/panel_window_resizer.h"
#include "ash/wm/property_util.h"
@@ -65,7 +67,11 @@ scoped_ptr<WindowResizer> CreateWindowResizer(aura::Window* window,
window_resizer = internal::DragWindowResizer::Create(
window_resizer, window, point_in_parent, window_component);
}
- if (window_resizer && window->type() == aura::client::WINDOW_TYPE_PANEL) {
+ if (window_resizer && GetDockEdge(window) != DOCK_EDGE_NONE) {
+ window_resizer = DockWindowResizer::Create(
+ window_resizer, window, point_in_parent, window_component);
+ } else if (window_resizer &&
+ window->type() == aura::client::WINDOW_TYPE_PANEL) {
flackr 2013/06/04 19:58:10 Should this really be an else if? Wouldn't this pr
varkha 2013/06/07 19:01:28 It would (for the panels). This is a symmetrical s
window_resizer = PanelWindowResizer::Create(
window_resizer, window, point_in_parent, window_component);
}
@@ -303,6 +309,13 @@ class WindowSize {
WorkspaceWindowResizer::~WorkspaceWindowResizer() {
Shell* shell = Shell::GetInstance();
shell->cursor_manager()->UnlockCursor();
+
+ if (GetDockEdge(window()) != dock_edge_ &&
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAshEnableDockedWindows))
+ if (window()->type() != aura::client::WINDOW_TYPE_PANEL ||
+ !window()->GetProperty(internal::kPanelAttachedKey))
+ SetDockEdge(window(), dock_edge_);
flackr 2013/06/04 19:58:10 This should probably be in CompleteDrag. Also we s
varkha 2013/06/07 19:01:28 Done (the first part). The second part may get add
}
// static
@@ -368,7 +381,7 @@ void WorkspaceWindowResizer::CompleteDrag(int event_flags) {
if (!did_move_or_resize_ || details_.window_component != HTCAPTION)
return;
- // When the window is not in the normal show state, we do not snap thw window.
+ // When the window is not in the normal show state, we do not snap the window.
// This happens when the user minimizes or maximizes the window by keyboard
// shortcut while dragging it. If the window is the result of dragging a tab
// out of a maximized window, it's already in the normal show state when this
@@ -433,6 +446,7 @@ WorkspaceWindowResizer::WorkspaceWindowResizer(
total_min_(0),
total_initial_size_(0),
snap_type_(SNAP_NONE),
+ dock_edge_(DOCK_EDGE_NONE),
num_mouse_moves_since_bounds_change_(0),
magnetism_window_(NULL) {
DCHECK(details_.is_resizable);
@@ -683,6 +697,7 @@ void WorkspaceWindowResizer::AdjustBoundsForMainWindow(
if (sticky_size > 0) {
StickToWorkAreaOnMove(work_area, sticky_size, bounds);
MagneticallySnapToOtherWindows(bounds);
+ dock_edge_ = DockLayoutManager::FindDockEdge(window());
flackr 2013/06/04 20:58:03 As discussed, you shouldn't need to track this sin
varkha 2013/06/07 19:01:28 Done.
}
} else if (sticky_size > 0) {
MagneticallySnapResizeToOtherWindows(bounds);
« ash/wm/dock/dock_window_resizer.cc ('K') | « ash/wm/workspace/workspace_window_resizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698