OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/workspace/workspace_window_resizer.h" | 5 #include "ash/wm/workspace/workspace_window_resizer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 if (i != map.rend()) | 991 if (i != map.rend()) |
992 parent->StackChildBelow(i->second, window); | 992 parent->StackChildBelow(i->second, window); |
993 } | 993 } |
994 } | 994 } |
995 | 995 |
996 SnapType WorkspaceWindowResizer::GetSnapType( | 996 SnapType WorkspaceWindowResizer::GetSnapType( |
997 const gfx::Point& location) const { | 997 const gfx::Point& location) const { |
998 // TODO: this likely only wants total display area, not the area of a single | 998 // TODO: this likely only wants total display area, not the area of a single |
999 // display. | 999 // display. |
1000 gfx::Rect area(ScreenAsh::GetDisplayWorkAreaBoundsInParent(window())); | 1000 gfx::Rect area(ScreenAsh::GetDisplayWorkAreaBoundsInParent(window())); |
| 1001 if (details_.source == aura::client::WINDOW_MOVE_SOURCE_TOUCH) { |
| 1002 // Increase tolerance for touch-snapping near the screen edges. This is only |
| 1003 // necessary when the work area left or right edge is same as screen edge. |
| 1004 gfx::Rect display_bounds(ScreenAsh::GetDisplayBoundsInParent(window())); |
| 1005 int inset_left = 0; |
| 1006 if (area.x() == display_bounds.x()) |
| 1007 inset_left = kScreenEdgeInsetForTouchResize; |
| 1008 int inset_right = 0; |
| 1009 if (area.right() == display_bounds.right()) |
| 1010 inset_right = kScreenEdgeInsetForTouchResize; |
| 1011 area.Inset(inset_left, 0, inset_right, 0); |
| 1012 } |
1001 if (location.x() <= area.x()) | 1013 if (location.x() <= area.x()) |
1002 return SNAP_LEFT; | 1014 return SNAP_LEFT; |
1003 if (location.x() >= area.right() - 1) | 1015 if (location.x() >= area.right() - 1) |
1004 return SNAP_RIGHT; | 1016 return SNAP_RIGHT; |
1005 return SNAP_NONE; | 1017 return SNAP_NONE; |
1006 } | 1018 } |
1007 | 1019 |
1008 void WorkspaceWindowResizer::SetDraggedWindowDocked(bool should_dock) { | 1020 void WorkspaceWindowResizer::SetDraggedWindowDocked(bool should_dock) { |
1009 if (should_dock && | 1021 if (should_dock && |
1010 dock_layout_->GetAlignmentOfWindow(window()) != DOCKED_ALIGNMENT_NONE) { | 1022 dock_layout_->GetAlignmentOfWindow(window()) != DOCKED_ALIGNMENT_NONE) { |
1011 if (!dock_layout_->is_dragged_window_docked()) | 1023 if (!dock_layout_->is_dragged_window_docked()) |
1012 dock_layout_->DockDraggedWindow(window()); | 1024 dock_layout_->DockDraggedWindow(window()); |
1013 } else { | 1025 } else { |
1014 if (dock_layout_->is_dragged_window_docked()) | 1026 if (dock_layout_->is_dragged_window_docked()) |
1015 dock_layout_->UndockDraggedWindow(); | 1027 dock_layout_->UndockDraggedWindow(); |
1016 } | 1028 } |
1017 } | 1029 } |
1018 | 1030 |
1019 } // namespace internal | 1031 } // namespace internal |
1020 } // namespace ash | 1032 } // namespace ash |
OLD | NEW |