Commit b03278a7 authored by miletus's avatar miletus Committed by Commit bot

TouchTransformer for software mirroring mode

In software mirroring mode, there is one X root window and it should
be associated with both displays (touchscreens).

BUG=chrome-os-partner:31466
TEST=tested on Big with clone mode.

Review URL: https://codereview.chromium.org/557073002

Cr-Commit-Position: refs/heads/master@{#294407}
parent 8f132304
......@@ -197,7 +197,6 @@ void TouchTransformerController::UpdateTouchTransformer() const {
return;
} else if (display_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR ||
display_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED) {
// TODO(miletus) : Handle DUAL_EXTENDED with software mirroring.
DisplayIdPair id_pair = GetDisplayManager()->GetCurrentDisplayIdPair();
display1_id = id_pair.first;
display2_id = id_pair.second;
......@@ -236,29 +235,48 @@ void TouchTransformerController::UpdateTouchTransformer() const {
}
if (display_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED) {
// TODO(miletus) : Handle the case the state is DUAL_EXTENDED but it
// is actually doing software mirroring.
if (GetDisplayManager()->software_mirroring_enabled())
return;
// In 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);
gfx::Size fb_size =
Shell::GetInstance()->display_configurator()->framebuffer_size();
device_manager->UpdateTouchInfoForDisplay(
display1_id,
display1.touch_device_id(),
GetExtendedModeTouchTransformer(display1, fb_size));
device_manager->UpdateTouchInfoForDisplay(
display2_id,
display2.touch_device_id(),
GetExtendedModeTouchTransformer(display2, fb_size));
// In extended but software mirroring mode, ther is only one X root window
// that associates with both displays.
if (GetDisplayManager()->software_mirroring_enabled()) {
aura::Window* root = display_controller->GetPrimaryRootWindow();
RootWindowController::ForWindow(root)->ash_host()->UpdateDisplayID(
display1_id, display2_id);
DisplayInfo source_display =
gfx::Display::InternalDisplayId() == display1_id ?
display1 : display2;
// Mapping from framebuffer size to the source display's native
// resolution.
device_manager->UpdateTouchInfoForDisplay(
display1_id,
display1.touch_device_id(),
GetExtendedModeTouchTransformer(source_display, fb_size));
device_manager->UpdateTouchInfoForDisplay(
display2_id,
display2.touch_device_id(),
GetExtendedModeTouchTransformer(source_display, 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.
device_manager->UpdateTouchInfoForDisplay(
display1_id,
display1.touch_device_id(),
GetExtendedModeTouchTransformer(display1, fb_size));
device_manager->UpdateTouchInfoForDisplay(
display2_id,
display2.touch_device_id(),
GetExtendedModeTouchTransformer(display2, fb_size));
}
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment