Chromium Code Reviews| Index: ash/display/display_controller.cc |
| diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc |
| index f34ae1fefc01e1040d4fa06bdef4002bc4a89de0..177118ac3cebb974b90c1dadce0867bbad50c5e8 100644 |
| --- a/ash/display/display_controller.cc |
| +++ b/ash/display/display_controller.cc |
| @@ -26,6 +26,7 @@ |
| #include "ash/shell_delegate.h" |
| #include "ash/system/tray/system_tray.h" |
| #include "ash/wm/coordinate_conversion.h" |
| +#include "ash/wm/window_util.h" |
| #include "base/command_line.h" |
| #include "base/stl_util.h" |
| #include "base/strings/stringprintf.h" |
| @@ -38,6 +39,7 @@ |
| #include "ui/aura/window_property.h" |
| #include "ui/aura/window_tracker.h" |
| #include "ui/aura/window_tree_host.h" |
| +#include "ui/base/ime/input_method_factory.h" |
| #include "ui/compositor/compositor.h" |
| #include "ui/gfx/display.h" |
| #include "ui/gfx/screen.h" |
| @@ -867,6 +869,15 @@ void DisplayController::PostDisplayConfigurationChange() { |
| UpdateMouseLocationAfterDisplayChange(); |
| } |
| +bool DisplayController::DispatchKeyEventPostIME(const ui::KeyEvent& event) { |
| + aura::Window* root_window = wm::GetActiveWindow(); |
| + if (root_window) |
| + root_window = root_window->GetRootWindow(); |
| + if (!root_window) |
| + root_window = Shell::GetTargetRootWindow(); |
|
James Cook
2015/06/03 16:34:27
nit: I would use GetPrimaryRootWindow() as the fal
oshima
2015/06/03 16:48:00
active window must have a root window, so the foll
Shu Chen
2015/06/04 01:59:44
Done. And comments added.
|
| + return root_window->GetHost()->DispatchKeyEventPostIME(event); |
| +} |
| + |
| AshWindowTreeHost* DisplayController::AddWindowTreeHostForDisplay( |
| const gfx::Display& display, |
| const AshWindowTreeHostInitParams& init_params) { |
| @@ -879,6 +890,11 @@ AshWindowTreeHost* DisplayController::AddWindowTreeHostForDisplay( |
| display.id() == DisplayManager::kUnifiedDisplayId; |
| AshWindowTreeHost* ash_host = AshWindowTreeHost::Create(params_with_bounds); |
| aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); |
| + if (!input_method_) { // Singleton input method instance for Ash. |
| + input_method_ = ui::CreateInputMethod(this, host->GetAcceleratedWidget()); |
| + input_method_->OnFocus(); |
| + } |
| + host->SetInputMethod(input_method_.get()); |
| host->window()->SetName(base::StringPrintf( |
| "%sRootWindow-%d", params_with_bounds.offscreen ? "Offscreen" : "", |