Chromium Code Reviews| 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 "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 10 #include "ash/session/session_state_delegate.h" | 10 #include "ash/session/session_state_delegate.h" |
| 11 #include "ash/shelf/shelf_layout_manager.h" | 11 #include "ash/shelf/shelf_layout_manager.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/wm/always_on_top_controller.h" | 13 #include "ash/wm/always_on_top_controller.h" |
| 14 #include "ash/wm/window_animations.h" | 14 #include "ash/wm/window_animations.h" |
| 15 #include "ash/wm/window_positioner.h" | 15 #include "ash/wm/window_positioner.h" |
| 16 #include "ash/wm/window_properties.h" | 16 #include "ash/wm/window_properties.h" |
| 17 #include "ash/wm/window_state.h" | 17 #include "ash/wm/window_state.h" |
| 18 #include "ash/wm/window_util.h" | 18 #include "ash/wm/window_util.h" |
| 19 #include "ash/wm/wm_event.h" | 19 #include "ash/wm/wm_event.h" |
| 20 #include "ash/wm/workspace/workspace_layout_manager_delegate.h" | 20 #include "ash/wm/workspace/workspace_layout_manager_delegate.h" |
| 21 #include "ui/aura/client/aura_constants.h" | 21 #include "ui/aura/client/aura_constants.h" |
| 22 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
| 23 #include "ui/aura/window_observer.h" | 23 #include "ui/aura/window_observer.h" |
| 24 #include "ui/base/ime/input_method.h" | |
| 25 #include "ui/base/ime/text_input_client.h" | |
| 24 #include "ui/base/ui_base_types.h" | 26 #include "ui/base/ui_base_types.h" |
| 25 #include "ui/compositor/layer.h" | 27 #include "ui/compositor/layer.h" |
| 26 #include "ui/events/event.h" | 28 #include "ui/events/event.h" |
| 27 #include "ui/gfx/screen.h" | 29 #include "ui/gfx/screen.h" |
| 30 #include "ui/keyboard/keyboard_controller_observer.h" | |
| 28 #include "ui/wm/core/window_util.h" | 31 #include "ui/wm/core/window_util.h" |
| 29 #include "ui/wm/public/activation_client.h" | 32 #include "ui/wm/public/activation_client.h" |
| 30 | 33 |
| 31 using aura::Window; | 34 using aura::Window; |
| 32 | 35 |
| 33 namespace ash { | 36 namespace ash { |
| 34 | 37 |
| 35 WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window) | 38 WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window) |
| 36 : shelf_(NULL), | 39 : shelf_(NULL), |
| 37 window_(window), | 40 window_(window), |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 void WorkspaceLayoutManager::SetChildBounds( | 120 void WorkspaceLayoutManager::SetChildBounds( |
| 118 Window* child, | 121 Window* child, |
| 119 const gfx::Rect& requested_bounds) { | 122 const gfx::Rect& requested_bounds) { |
| 120 wm::WindowState* window_state = wm::GetWindowState(child); | 123 wm::WindowState* window_state = wm::GetWindowState(child); |
| 121 wm::SetBoundsEvent event(wm::WM_EVENT_SET_BOUNDS, requested_bounds); | 124 wm::SetBoundsEvent event(wm::WM_EVENT_SET_BOUNDS, requested_bounds); |
| 122 window_state->OnWMEvent(&event); | 125 window_state->OnWMEvent(&event); |
| 123 UpdateShelfVisibility(); | 126 UpdateShelfVisibility(); |
| 124 } | 127 } |
| 125 | 128 |
| 126 ////////////////////////////////////////////////////////////////////////////// | 129 ////////////////////////////////////////////////////////////////////////////// |
| 130 // WorkspaceLayoutManager, keyboard::KeyboardControllerObserver implementation: | |
| 131 | |
| 132 void WorkspaceLayoutManager::OnKeyboardBoundsChanging( | |
| 133 const gfx::Rect& new_bounds) { | |
| 134 aura::Window* root_window = window_->GetRootWindow(); | |
| 135 ui::InputMethod* input_method = | |
| 136 root_window->GetProperty(aura::client::kRootWindowInputMethodKey); | |
| 137 ui::TextInputClient* text_input_client = input_method->GetTextInputClient(); | |
| 138 if(text_input_client) { | |
| 139 aura::Window *window = text_input_client->GetAttachedWindow(); | |
| 140 if (window && window_->Contains(window)) { | |
|
flackr
2014/06/03 13:36:30
Use early returns rather than nesting if's
kevers
2014/06/03 15:32:44
Done.
| |
| 141 gfx::Rect window_bounds = ScreenUtil::ConvertRectToScreen( | |
| 142 window_, | |
| 143 window->GetTargetBounds()); | |
| 144 gfx::Rect intersect = gfx::IntersectRects(window_bounds, new_bounds); | |
| 145 if (intersect.height() > 0) { | |
|
flackr
2014/06/03 13:36:30
nit: This is basically a no-op, I would remove thi
kevers
2014/06/03 15:32:44
Done.
| |
| 146 int shift = std::min(intersect.height(), | |
| 147 window->bounds().y() - work_area_in_parent_.y()); | |
| 148 if (shift != 0) { | |
|
flackr
2014/06/03 13:36:30
nit: shift > 0.
kevers
2014/06/03 15:32:44
Done.
| |
| 149 gfx::Point origin(window->bounds().x(), window->bounds().y() - shift); | |
| 150 SetChildBounds(window, gfx::Rect(origin, window->bounds().size())); | |
| 151 } | |
| 152 } | |
| 153 } | |
| 154 } | |
| 155 } | |
| 156 | |
| 157 ////////////////////////////////////////////////////////////////////////////// | |
| 127 // WorkspaceLayoutManager, ash::ShellObserver implementation: | 158 // WorkspaceLayoutManager, ash::ShellObserver implementation: |
| 128 | 159 |
| 129 void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() { | 160 void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() { |
| 130 const gfx::Rect work_area(ScreenUtil::ConvertRectFromScreen( | 161 const gfx::Rect work_area(ScreenUtil::ConvertRectFromScreen( |
| 131 window_, | 162 window_, |
| 132 Shell::GetScreen()->GetDisplayNearestWindow(window_).work_area())); | 163 Shell::GetScreen()->GetDisplayNearestWindow(window_).work_area())); |
| 133 if (work_area != work_area_in_parent_) { | 164 if (work_area != work_area_in_parent_) { |
| 134 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); | 165 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); |
| 135 AdjustAllWindowsBoundsForWorkAreaChange(&event); | 166 AdjustAllWindowsBoundsForWorkAreaChange(&event); |
| 136 } | 167 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 bool is_fullscreen = GetRootWindowController( | 304 bool is_fullscreen = GetRootWindowController( |
| 274 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; | 305 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; |
| 275 if (is_fullscreen != is_fullscreen_) { | 306 if (is_fullscreen != is_fullscreen_) { |
| 276 ash::Shell::GetInstance()->NotifyFullscreenStateChange( | 307 ash::Shell::GetInstance()->NotifyFullscreenStateChange( |
| 277 is_fullscreen, window_->GetRootWindow()); | 308 is_fullscreen, window_->GetRootWindow()); |
| 278 is_fullscreen_ = is_fullscreen; | 309 is_fullscreen_ = is_fullscreen; |
| 279 } | 310 } |
| 280 } | 311 } |
| 281 | 312 |
| 282 } // namespace ash | 313 } // namespace ash |
| OLD | NEW |