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

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, 9 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
« no previous file with comments | « ash/host/ash_window_tree_host_x11.cc ('k') | ash/touch/touch_transformer_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4ae2298b341fb4ad317609ff01f61c3a63222ada 100644
--- a/ash/touch/touch_transformer_controller.cc
+++ b/ash/touch/touch_transformer_controller.cc
@@ -126,7 +126,7 @@ TouchTransformerController::~TouchTransformerController() {
void TouchTransformerController::UpdateTouchTransformer() const {
ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance();
- device_manager->ClearTouchTransformerRecord();
+ device_manager->ClearTouchDeviceAssociations();
// Display IDs and DisplayInfo for mirror or extended mode.
int64 display1_id = gfx::Display::kInvalidDisplayID;
@@ -178,18 +178,16 @@ 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->UpdateTouchInfoForDisplay(
- display1_id, display1.touch_device_id(),
+ primary_display_id, display1.touch_device_id(),
GetTouchTransform(display1, display1,
FindTouchscreenById(display1.touch_device_id()),
fb_size));
device_manager->UpdateTouchInfoForDisplay(
- display2_id, display2.touch_device_id(),
+ primary_display_id, display2.touch_device_id(),
GetTouchTransform(display2, display2,
FindTouchscreenById(display2.touch_device_id()),
fb_size));
@@ -197,39 +195,26 @@ 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;
- // Mapping from framebuffer size to the source display's native
- // resolution.
device_manager->UpdateTouchInfoForDisplay(
- display1_id, display1.touch_device_id(),
- GetTouchTransform(source_display, display1,
+ target_display.id(), display1.touch_device_id(),
+ GetTouchTransform(target_display, display1,
FindTouchscreenById(display1.touch_device_id()),
fb_size));
device_manager->UpdateTouchInfoForDisplay(
- display2_id, display2.touch_device_id(),
- GetTouchTransform(source_display, display2,
+ target_display.id(), display2.touch_device_id(),
+ 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);
- // Mapping from framebuffer size to each display's native resolution.
+ // In actual extended mode, each display is associated with one
+ // WindowTreeHost.
device_manager->UpdateTouchInfoForDisplay(
display1_id, display1.touch_device_id(),
GetTouchTransform(display1, display1,
@@ -244,11 +229,7 @@ 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->UpdateTouchInfoForDisplay(
single_display_id, single_display.touch_device_id(),
GetTouchTransform(single_display, single_display,
« no previous file with comments | « ash/host/ash_window_tree_host_x11.cc ('k') | ash/touch/touch_transformer_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698