OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_OZONE_PLATFORM_DRI_TOUCH_CONVERTER_H_ |
| 6 #define UI_OZONE_PLATFORM_DRI_TOUCH_CONVERTER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "ui/gfx/transform.h" |
| 10 |
| 11 namespace ui { |
| 12 |
| 13 class DisplayManager; |
| 14 class DriWindow; |
| 15 class TouchEvent; |
| 16 |
| 17 // Translates a touch event from the touchscreen coordinate system to the |
| 18 // window coordinate system. |
| 19 class TouchConverter { |
| 20 public: |
| 21 explicit TouchConverter(DriWindow* window, DisplayManager* display_manager); |
| 22 ~TouchConverter(); |
| 23 |
| 24 // Returns true if the touch event is associated with |window_|. False |
| 25 // otherwise. |
| 26 bool CanHandleEvent(const TouchEvent& event); |
| 27 |
| 28 // Update the event properties such that the event is reported in the |
| 29 // window's coordinate system. |
| 30 void RewriteTouchEvent(TouchEvent* event); |
| 31 |
| 32 // Force updating the event transformation matrix. |
| 33 void UpdateTransform(); |
| 34 |
| 35 private: |
| 36 void GetTouchCalibration(); |
| 37 |
| 38 struct TouchCalibration { |
| 39 TouchCalibration() |
| 40 : bezel_left(0), bezel_right(0), bezel_top(0), bezel_bottom(0) {} |
| 41 |
| 42 int bezel_left; |
| 43 int bezel_right; |
| 44 int bezel_top; |
| 45 int bezel_bottom; |
| 46 }; |
| 47 |
| 48 DriWindow* window_; // Not owned. |
| 49 DisplayManager* display_manager_; // Not owned. |
| 50 |
| 51 // Keep track of the touchscreen area that isn't directly on top of the |
| 52 // display. |
| 53 TouchCalibration touch_calibration_; |
| 54 |
| 55 int64_t cached_touchscreen_id_; |
| 56 |
| 57 gfx::Transform transform_; |
| 58 |
| 59 float scale_factor_; |
| 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(TouchConverter); |
| 62 }; |
| 63 |
| 64 } // namespace ui |
| 65 |
| 66 #endif // UI_OZONE_PLATFORM_DRI_TOUCH_CONVERTER_H_ |
OLD | NEW |