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_ |