Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/touch/touch_transformer_controller.h" | 5 #include "ash/touch/touch_transformer_controller.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/host/ash_window_tree_host.h" | 9 #include "ash/host/ash_window_tree_host.h" |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 | 190 |
| 191 DisplayController* display_controller = | 191 DisplayController* display_controller = |
| 192 Shell::GetInstance()->display_controller(); | 192 Shell::GetInstance()->display_controller(); |
| 193 ui::MultipleDisplayState display_state = | 193 ui::MultipleDisplayState display_state = |
| 194 Shell::GetInstance()->display_configurator()->display_state(); | 194 Shell::GetInstance()->display_configurator()->display_state(); |
| 195 if (display_state == ui::MULTIPLE_DISPLAY_STATE_INVALID || | 195 if (display_state == ui::MULTIPLE_DISPLAY_STATE_INVALID || |
| 196 display_state == ui::MULTIPLE_DISPLAY_STATE_HEADLESS) { | 196 display_state == ui::MULTIPLE_DISPLAY_STATE_HEADLESS) { |
| 197 return; | 197 return; |
| 198 } else if (display_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR || | 198 } else if (display_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR || |
| 199 display_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED) { | 199 display_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED) { |
| 200 // TODO(miletus) : Handle DUAL_EXTENDED with software mirroring. | |
| 201 DisplayIdPair id_pair = GetDisplayManager()->GetCurrentDisplayIdPair(); | 200 DisplayIdPair id_pair = GetDisplayManager()->GetCurrentDisplayIdPair(); |
| 202 display1_id = id_pair.first; | 201 display1_id = id_pair.first; |
| 203 display2_id = id_pair.second; | 202 display2_id = id_pair.second; |
| 204 DCHECK(display1_id != gfx::Display::kInvalidDisplayID && | 203 DCHECK(display1_id != gfx::Display::kInvalidDisplayID && |
| 205 display2_id != gfx::Display::kInvalidDisplayID); | 204 display2_id != gfx::Display::kInvalidDisplayID); |
| 206 display1 = GetDisplayManager()->GetDisplayInfo(display1_id); | 205 display1 = GetDisplayManager()->GetDisplayInfo(display1_id); |
| 207 display2 = GetDisplayManager()->GetDisplayInfo(display2_id); | 206 display2 = GetDisplayManager()->GetDisplayInfo(display2_id); |
| 208 device_manager->UpdateTouchRadiusScale(display1.touch_device_id(), | 207 device_manager->UpdateTouchRadiusScale(display1.touch_device_id(), |
| 209 GetTouchResolutionScale(display1)); | 208 GetTouchResolutionScale(display1)); |
| 210 device_manager->UpdateTouchRadiusScale(display2.touch_device_id(), | 209 device_manager->UpdateTouchRadiusScale(display2.touch_device_id(), |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 229 display1.touch_device_id(), | 228 display1.touch_device_id(), |
| 230 GetMirrorModeTouchTransformer(display1)); | 229 GetMirrorModeTouchTransformer(display1)); |
| 231 device_manager->UpdateTouchInfoForDisplay( | 230 device_manager->UpdateTouchInfoForDisplay( |
| 232 display2_id, | 231 display2_id, |
| 233 display2.touch_device_id(), | 232 display2.touch_device_id(), |
| 234 GetMirrorModeTouchTransformer(display2)); | 233 GetMirrorModeTouchTransformer(display2)); |
| 235 return; | 234 return; |
| 236 } | 235 } |
| 237 | 236 |
| 238 if (display_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED) { | 237 if (display_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED) { |
| 239 // TODO(miletus) : Handle the case the state is DUAL_EXTENDED but it | 238 // In extended but software mirroring mode, ther is only one X root window |
| 240 // is actually doing software mirroring. | 239 // that associates with both displays. |
| 241 if (GetDisplayManager()->software_mirroring_enabled()) | 240 if (GetDisplayManager()->software_mirroring_enabled()) { |
| 242 return; | 241 aura::Window* root = display_controller->GetPrimaryRootWindow(); |
| 243 // In extended mode, each display is associated with one root window. | 242 RootWindowController::ForWindow(root)->ash_host()->UpdateDisplayID( |
| 244 aura::Window* root1 = | 243 display1_id, display2_id); |
|
oshima
2014/09/10 22:34:56
Does this work even if the touch screen is on exte
Yufeng Shen (Slow to review)
2014/09/11 01:14:31
right, in the external touch display case, the eve
| |
| 245 display_controller->GetRootWindowForDisplayId(display1_id); | 244 } else { |
| 246 aura::Window* root2 = | 245 // In actual extended mode, each display is associated with one root |
| 247 display_controller->GetRootWindowForDisplayId(display2_id); | 246 // window. |
| 248 RootWindowController::ForWindow(root1)->ash_host()->UpdateDisplayID( | 247 aura::Window* root1 = |
| 249 display1_id, gfx::Display::kInvalidDisplayID); | 248 display_controller->GetRootWindowForDisplayId(display1_id); |
| 250 RootWindowController::ForWindow(root2)->ash_host()->UpdateDisplayID( | 249 aura::Window* root2 = |
| 251 display2_id, gfx::Display::kInvalidDisplayID); | 250 display_controller->GetRootWindowForDisplayId(display2_id); |
| 251 RootWindowController::ForWindow(root1)->ash_host()->UpdateDisplayID( | |
| 252 display1_id, gfx::Display::kInvalidDisplayID); | |
| 253 RootWindowController::ForWindow(root2)->ash_host()->UpdateDisplayID( | |
| 254 display2_id, gfx::Display::kInvalidDisplayID); | |
| 255 } | |
| 252 gfx::Size fb_size = | 256 gfx::Size fb_size = |
| 253 Shell::GetInstance()->display_configurator()->framebuffer_size(); | 257 Shell::GetInstance()->display_configurator()->framebuffer_size(); |
| 254 device_manager->UpdateTouchInfoForDisplay( | 258 device_manager->UpdateTouchInfoForDisplay( |
| 255 display1_id, | 259 display1_id, |
| 256 display1.touch_device_id(), | 260 display1.touch_device_id(), |
| 257 GetExtendedModeTouchTransformer(display1, fb_size)); | 261 GetExtendedModeTouchTransformer(display1, fb_size)); |
| 258 device_manager->UpdateTouchInfoForDisplay( | 262 device_manager->UpdateTouchInfoForDisplay( |
| 259 display2_id, | 263 display2_id, |
| 260 display2.touch_device_id(), | 264 display2.touch_device_id(), |
| 261 GetExtendedModeTouchTransformer(display2, fb_size)); | 265 GetExtendedModeTouchTransformer(display2, fb_size)); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 274 | 278 |
| 275 void TouchTransformerController::OnDisplaysInitialized() { | 279 void TouchTransformerController::OnDisplaysInitialized() { |
| 276 UpdateTouchTransformer(); | 280 UpdateTouchTransformer(); |
| 277 } | 281 } |
| 278 | 282 |
| 279 void TouchTransformerController::OnDisplayConfigurationChanged() { | 283 void TouchTransformerController::OnDisplayConfigurationChanged() { |
| 280 UpdateTouchTransformer(); | 284 UpdateTouchTransformer(); |
| 281 } | 285 } |
| 282 | 286 |
| 283 } // namespace ash | 287 } // namespace ash |
| OLD | NEW |