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 = ash::Shell::GetInstance()->GetPrimaryRootWindow(); | |
flackr
2014/06/02 20:24:52
Should use the managed root window (i.e. window_->
kevers
2014/06/03 13:21:18
Done.
| |
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->parent() && | |
141 window->parent()->layout_manager() == this) { | |
flackr
2014/06/02 20:24:52
I think this condition can just be window_->Contai
kevers
2014/06/03 13:21:18
Done.
| |
142 gfx::Rect window_bounds = window->GetBoundsInScreen(); | |
flackr
2014/06/02 20:24:52
Should this be target bounds (converted to screen
kevers
2014/06/03 13:21:18
Done.
| |
143 gfx::Rect intersect = gfx::IntersectRects(window_bounds, new_bounds); | |
144 if (intersect.height() > 0) { | |
145 int shift = std::min(intersect.height(), | |
146 window->bounds().y() - work_area_in_parent_.y()); | |
147 if (shift != 0) { | |
148 gfx::Point origin(window->bounds().x(), window->bounds().y() - shift); | |
149 SetChildBounds(window, gfx::Rect(origin, window->bounds().size())); | |
150 } | |
151 } | |
152 } | |
153 } | |
154 } | |
155 | |
156 ////////////////////////////////////////////////////////////////////////////// | |
127 // WorkspaceLayoutManager, ash::ShellObserver implementation: | 157 // WorkspaceLayoutManager, ash::ShellObserver implementation: |
128 | 158 |
129 void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() { | 159 void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() { |
130 const gfx::Rect work_area(ScreenUtil::ConvertRectFromScreen( | 160 const gfx::Rect work_area(ScreenUtil::ConvertRectFromScreen( |
131 window_, | 161 window_, |
132 Shell::GetScreen()->GetDisplayNearestWindow(window_).work_area())); | 162 Shell::GetScreen()->GetDisplayNearestWindow(window_).work_area())); |
133 if (work_area != work_area_in_parent_) { | 163 if (work_area != work_area_in_parent_) { |
134 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); | 164 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); |
135 AdjustAllWindowsBoundsForWorkAreaChange(&event); | 165 AdjustAllWindowsBoundsForWorkAreaChange(&event); |
136 } | 166 } |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 bool is_fullscreen = GetRootWindowController( | 303 bool is_fullscreen = GetRootWindowController( |
274 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; | 304 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; |
275 if (is_fullscreen != is_fullscreen_) { | 305 if (is_fullscreen != is_fullscreen_) { |
276 ash::Shell::GetInstance()->NotifyFullscreenStateChange( | 306 ash::Shell::GetInstance()->NotifyFullscreenStateChange( |
277 is_fullscreen, window_->GetRootWindow()); | 307 is_fullscreen, window_->GetRootWindow()); |
278 is_fullscreen_ = is_fullscreen; | 308 is_fullscreen_ = is_fullscreen; |
279 } | 309 } |
280 } | 310 } |
281 | 311 |
282 } // namespace ash | 312 } // namespace ash |
OLD | NEW |