| 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 eea0811e770c305a9491d64e994dbfb59fd1b994..62d12bd19222a4d740423a39fb10d660cdf736d5 100644
|
| --- a/ash/wm/workspace/workspace_window_resizer.cc
|
| +++ b/ash/wm/workspace/workspace_window_resizer.cc
|
| @@ -67,45 +67,50 @@ scoped_ptr<WindowResizer> CreateWindowResizer(
|
| // drag has started or stopped.
|
| // It may be possible to refactor and eliminate chaining.
|
| WindowResizer* window_resizer = NULL;
|
| +
|
| + if (!window_state->IsNormalShowState()) {
|
| + if (window->parent() &&
|
| + (window->parent()->id() == internal::kShellWindowId_DefaultContainer ||
|
| + window->parent()->id() == internal::kShellWindowId_DockedContainer ||
|
| + window->parent()->id() == internal::kShellWindowId_PanelContainer)) {
|
| + // Allow dragging maximized windows only when dragged by a tab.
|
| + if (!window_component != HTCAPTION || !window_state->is_dragged())
|
| + return scoped_ptr<WindowResizer>();
|
| + } else {
|
| + return scoped_ptr<WindowResizer>();
|
| + }
|
| + }
|
| +
|
| + if (!window_state->CreateDragDetails(
|
| + window, point_in_parent, window_component, source)) {
|
| + return scoped_ptr<WindowResizer>();
|
| + }
|
| if (window->parent() &&
|
| (window->parent()->id() == internal::kShellWindowId_DefaultContainer ||
|
| window->parent()->id() == internal::kShellWindowId_DockedContainer ||
|
| window->parent()->id() == internal::kShellWindowId_PanelContainer)) {
|
| - // Allow dragging maximized windows if it's not tracked by workspace. This
|
| - // is set by tab dragging code.
|
| - if (!window_state->IsNormalShowState() &&
|
| - (window_component != HTCAPTION ||
|
| - !window_state->is_dragged())) {
|
| - return scoped_ptr<WindowResizer>();
|
| - }
|
| window_resizer = internal::WorkspaceWindowResizer::Create(
|
| - window,
|
| - point_in_parent,
|
| - window_component,
|
| - source,
|
| + window_state,
|
| std::vector<aura::Window*>());
|
| - } else if (window_state->IsNormalShowState()) {
|
| - window_resizer = DefaultWindowResizer::Create(
|
| - window, point_in_parent, window_component, source);
|
| + } else {
|
| + window_resizer = DefaultWindowResizer::Create(window_state);
|
| }
|
| if (window_resizer) {
|
| - window_resizer = internal::DragWindowResizer::Create(
|
| - window_resizer, window, point_in_parent, window_component, source);
|
| - }
|
| - if (window_resizer && window->type() == ui::wm::WINDOW_TYPE_PANEL) {
|
| - window_resizer = PanelWindowResizer::Create(
|
| - window_resizer, window, point_in_parent, window_component, source);
|
| + window_resizer = internal::DragWindowResizer::Create(window_resizer,
|
| + window_state);
|
| }
|
| + if (window_resizer && window->type() == ui::wm::WINDOW_TYPE_PANEL)
|
| + window_resizer = PanelWindowResizer::Create(window_resizer, window_state);
|
| if (switches::UseDockedWindows() &&
|
| window_resizer && window->parent() &&
|
| !views::corewm::GetTransientParent(window) &&
|
| (window->parent()->id() == internal::kShellWindowId_DefaultContainer ||
|
| window->parent()->id() == internal::kShellWindowId_DockedContainer ||
|
| window->parent()->id() == internal::kShellWindowId_PanelContainer)) {
|
| - window_resizer = internal::DockedWindowResizer::Create(
|
| - window_resizer, window, point_in_parent, window_component, source);
|
| + window_resizer = internal::DockedWindowResizer::Create(window_resizer,
|
| + window_state);
|
| }
|
| - window_state->set_window_resizer_(window_resizer);
|
| + window_state->drag_details()->window_resizer = window_resizer;
|
| return make_scoped_ptr<WindowResizer>(window_resizer);
|
| }
|
|
|
| @@ -355,14 +360,9 @@ WorkspaceWindowResizer::~WorkspaceWindowResizer() {
|
|
|
| // static
|
| WorkspaceWindowResizer* WorkspaceWindowResizer::Create(
|
| - aura::Window* window,
|
| - const gfx::Point& location_in_parent,
|
| - int window_component,
|
| - aura::client::WindowMoveSource source,
|
| + wm::WindowState* window_state,
|
| const std::vector<aura::Window*>& attached_windows) {
|
| - Details details(window, location_in_parent, window_component, source);
|
| - return details.is_resizable ?
|
| - new WorkspaceWindowResizer(details, attached_windows) : NULL;
|
| + return new WorkspaceWindowResizer(window_state, attached_windows);
|
| }
|
|
|
| void WorkspaceWindowResizer::Drag(const gfx::Point& location_in_parent,
|
| @@ -375,20 +375,20 @@ void WorkspaceWindowResizer::Drag(const gfx::Point& location_in_parent,
|
| } else if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| switches::kAshEnableStickyEdges)) {
|
| sticky_size = kStickyDistancePixels;
|
| - } else if ((details_.bounds_change & kBoundsChange_Resizes) &&
|
| - details_.source == aura::client::WINDOW_MOVE_SOURCE_TOUCH) {
|
| + } else if ((details().bounds_change & kBoundsChange_Resizes) &&
|
| + details().source == aura::client::WINDOW_MOVE_SOURCE_TOUCH) {
|
| sticky_size = kScreenEdgeInsetForTouchResize;
|
| } else {
|
| sticky_size = kScreenEdgeInset;
|
| }
|
| - // |bounds| is in |window()->parent()|'s coordinates.
|
| - gfx::Rect bounds = CalculateBoundsForDrag(details_, location_in_parent);
|
| + // |bounds| is in |GetTarget()->parent()|'s coordinates.
|
| + gfx::Rect bounds = CalculateBoundsForDrag(location_in_parent);
|
| if (window_state()->IsNormalShowState())
|
| AdjustBoundsForMainWindow(sticky_size, &bounds);
|
|
|
| - if (bounds != window()->bounds()) {
|
| + if (bounds != GetTarget()->bounds()) {
|
| if (!did_move_or_resize_) {
|
| - if (!details_.restore_bounds.IsEmpty())
|
| + if (!details().restore_bounds.IsEmpty())
|
| window_state()->ClearRestoreBounds();
|
| RestackWindows();
|
| }
|
| @@ -396,7 +396,7 @@ void WorkspaceWindowResizer::Drag(const gfx::Point& location_in_parent,
|
| }
|
|
|
| gfx::Point location_in_screen = location_in_parent;
|
| - wm::ConvertPointToScreen(window()->parent(), &location_in_screen);
|
| + wm::ConvertPointToScreen(GetTarget()->parent(), &location_in_screen);
|
|
|
| aura::Window* root = NULL;
|
| gfx::Display display =
|
| @@ -409,17 +409,17 @@ void WorkspaceWindowResizer::Drag(const gfx::Point& location_in_parent,
|
| }
|
| if (!attached_windows_.empty())
|
| LayoutAttachedWindows(&bounds);
|
| - if (bounds != window()->bounds()) {
|
| + if (bounds != GetTarget()->bounds()) {
|
| // SetBounds needs to be called to update the layout which affects where the
|
| // phantom window is drawn. Keep track if the window was destroyed during
|
| // the drag and quit early if so.
|
| base::WeakPtr<WorkspaceWindowResizer> resizer(
|
| weak_ptr_factory_.GetWeakPtr());
|
| - window()->SetBounds(bounds);
|
| + GetTarget()->SetBounds(bounds);
|
| if (!resizer)
|
| return;
|
| }
|
| - const bool in_original_root = !root || root == window()->GetRootWindow();
|
| + const bool in_original_root = !root || root == GetTarget()->GetRootWindow();
|
| // Hide a phantom window for snapping if the cursor is in another root window.
|
| if (in_original_root) {
|
| UpdateSnapPhantomWindow(location_in_parent, bounds);
|
| @@ -434,7 +434,7 @@ void WorkspaceWindowResizer::Drag(const gfx::Point& location_in_parent,
|
| void WorkspaceWindowResizer::CompleteDrag() {
|
| window_state()->set_bounds_changed_by_user(true);
|
| snap_phantom_window_controller_.reset();
|
| - if (!did_move_or_resize_ || details_.window_component != HTCAPTION)
|
| + if (!did_move_or_resize_ || details().window_component != HTCAPTION)
|
| return;
|
|
|
| bool snapped = false;
|
| @@ -444,17 +444,17 @@ void WorkspaceWindowResizer::CompleteDrag() {
|
| // out of a maximized window, it's already in the normal show state when this
|
| // is called, so it does not matter.
|
| if (window_state()->IsNormalShowState() &&
|
| - (window()->type() != ui::wm::WINDOW_TYPE_PANEL ||
|
| + (GetTarget()->type() != ui::wm::WINDOW_TYPE_PANEL ||
|
| !window_state()->panel_attached() ||
|
| dock_layout_->is_dragged_window_docked()) &&
|
| (snap_type_ == SNAP_LEFT || snap_type_ == SNAP_RIGHT)) {
|
| if (!window_state()->HasRestoreBounds()) {
|
| gfx::Rect initial_bounds = ScreenAsh::ConvertRectToScreen(
|
| - window()->parent(), details_.initial_bounds_in_parent);
|
| + GetTarget()->parent(), details().initial_bounds_in_parent);
|
| window_state()->SetRestoreBoundsInScreen(
|
| - details_.restore_bounds.IsEmpty() ?
|
| + details().restore_bounds.IsEmpty() ?
|
| initial_bounds :
|
| - details_.restore_bounds);
|
| + details().restore_bounds);
|
| }
|
| DCHECK(snap_sizer_);
|
| if (window_state()->CanResize() &&
|
| @@ -474,13 +474,13 @@ void WorkspaceWindowResizer::RevertDrag() {
|
| if (!did_move_or_resize_)
|
| return;
|
|
|
| - window()->SetBounds(details_.initial_bounds_in_parent);
|
| - if (!details_.restore_bounds.IsEmpty()) {
|
| - window_state()->SetRestoreBoundsInScreen(details_.restore_bounds);
|
| + GetTarget()->SetBounds(details().initial_bounds_in_parent);
|
| + if (!details().restore_bounds.IsEmpty()) {
|
| + window_state()->SetRestoreBoundsInScreen(details().restore_bounds);
|
| }
|
|
|
| - if (details_.window_component == HTRIGHT) {
|
| - int last_x = details_.initial_bounds_in_parent.right();
|
| + if (details().window_component == HTRIGHT) {
|
| + int last_x = details().initial_bounds_in_parent.right();
|
| for (size_t i = 0; i < attached_windows_.size(); ++i) {
|
| gfx::Rect bounds(attached_windows_[i]->bounds());
|
| bounds.set_x(last_x);
|
| @@ -489,7 +489,7 @@ void WorkspaceWindowResizer::RevertDrag() {
|
| last_x = attached_windows_[i]->bounds().right();
|
| }
|
| } else {
|
| - int last_y = details_.initial_bounds_in_parent.bottom();
|
| + int last_y = details().initial_bounds_in_parent.bottom();
|
| for (size_t i = 0; i < attached_windows_.size(); ++i) {
|
| gfx::Rect bounds(attached_windows_[i]->bounds());
|
| bounds.set_y(last_y);
|
| @@ -500,48 +500,39 @@ void WorkspaceWindowResizer::RevertDrag() {
|
| }
|
| }
|
|
|
| -aura::Window* WorkspaceWindowResizer::GetTarget() {
|
| - return details_.window;
|
| -}
|
| -
|
| -const gfx::Point& WorkspaceWindowResizer::GetInitialLocation() const {
|
| - return details_.initial_location_in_parent;
|
| -}
|
| -
|
| WorkspaceWindowResizer::WorkspaceWindowResizer(
|
| - const Details& details,
|
| + wm::WindowState* window_state,
|
| const std::vector<aura::Window*>& attached_windows)
|
| - : details_(details),
|
| + : WindowResizer(window_state),
|
| attached_windows_(attached_windows),
|
| did_lock_cursor_(false),
|
| did_move_or_resize_(false),
|
| - initial_bounds_changed_by_user_(
|
| - details.window_state->bounds_changed_by_user()),
|
| + initial_bounds_changed_by_user_(window_state_->bounds_changed_by_user()),
|
| total_min_(0),
|
| total_initial_size_(0),
|
| snap_type_(SNAP_NONE),
|
| num_mouse_moves_since_bounds_change_(0),
|
| magnetism_window_(NULL),
|
| weak_ptr_factory_(this) {
|
| - DCHECK(details_.is_resizable);
|
| + DCHECK(details().is_resizable);
|
|
|
| // A mousemove should still show the cursor even if the window is
|
| // being moved or resized with touch, so do not lock the cursor.
|
| - if (details.source != aura::client::WINDOW_MOVE_SOURCE_TOUCH) {
|
| + if (details().source != aura::client::WINDOW_MOVE_SOURCE_TOUCH) {
|
| Shell* shell = Shell::GetInstance();
|
| shell->cursor_manager()->LockCursor();
|
| did_lock_cursor_ = true;
|
| }
|
|
|
| aura::Window* dock_container = Shell::GetContainer(
|
| - window()->GetRootWindow(), kShellWindowId_DockedContainer);
|
| + GetTarget()->GetRootWindow(), kShellWindowId_DockedContainer);
|
| dock_layout_ = static_cast<DockedWindowLayoutManager*>(
|
| dock_container->layout_manager());
|
|
|
| // Only support attaching to the right/bottom.
|
| DCHECK(attached_windows_.empty() ||
|
| - (details.window_component == HTRIGHT ||
|
| - details.window_component == HTBOTTOM));
|
| + (details().window_component == HTRIGHT ||
|
| + details().window_component == HTBOTTOM));
|
|
|
| // TODO: figure out how to deal with window going off the edge.
|
|
|
| @@ -573,8 +564,8 @@ gfx::Rect WorkspaceWindowResizer::GetFinalBounds(
|
|
|
| void WorkspaceWindowResizer::LayoutAttachedWindows(
|
| gfx::Rect* bounds) {
|
| - gfx::Rect work_area(ScreenAsh::GetDisplayWorkAreaBoundsInParent(window()));
|
| - int initial_size = PrimaryAxisSize(details_.initial_bounds_in_parent.size());
|
| + gfx::Rect work_area(ScreenAsh::GetDisplayWorkAreaBoundsInParent(GetTarget()));
|
| + int initial_size = PrimaryAxisSize(details().initial_bounds_in_parent.size());
|
| int current_size = PrimaryAxisSize(bounds->size());
|
| int start = PrimaryAxisCoordinate(bounds->right(), bounds->bottom());
|
| int end = PrimaryAxisCoordinate(work_area.right(), work_area.bottom());
|
| @@ -594,7 +585,7 @@ void WorkspaceWindowResizer::LayoutAttachedWindows(
|
| // attached windows can grow without exceeding their max size constraints.
|
| // Adding the pixels back to the main window effectively prevents the main
|
| // window from resizing too far.
|
| - if (details_.window_component == HTRIGHT)
|
| + if (details().window_component == HTRIGHT)
|
| bounds->set_width(bounds->width() + leftovers);
|
| else
|
| bounds->set_height(bounds->height() + leftovers);
|
| @@ -603,7 +594,7 @@ void WorkspaceWindowResizer::LayoutAttachedWindows(
|
| int last = PrimaryAxisCoordinate(bounds->right(), bounds->bottom());
|
| for (size_t i = 0; i < attached_windows_.size(); ++i) {
|
| gfx::Rect attached_bounds(attached_windows_[i]->bounds());
|
| - if (details_.window_component == HTRIGHT) {
|
| + if (details().window_component == HTRIGHT) {
|
| attached_bounds.set_x(last);
|
| attached_bounds.set_width(sizes[i]);
|
| } else {
|
| @@ -713,23 +704,24 @@ void WorkspaceWindowResizer::CreateBucketsForAttached(
|
| void WorkspaceWindowResizer::MagneticallySnapToOtherWindows(gfx::Rect* bounds) {
|
| if (UpdateMagnetismWindow(*bounds, kAllMagnetismEdges)) {
|
| gfx::Point point = OriginForMagneticAttach(
|
| - ScreenAsh::ConvertRectToScreen(window()->parent(), *bounds),
|
| + ScreenAsh::ConvertRectToScreen(GetTarget()->parent(), *bounds),
|
| magnetism_window_->GetBoundsInScreen(),
|
| magnetism_edge_);
|
| - aura::client::GetScreenPositionClient(window()->GetRootWindow())->
|
| - ConvertPointFromScreen(window()->parent(), &point);
|
| + aura::client::GetScreenPositionClient(GetTarget()->GetRootWindow())->
|
| + ConvertPointFromScreen(GetTarget()->parent(), &point);
|
| bounds->set_origin(point);
|
| }
|
| }
|
|
|
| void WorkspaceWindowResizer::MagneticallySnapResizeToOtherWindows(
|
| gfx::Rect* bounds) {
|
| - const uint32 edges = WindowComponentToMagneticEdge(details_.window_component);
|
| + const uint32 edges = WindowComponentToMagneticEdge(
|
| + details().window_component);
|
| if (UpdateMagnetismWindow(*bounds, edges)) {
|
| *bounds = ScreenAsh::ConvertRectFromScreen(
|
| - window()->parent(),
|
| + GetTarget()->parent(),
|
| BoundsForMagneticResizeAttach(
|
| - ScreenAsh::ConvertRectToScreen(window()->parent(), *bounds),
|
| + ScreenAsh::ConvertRectToScreen(GetTarget()->parent(), *bounds),
|
| magnetism_window_->GetBoundsInScreen(),
|
| magnetism_edge_));
|
| }
|
| @@ -739,7 +731,7 @@ bool WorkspaceWindowResizer::UpdateMagnetismWindow(const gfx::Rect& bounds,
|
| uint32 edges) {
|
| // |bounds| are in coordinates of original window's parent.
|
| gfx::Rect bounds_in_screen =
|
| - ScreenAsh::ConvertRectToScreen(window()->parent(), bounds);
|
| + ScreenAsh::ConvertRectToScreen(GetTarget()->parent(), bounds);
|
| MagnetismMatcher matcher(bounds_in_screen, edges);
|
|
|
| // If we snapped to a window then check it first. That way we don't bounce
|
| @@ -769,7 +761,7 @@ bool WorkspaceWindowResizer::UpdateMagnetismWindow(const gfx::Rect& bounds,
|
| for (aura::Window::Windows::const_reverse_iterator i = children.rbegin();
|
| i != children.rend() && !matcher.AreEdgesObscured(); ++i) {
|
| wm::WindowState* other_state = wm::GetWindowState(*i);
|
| - if (other_state->window() == window() ||
|
| + if (other_state->window() == GetTarget() ||
|
| !other_state->window()->IsVisible() ||
|
| !other_state->IsNormalShowState() ||
|
| !other_state->CanResize()) {
|
| @@ -790,12 +782,14 @@ void WorkspaceWindowResizer::AdjustBoundsForMainWindow(
|
| int sticky_size,
|
| gfx::Rect* bounds) {
|
| gfx::Point last_mouse_location_in_screen = last_mouse_location_;
|
| - wm::ConvertPointToScreen(window()->parent(), &last_mouse_location_in_screen);
|
| + wm::ConvertPointToScreen(GetTarget()->parent(),
|
| + &last_mouse_location_in_screen);
|
| gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint(
|
| last_mouse_location_in_screen);
|
| gfx::Rect work_area =
|
| - ScreenAsh::ConvertRectFromScreen(window()->parent(), display.work_area());
|
| - if (details_.window_component == HTCAPTION) {
|
| + ScreenAsh::ConvertRectFromScreen(GetTarget()->parent(),
|
| + display.work_area());
|
| + if (details().window_component == HTCAPTION) {
|
| // Adjust the bounds to the work area where the mouse cursor is located.
|
| // Always keep kMinOnscreenHeight or the window height (whichever is less)
|
| // on the bottom.
|
| @@ -826,11 +820,11 @@ void WorkspaceWindowResizer::AdjustBoundsForMainWindow(
|
| if (attached_windows_.empty())
|
| return;
|
|
|
| - if (details_.window_component == HTRIGHT) {
|
| + if (details().window_component == HTRIGHT) {
|
| bounds->set_width(std::min(bounds->width(),
|
| work_area.right() - total_min_ - bounds->x()));
|
| } else {
|
| - DCHECK_EQ(HTBOTTOM, details_.window_component);
|
| + DCHECK_EQ(HTBOTTOM, details().window_component);
|
| bounds->set_height(std::min(bounds->height(),
|
| work_area.bottom() - total_min_ - bounds->y()));
|
| }
|
| @@ -870,7 +864,8 @@ void WorkspaceWindowResizer::StickToWorkAreaOnResize(
|
| const gfx::Rect& work_area,
|
| int sticky_size,
|
| gfx::Rect* bounds) const {
|
| - const uint32 edges = WindowComponentToMagneticEdge(details_.window_component);
|
| + const uint32 edges = WindowComponentToMagneticEdge(
|
| + details().window_component);
|
| const int left_edge = work_area.x();
|
| const int right_edge = work_area.right();
|
| const int top_edge = work_area.y();
|
| @@ -900,7 +895,7 @@ int WorkspaceWindowResizer::PrimaryAxisSize(const gfx::Size& size) const {
|
| }
|
|
|
| int WorkspaceWindowResizer::PrimaryAxisCoordinate(int x, int y) const {
|
| - switch (details_.window_component) {
|
| + switch (details().window_component) {
|
| case HTRIGHT:
|
| return x;
|
| case HTBOTTOM:
|
| @@ -913,7 +908,7 @@ int WorkspaceWindowResizer::PrimaryAxisCoordinate(int x, int y) const {
|
|
|
| void WorkspaceWindowResizer::UpdateSnapPhantomWindow(const gfx::Point& location,
|
| const gfx::Rect& bounds) {
|
| - if (!did_move_or_resize_ || details_.window_component != HTCAPTION)
|
| + if (!did_move_or_resize_ || details().window_component != HTCAPTION)
|
| return;
|
|
|
| SnapType last_type = snap_type_;
|
| @@ -926,7 +921,7 @@ void WorkspaceWindowResizer::UpdateSnapPhantomWindow(const gfx::Point& location,
|
| return;
|
| }
|
| }
|
| - const bool can_dock = dock_layout_->CanDockWindow(window(), snap_type_);
|
| + const bool can_dock = dock_layout_->CanDockWindow(GetTarget(), snap_type_);
|
| const bool can_snap = window_state()->CanSnap();
|
| if (!can_snap && !can_dock) {
|
| snap_type_ = SNAP_NONE;
|
| @@ -950,10 +945,10 @@ void WorkspaceWindowResizer::UpdateSnapPhantomWindow(const gfx::Point& location,
|
| // Windows that cannot be snapped or are less wide than kMaxDockWidth can get
|
| // docked without going through a snapping sequence.
|
| gfx::Rect phantom_bounds;
|
| - if (can_snap &&
|
| - (!can_dock ||
|
| - window()->bounds().width() > DockedWindowLayoutManager::kMaxDockWidth))
|
| + if (can_snap && (!can_dock || GetTarget()->bounds().width() >
|
| + DockedWindowLayoutManager::kMaxDockWidth)) {
|
| phantom_bounds = snap_sizer_->target_bounds();
|
| + }
|
| const bool should_dock = can_dock &&
|
| (phantom_bounds.IsEmpty() ||
|
| snap_sizer_->end_of_sequence() ||
|
| @@ -962,7 +957,7 @@ void WorkspaceWindowResizer::UpdateSnapPhantomWindow(const gfx::Point& location,
|
| snap_type_ = GetSnapType(location);
|
| if (dock_layout_->is_dragged_window_docked()) {
|
| phantom_bounds = ScreenAsh::ConvertRectFromScreen(
|
| - window()->parent(), dock_layout_->dragged_bounds());
|
| + GetTarget()->parent(), dock_layout_->dragged_bounds());
|
| }
|
|
|
| if (phantom_bounds.IsEmpty()) {
|
| @@ -972,10 +967,10 @@ void WorkspaceWindowResizer::UpdateSnapPhantomWindow(const gfx::Point& location,
|
|
|
| if (!snap_phantom_window_controller_) {
|
| snap_phantom_window_controller_.reset(
|
| - new PhantomWindowController(window()));
|
| + new PhantomWindowController(GetTarget()));
|
| }
|
| snap_phantom_window_controller_->Show(ScreenAsh::ConvertRectToScreen(
|
| - window()->parent(), phantom_bounds));
|
| + GetTarget()->parent(), phantom_bounds));
|
| }
|
|
|
| void WorkspaceWindowResizer::RestackWindows() {
|
| @@ -985,10 +980,10 @@ void WorkspaceWindowResizer::RestackWindows() {
|
| // window with a different parent.
|
| typedef std::map<size_t, aura::Window*> IndexToWindowMap;
|
| IndexToWindowMap map;
|
| - aura::Window* parent = window()->parent();
|
| + aura::Window* parent = GetTarget()->parent();
|
| const aura::Window::Windows& windows(parent->children());
|
| - map[std::find(windows.begin(), windows.end(), window()) -
|
| - windows.begin()] = window();
|
| + map[std::find(windows.begin(), windows.end(), GetTarget()) -
|
| + windows.begin()] = GetTarget();
|
| for (std::vector<aura::Window*>::const_iterator i =
|
| attached_windows_.begin(); i != attached_windows_.end(); ++i) {
|
| if ((*i)->parent() != parent)
|
| @@ -1013,11 +1008,11 @@ SnapType WorkspaceWindowResizer::GetSnapType(
|
| const gfx::Point& location) const {
|
| // TODO: this likely only wants total display area, not the area of a single
|
| // display.
|
| - gfx::Rect area(ScreenAsh::GetDisplayWorkAreaBoundsInParent(window()));
|
| - if (details_.source == aura::client::WINDOW_MOVE_SOURCE_TOUCH) {
|
| + gfx::Rect area(ScreenAsh::GetDisplayWorkAreaBoundsInParent(GetTarget()));
|
| + if (details().source == aura::client::WINDOW_MOVE_SOURCE_TOUCH) {
|
| // Increase tolerance for touch-snapping near the screen edges. This is only
|
| // necessary when the work area left or right edge is same as screen edge.
|
| - gfx::Rect display_bounds(ScreenAsh::GetDisplayBoundsInParent(window()));
|
| + gfx::Rect display_bounds(ScreenAsh::GetDisplayBoundsInParent(GetTarget()));
|
| int inset_left = 0;
|
| if (area.x() == display_bounds.x())
|
| inset_left = kScreenEdgeInsetForTouchResize;
|
| @@ -1035,10 +1030,11 @@ SnapType WorkspaceWindowResizer::GetSnapType(
|
|
|
| void WorkspaceWindowResizer::SetDraggedWindowDocked(bool should_dock) {
|
| if (should_dock &&
|
| - dock_layout_->GetAlignmentOfWindow(window()) != DOCKED_ALIGNMENT_NONE) {
|
| + dock_layout_->GetAlignmentOfWindow(GetTarget()) !=
|
| + DOCKED_ALIGNMENT_NONE) {
|
| if (!dock_layout_->is_dragged_window_docked()) {
|
| window_state()->set_bounds_changed_by_user(false);
|
| - dock_layout_->DockDraggedWindow(window());
|
| + dock_layout_->DockDraggedWindow(GetTarget());
|
| }
|
| } else {
|
| if (dock_layout_->is_dragged_window_docked()) {
|
|
|