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/window_resizer.h" | 5 #include "ash/wm/window_resizer.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/root_window_event_filter.h" | 8 #include "ash/wm/root_window_event_filter.h" |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/root_window.h" | 10 #include "ui/aura/root_window.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 return (location / grid_size + 1) * grid_size; | 99 return (location / grid_size + 1) * grid_size; |
100 } | 100 } |
101 | 101 |
102 gfx::Point ConvertPointToParent(aura::Window* window, | 102 gfx::Point ConvertPointToParent(aura::Window* window, |
103 const gfx::Point& point) { | 103 const gfx::Point& point) { |
104 gfx::Point result(point); | 104 gfx::Point result(point); |
105 aura::Window::ConvertPointToWindow(window, window->parent(), &result); | 105 aura::Window::ConvertPointToWindow(window, window->parent(), &result); |
106 return result; | 106 return result; |
107 } | 107 } |
108 | 108 |
| 109 bool IsNormalWindow(aura::Window* window) { |
| 110 return window->GetProperty(aura::client::kShowStateKey) == |
| 111 ui::SHOW_STATE_NORMAL || |
| 112 window->GetProperty(aura::client::kShowStateKey) == |
| 113 ui::SHOW_STATE_DEFAULT; |
| 114 } |
| 115 |
109 } // namespace | 116 } // namespace |
110 | 117 |
111 // static | 118 // static |
112 const int WindowResizer::kBoundsChange_None = 0; | 119 const int WindowResizer::kBoundsChange_None = 0; |
113 // static | 120 // static |
114 const int WindowResizer::kBoundsChange_Repositions = 1; | 121 const int WindowResizer::kBoundsChange_Repositions = 1; |
115 // static | 122 // static |
116 const int WindowResizer::kBoundsChange_Resizes = 2; | 123 const int WindowResizer::kBoundsChange_Resizes = 2; |
117 | 124 |
118 // static | 125 // static |
119 const int WindowResizer::kBoundsChangeDirection_None = 0; | 126 const int WindowResizer::kBoundsChangeDirection_None = 0; |
120 // static | 127 // static |
121 const int WindowResizer::kBoundsChangeDirection_Horizontal = 1; | 128 const int WindowResizer::kBoundsChangeDirection_Horizontal = 1; |
122 // static | 129 // static |
123 const int WindowResizer::kBoundsChangeDirection_Vertical = 2; | 130 const int WindowResizer::kBoundsChangeDirection_Vertical = 2; |
124 | 131 |
125 WindowResizer::WindowResizer(aura::Window* window, | 132 WindowResizer::WindowResizer(aura::Window* window, |
126 const gfx::Point& location, | 133 const gfx::Point& location, |
127 int window_component, | 134 int window_component, |
128 int grid_size) | 135 int grid_size) |
129 : window_(window), | 136 : window_(window), |
130 initial_bounds_(window->bounds()), | 137 initial_bounds_(window->bounds()), |
131 initial_location_in_parent_(ConvertPointToParent(window, location)), | 138 initial_location_in_parent_(ConvertPointToParent(window, location)), |
132 window_component_(window_component), | 139 window_component_(window_component), |
133 bounds_change_(GetBoundsChangeForWindowComponent(window_component_)), | 140 bounds_change_(GetBoundsChangeForWindowComponent(window_component_)), |
134 position_change_direction_( | 141 position_change_direction_( |
135 GetPositionChangeDirectionForWindowComponent(window_component_)), | 142 GetPositionChangeDirectionForWindowComponent(window_component_)), |
136 size_change_direction_( | 143 size_change_direction_( |
137 GetSizeChangeDirectionForWindowComponent(window_component_)), | 144 GetSizeChangeDirectionForWindowComponent(window_component_)), |
138 is_resizable_(bounds_change_ != kBoundsChangeDirection_None), | 145 is_resizable_(bounds_change_ != kBoundsChangeDirection_None && |
| 146 IsNormalWindow(window)), |
139 grid_size_(grid_size), | 147 grid_size_(grid_size), |
140 did_move_or_resize_(false), | 148 did_move_or_resize_(false), |
141 root_filter_(NULL) { | 149 root_filter_(NULL) { |
142 if (is_resizable_) { | 150 if (is_resizable_) { |
143 root_filter_ = Shell::GetInstance()->root_filter(); | 151 root_filter_ = Shell::GetInstance()->root_filter(); |
144 if (root_filter_) | 152 if (root_filter_) |
145 root_filter_->LockCursor(); | 153 root_filter_->LockCursor(); |
146 } | 154 } |
147 } | 155 } |
148 | 156 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 int max_height = gfx::Screen::GetMonitorAreaNearestWindow(window_).height(); | 355 int max_height = gfx::Screen::GetMonitorAreaNearestWindow(window_).height(); |
348 if (height > max_height) { | 356 if (height > max_height) { |
349 height = max_height; | 357 height = max_height; |
350 *delta_y = -y_multiplier * (initial_bounds_.height() - max_height); | 358 *delta_y = -y_multiplier * (initial_bounds_.height() - max_height); |
351 } | 359 } |
352 } | 360 } |
353 return height; | 361 return height; |
354 } | 362 } |
355 | 363 |
356 } // namespace aura | 364 } // namespace aura |
OLD | NEW |