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

Unified Diff: ui/ozone/platform/dri/touch_converter.h

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 | « ui/ozone/platform/dri/ozone_platform_gbm.cc ('k') | ui/ozone/platform/dri/touch_converter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/dri/touch_converter.h
diff --git a/ui/ozone/platform/dri/touch_converter.h b/ui/ozone/platform/dri/touch_converter.h
new file mode 100644
index 0000000000000000000000000000000000000000..d08dc950a8c82526ad3df3b0e4ff1da1791ca221
--- /dev/null
+++ b/ui/ozone/platform/dri/touch_converter.h
@@ -0,0 +1,66 @@
+// 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.
+
+#ifndef UI_OZONE_PLATFORM_DRI_TOUCH_CONVERTER_H_
+#define UI_OZONE_PLATFORM_DRI_TOUCH_CONVERTER_H_
+
+#include "base/macros.h"
+#include "ui/gfx/transform.h"
+
+namespace ui {
+
+class DisplayManager;
+class DriWindow;
+class TouchEvent;
+
+// Translates a touch event from the touchscreen coordinate system to the
+// window coordinate system.
+class TouchConverter {
+ public:
+ explicit TouchConverter(DriWindow* window, DisplayManager* display_manager);
+ ~TouchConverter();
+
+ // Returns true if the touch event is associated with |window_|. False
+ // otherwise.
+ bool CanHandleEvent(const TouchEvent& event);
+
+ // Update the event properties such that the event is reported in the
+ // window's coordinate system.
+ void RewriteTouchEvent(TouchEvent* event);
+
+ // Force updating the event transformation matrix.
+ void UpdateTransform();
+
+ private:
+ void GetTouchCalibration();
+
+ struct TouchCalibration {
+ TouchCalibration()
+ : bezel_left(0), bezel_right(0), bezel_top(0), bezel_bottom(0) {}
+
+ int bezel_left;
+ int bezel_right;
+ int bezel_top;
+ int bezel_bottom;
+ };
+
+ DriWindow* window_; // Not owned.
+ DisplayManager* display_manager_; // Not owned.
+
+ // Keep track of the touchscreen area that isn't directly on top of the
+ // display.
+ TouchCalibration touch_calibration_;
+
+ int64_t cached_touchscreen_id_;
+
+ gfx::Transform transform_;
+
+ float scale_factor_;
+
+ DISALLOW_COPY_AND_ASSIGN(TouchConverter);
+};
+
+} // namespace ui
+
+#endif // UI_OZONE_PLATFORM_DRI_TOUCH_CONVERTER_H_
« no previous file with comments | « ui/ozone/platform/dri/ozone_platform_gbm.cc ('k') | ui/ozone/platform/dri/touch_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698