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_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
6 | 6 |
7 #include <algorithm> | |
jonross
2014/06/16 18:50:58
cpplint
| |
8 | |
7 #include "ash/display/display_controller.h" | 9 #include "ash/display/display_controller.h" |
8 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
9 #include "ash/screen_util.h" | 11 #include "ash/screen_util.h" |
10 #include "ash/session/session_state_delegate.h" | 12 #include "ash/session/session_state_delegate.h" |
11 #include "ash/shelf/shelf_layout_manager.h" | 13 #include "ash/shelf/shelf_layout_manager.h" |
12 #include "ash/shell.h" | 14 #include "ash/shell.h" |
13 #include "ash/wm/always_on_top_controller.h" | 15 #include "ash/wm/always_on_top_controller.h" |
14 #include "ash/wm/window_animations.h" | 16 #include "ash/wm/window_animations.h" |
15 #include "ash/wm/window_positioner.h" | 17 #include "ash/wm/window_positioner.h" |
16 #include "ash/wm/window_properties.h" | 18 #include "ash/wm/window_properties.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 | 130 |
129 ////////////////////////////////////////////////////////////////////////////// | 131 ////////////////////////////////////////////////////////////////////////////// |
130 // WorkspaceLayoutManager, keyboard::KeyboardControllerObserver implementation: | 132 // WorkspaceLayoutManager, keyboard::KeyboardControllerObserver implementation: |
131 | 133 |
132 void WorkspaceLayoutManager::OnKeyboardBoundsChanging( | 134 void WorkspaceLayoutManager::OnKeyboardBoundsChanging( |
133 const gfx::Rect& new_bounds) { | 135 const gfx::Rect& new_bounds) { |
134 aura::Window* root_window = window_->GetRootWindow(); | 136 aura::Window* root_window = window_->GetRootWindow(); |
135 ui::InputMethod* input_method = | 137 ui::InputMethod* input_method = |
136 root_window->GetProperty(aura::client::kRootWindowInputMethodKey); | 138 root_window->GetProperty(aura::client::kRootWindowInputMethodKey); |
137 ui::TextInputClient* text_input_client = input_method->GetTextInputClient(); | 139 ui::TextInputClient* text_input_client = input_method->GetTextInputClient(); |
138 if(!text_input_client) | 140 if (!text_input_client) |
jonross
2014/06/16 18:50:58
cpplint
| |
139 return; | 141 return; |
140 aura::Window *window = text_input_client->GetAttachedWindow(); | 142 aura::Window *window = text_input_client->GetAttachedWindow(); |
141 if (!window || !window_->Contains(window)) | 143 if (!window || !window_->Contains(window)) |
142 return; | 144 return; |
143 gfx::Rect window_bounds = ScreenUtil::ConvertRectToScreen( | 145 gfx::Rect window_bounds = ScreenUtil::ConvertRectToScreen( |
144 window_, | 146 window_, |
145 window->GetTargetBounds()); | 147 window->GetTargetBounds()); |
146 gfx::Rect intersect = gfx::IntersectRects(window_bounds, new_bounds); | 148 gfx::Rect intersect = gfx::IntersectRects(window_bounds, new_bounds); |
147 int shift = std::min(intersect.height(), | 149 int shift = std::min(intersect.height(), |
148 window->bounds().y() - work_area_in_parent_.y()); | 150 window->bounds().y() - work_area_in_parent_.y()); |
149 if (shift > 0) { | 151 if (shift > 0) { |
150 gfx::Point origin(window->bounds().x(), window->bounds().y() - shift); | 152 gfx::Point origin(window->bounds().x(), window->bounds().y() - shift); |
151 SetChildBounds(window, gfx::Rect(origin, window->bounds().size())); | 153 SetChildBounds(window, gfx::Rect(origin, window->bounds().size())); |
152 } | 154 } |
153 } | 155 } |
154 | 156 |
155 ////////////////////////////////////////////////////////////////////////////// | 157 ////////////////////////////////////////////////////////////////////////////// |
156 // WorkspaceLayoutManager, ash::ShellObserver implementation: | 158 // WorkspaceLayoutManager, ash::ShellObserver implementation: |
157 | 159 |
158 void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() { | 160 void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() { |
159 const gfx::Rect work_area(ScreenUtil::ConvertRectFromScreen( | 161 const gfx::Rect work_area(ScreenUtil::ConvertRectFromScreen( |
160 window_, | 162 window_, |
161 Shell::GetScreen()->GetDisplayNearestWindow(window_).work_area())); | 163 Shell::GetScreen()->GetDisplayNearestWindow(window_).work_area())); |
162 if (work_area != work_area_in_parent_) { | 164 if (work_area != work_area_in_parent_) { |
163 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); | 165 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); |
164 AdjustAllWindowsBoundsForWorkAreaChange(&event); | 166 AdjustAllWindowsBoundsForWorkAreaChange(&event); |
165 } | 167 } |
168 if (backdrop_delegate_) | |
169 backdrop_delegate_->OnDisplayWorkAreaInsetsChanged(); | |
166 } | 170 } |
167 | 171 |
168 ////////////////////////////////////////////////////////////////////////////// | 172 ////////////////////////////////////////////////////////////////////////////// |
169 // WorkspaceLayoutManager, aura::WindowObserver implementation: | 173 // WorkspaceLayoutManager, aura::WindowObserver implementation: |
170 | 174 |
171 void WorkspaceLayoutManager::OnWindowHierarchyChanged( | 175 void WorkspaceLayoutManager::OnWindowHierarchyChanged( |
172 const WindowObserver::HierarchyChangeParams& params) { | 176 const WindowObserver::HierarchyChangeParams& params) { |
173 if (!wm::GetWindowState(params.target)->IsActive()) | 177 if (!wm::GetWindowState(params.target)->IsActive()) |
174 return; | 178 return; |
175 // If the window is already tracked by the workspace this update would be | 179 // If the window is already tracked by the workspace this update would be |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
302 bool is_fullscreen = GetRootWindowController( | 306 bool is_fullscreen = GetRootWindowController( |
303 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; | 307 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; |
304 if (is_fullscreen != is_fullscreen_) { | 308 if (is_fullscreen != is_fullscreen_) { |
305 ash::Shell::GetInstance()->NotifyFullscreenStateChange( | 309 ash::Shell::GetInstance()->NotifyFullscreenStateChange( |
306 is_fullscreen, window_->GetRootWindow()); | 310 is_fullscreen, window_->GetRootWindow()); |
307 is_fullscreen_ = is_fullscreen; | 311 is_fullscreen_ = is_fullscreen; |
308 } | 312 } |
309 } | 313 } |
310 | 314 |
311 } // namespace ash | 315 } // namespace ash |
OLD | NEW |