Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(615)

Unified Diff: ash/touch/touch_transformer_controller.cc

Issue 922843002: Fix software mirror mode on Ozone part 2/2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..82b1a9adb3104999fea2bc4d8d00e159b9e1a9e2 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->SetDestinationDisplayForTouchDevice(
+ display1.touch_device_id(), primary_display_id);
+ device_manager->SetDestinationDisplayForTouchDevice(
+ 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 destination_display =
display_controller->GetPrimaryDisplayId() == display1_id ? display1
: display2;
+ device_manager->SetDestinationDisplayForTouchDevice(
+ display1.touch_device_id(), destination_display.id());
+ device_manager->SetDestinationDisplayForTouchDevice(
+ display2.touch_device_id(), destination_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(destination_display, display1,
FindTouchscreenById(display1.touch_device_id()),
fb_size));
device_manager->UpdateTouchInfoForDisplay(
display2_id, display2.touch_device_id(),
- GetTouchTransform(source_display, display2,
+ GetTouchTransform(destination_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->SetDestinationDisplayForTouchDevice(
+ display1.touch_device_id(), display1.id());
+ device_manager->SetDestinationDisplayForTouchDevice(
+ 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->SetDestinationDisplayForTouchDevice(
+ single_display.touch_device_id(), single_display.id());
device_manager->UpdateTouchInfoForDisplay(
single_display_id, single_display.touch_device_id(),
GetTouchTransform(single_display, single_display,

Powered by Google App Engine
This is Rietveld 408576698