| Index: ash/touch/touch_transformer_controller.cc
|
| diff --git a/ash/touch/touch_transformer_controller.cc b/ash/touch/touch_transformer_controller.cc
|
| index d88416e6feb9146f2729ed1a597df3d2ece1993c..e5e03bde233be3a9b734c679d55a293b899f0af9 100644
|
| --- a/ash/touch/touch_transformer_controller.cc
|
| +++ b/ash/touch/touch_transformer_controller.cc
|
| @@ -178,11 +178,14 @@ void TouchTransformerController::UpdateTouchTransformer() const {
|
| Shell::GetInstance()->display_configurator()->framebuffer_size();
|
|
|
| if (display_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR) {
|
| - // In mirror mode, both displays share the same root window so
|
| - // both display ids are associated with the root window.
|
| - aura::Window* root = display_controller->GetPrimaryRootWindow();
|
| - RootWindowController::ForWindow(root)->ash_host()->UpdateDisplayID(
|
| - display1_id, display2_id);
|
| + // In mirror mode, there is just one WindowTreeHost and two displays. Make
|
| + // the WindowTreeHost accept touch events from both displays.
|
| + int64 primary_display_id = display_controller->GetPrimaryDisplayId();
|
| + device_manager->SetTargetDisplayForTouchDevice(display1.touch_device_id(),
|
| + primary_display_id);
|
| + device_manager->SetTargetDisplayForTouchDevice(display2.touch_device_id(),
|
| + primary_display_id);
|
| +
|
| device_manager->UpdateTouchInfoForDisplay(
|
| display1_id, display1.touch_device_id(),
|
| GetTouchTransform(display1, display1,
|
| @@ -197,38 +200,38 @@ void TouchTransformerController::UpdateTouchTransformer() const {
|
| }
|
|
|
| if (display_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED) {
|
| - // In extended but software mirroring mode, ther is only one X root window
|
| - // that associates with both displays.
|
| + // In extended but software mirroring mode, there is a WindowTreeHost for
|
| + // each display, but all touches are forwarded to the primary root window's
|
| + // WindowTreeHost.
|
| if (GetDisplayManager()->software_mirroring_enabled()) {
|
| - aura::Window* root = display_controller->GetPrimaryRootWindow();
|
| - RootWindowController::ForWindow(root)->ash_host()->UpdateDisplayID(
|
| - display1_id, display2_id);
|
| - DisplayInfo source_display =
|
| + DisplayInfo target_display =
|
| display_controller->GetPrimaryDisplayId() == display1_id ? display1
|
| : display2;
|
| + device_manager->SetTargetDisplayForTouchDevice(display1.touch_device_id(),
|
| + target_display.id());
|
| + device_manager->SetTargetDisplayForTouchDevice(display2.touch_device_id(),
|
| + target_display.id());
|
| +
|
| // Mapping from framebuffer size to the source display's native
|
| // resolution.
|
| device_manager->UpdateTouchInfoForDisplay(
|
| display1_id, display1.touch_device_id(),
|
| - GetTouchTransform(source_display, display1,
|
| + GetTouchTransform(target_display, display1,
|
| FindTouchscreenById(display1.touch_device_id()),
|
| fb_size));
|
| device_manager->UpdateTouchInfoForDisplay(
|
| display2_id, display2.touch_device_id(),
|
| - GetTouchTransform(source_display, display2,
|
| + GetTouchTransform(target_display, display2,
|
| FindTouchscreenById(display2.touch_device_id()),
|
| fb_size));
|
| } else {
|
| - // In actual extended mode, each display is associated with one root
|
| - // window.
|
| - aura::Window* root1 =
|
| - display_controller->GetRootWindowForDisplayId(display1_id);
|
| - aura::Window* root2 =
|
| - display_controller->GetRootWindowForDisplayId(display2_id);
|
| - RootWindowController::ForWindow(root1)->ash_host()->UpdateDisplayID(
|
| - display1_id, gfx::Display::kInvalidDisplayID);
|
| - RootWindowController::ForWindow(root2)->ash_host()->UpdateDisplayID(
|
| - display2_id, gfx::Display::kInvalidDisplayID);
|
| + // In actual extended mode, each display is associated with one
|
| + // WindowTreeHost.
|
| + device_manager->SetTargetDisplayForTouchDevice(display1.touch_device_id(),
|
| + display1.id());
|
| + device_manager->SetTargetDisplayForTouchDevice(display2.touch_device_id(),
|
| + display2.id());
|
| +
|
| // Mapping from framebuffer size to each display's native resolution.
|
| device_manager->UpdateTouchInfoForDisplay(
|
| display1_id, display1.touch_device_id(),
|
| @@ -244,11 +247,9 @@ void TouchTransformerController::UpdateTouchTransformer() const {
|
| return;
|
| }
|
|
|
| - // Single display mode. The root window has one associated display id.
|
| - aura::Window* root =
|
| - display_controller->GetRootWindowForDisplayId(single_display.id());
|
| - RootWindowController::ForWindow(root)->ash_host()->UpdateDisplayID(
|
| - single_display.id(), gfx::Display::kInvalidDisplayID);
|
| + // Single display mode. The WindowTreeHost has one associated display id.
|
| + device_manager->SetTargetDisplayForTouchDevice(
|
| + single_display.touch_device_id(), single_display.id());
|
| device_manager->UpdateTouchInfoForDisplay(
|
| single_display_id, single_display.touch_device_id(),
|
| GetTouchTransform(single_display, single_display,
|
|
|