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

Unified Diff: ash/touch/touch_transformer_controller_ozone.cc

Issue 611423002: [WIP][Ozone] Support external touchscreens (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ozone-touchscreen
Patch Set: . Created 6 years, 2 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/touch/touch_transformer_controller.cc ('k') | ash/touch/touch_transformer_controller_x11.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/touch/touch_transformer_controller_ozone.cc
diff --git a/ash/touch/touch_transformer_controller_ozone.cc b/ash/touch/touch_transformer_controller_ozone.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d0e2e9df4189075e2f90a5f9b061b16351760436
--- /dev/null
+++ b/ash/touch/touch_transformer_controller_ozone.cc
@@ -0,0 +1,47 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/touch/touch_transformer_controller.h"
+
+#include "ash/display/display_manager.h"
+#include "ash/shell.h"
+#include "ui/events/device_data_manager.h"
+
+namespace ash {
+
+TouchTransformerController::TouchTransformerController()
+ : force_compute_mirror_mode_touch_transformer_(false) {
+ Shell::GetInstance()->display_controller()->AddObserver(this);
+}
+
+TouchTransformerController::~TouchTransformerController() {
+ Shell::GetInstance()->display_controller()->RemoveObserver(this);
+}
+
+void TouchTransformerController::UpdateTouchTransformer() const {
+ ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance();
+ device_manager->ClearTouchTransformerRecord();
+
+ DisplayManager* display_manager = Shell::GetInstance()->display_manager();
+ const std::vector<gfx::Display>& displays = display_manager->displays();
+ for (size_t i = 0; i < displays.size(); ++i) {
+ DisplayInfo display = display_manager->GetDisplayInfo(displays[i].id());
+ if (display.touch_support() != gfx::Display::TOUCH_SUPPORT_AVAILABLE)
+ continue;
+
+ // On Ozone we only care about the display <-> touchscreen mapping.
+ device_manager->UpdateTouchInfoForDisplay(
+ display.id(), display.touch_device_id(), gfx::Transform());
+ }
+}
+
+void TouchTransformerController::OnDisplaysInitialized() {
+ UpdateTouchTransformer();
+}
+
+void TouchTransformerController::OnDisplayConfigurationChanged() {
+ UpdateTouchTransformer();
+}
+
+} // namespace ash
« no previous file with comments | « ash/touch/touch_transformer_controller.cc ('k') | ash/touch/touch_transformer_controller_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698