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

Side by Side Diff: ash/touch/touch_transformer_controller.cc

Issue 557073002: TouchTransformer for software mirroring mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mapping the event correctly for external touchscreen Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
240 // is actually doing software mirroring.
241 if (GetDisplayManager()->software_mirroring_enabled())
242 return;
243 // In extended mode, each display is associated with one root window.
244 aura::Window* root1 =
245 display_controller->GetRootWindowForDisplayId(display1_id);
246 aura::Window* root2 =
247 display_controller->GetRootWindowForDisplayId(display2_id);
248 RootWindowController::ForWindow(root1)->ash_host()->UpdateDisplayID(
249 display1_id, gfx::Display::kInvalidDisplayID);
250 RootWindowController::ForWindow(root2)->ash_host()->UpdateDisplayID(
251 display2_id, gfx::Display::kInvalidDisplayID);
252 gfx::Size fb_size = 238 gfx::Size fb_size =
253 Shell::GetInstance()->display_configurator()->framebuffer_size(); 239 Shell::GetInstance()->display_configurator()->framebuffer_size();
254 device_manager->UpdateTouchInfoForDisplay( 240 // In extended but software mirroring mode, ther is only one X root window
255 display1_id, 241 // that associates with both displays.
256 display1.touch_device_id(), 242 if (GetDisplayManager()->software_mirroring_enabled()) {
257 GetExtendedModeTouchTransformer(display1, fb_size)); 243 aura::Window* root = display_controller->GetPrimaryRootWindow();
258 device_manager->UpdateTouchInfoForDisplay( 244 RootWindowController::ForWindow(root)->ash_host()->UpdateDisplayID(
259 display2_id, 245 display1_id, display2_id);
260 display2.touch_device_id(), 246 DisplayInfo source_display =
261 GetExtendedModeTouchTransformer(display2, fb_size)); 247 gfx::Display::InternalDisplayId() == display1_id ?
248 display1 : display2;
249 // Mapping from framebuffer size to the source display's native
250 // resolution.
251 device_manager->UpdateTouchInfoForDisplay(
252 display1_id,
253 display1.touch_device_id(),
254 GetExtendedModeTouchTransformer(source_display, fb_size));
255 device_manager->UpdateTouchInfoForDisplay(
256 display2_id,
257 display2.touch_device_id(),
258 GetExtendedModeTouchTransformer(source_display, fb_size));
259 } else {
260 // In actual extended mode, each display is associated with one root
261 // window.
262 aura::Window* root1 =
263 display_controller->GetRootWindowForDisplayId(display1_id);
264 aura::Window* root2 =
265 display_controller->GetRootWindowForDisplayId(display2_id);
266 RootWindowController::ForWindow(root1)->ash_host()->UpdateDisplayID(
267 display1_id, gfx::Display::kInvalidDisplayID);
268 RootWindowController::ForWindow(root2)->ash_host()->UpdateDisplayID(
269 display2_id, gfx::Display::kInvalidDisplayID);
270 // Mapping from framebuffer size to each display's native resolution.
271 device_manager->UpdateTouchInfoForDisplay(
272 display1_id,
273 display1.touch_device_id(),
274 GetExtendedModeTouchTransformer(display1, fb_size));
275 device_manager->UpdateTouchInfoForDisplay(
276 display2_id,
277 display2.touch_device_id(),
278 GetExtendedModeTouchTransformer(display2, fb_size));
279 }
262 return; 280 return;
263 } 281 }
264 282
265 // Single display mode. The root window has one associated display id. 283 // Single display mode. The root window has one associated display id.
266 aura::Window* root = 284 aura::Window* root =
267 display_controller->GetRootWindowForDisplayId(single_display.id()); 285 display_controller->GetRootWindowForDisplayId(single_display.id());
268 RootWindowController::ForWindow(root)->ash_host()->UpdateDisplayID( 286 RootWindowController::ForWindow(root)->ash_host()->UpdateDisplayID(
269 single_display.id(), gfx::Display::kInvalidDisplayID); 287 single_display.id(), gfx::Display::kInvalidDisplayID);
270 device_manager->UpdateTouchInfoForDisplay(single_display_id, 288 device_manager->UpdateTouchInfoForDisplay(single_display_id,
271 single_display.touch_device_id(), 289 single_display.touch_device_id(),
272 gfx::Transform()); 290 gfx::Transform());
273 } 291 }
274 292
275 void TouchTransformerController::OnDisplaysInitialized() { 293 void TouchTransformerController::OnDisplaysInitialized() {
276 UpdateTouchTransformer(); 294 UpdateTouchTransformer();
277 } 295 }
278 296
279 void TouchTransformerController::OnDisplayConfigurationChanged() { 297 void TouchTransformerController::OnDisplayConfigurationChanged() {
280 UpdateTouchTransformer(); 298 UpdateTouchTransformer();
281 } 299 }
282 300
283 } // namespace ash 301 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698