OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ |
6 #define UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ | 6 #define UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 public: | 25 public: |
26 virtual ~DrmCursorProxy() {} | 26 virtual ~DrmCursorProxy() {} |
27 | 27 |
28 // Sets the cursor |bitmaps| on |window| at |point| with |frame_delay_ms|. | 28 // Sets the cursor |bitmaps| on |window| at |point| with |frame_delay_ms|. |
29 virtual void CursorSet(gfx::AcceleratedWidget window, | 29 virtual void CursorSet(gfx::AcceleratedWidget window, |
30 const std::vector<SkBitmap>& bitmaps, | 30 const std::vector<SkBitmap>& bitmaps, |
31 const gfx::Point& point, | 31 const gfx::Point& point, |
32 int frame_delay_ms) = 0; | 32 int frame_delay_ms) = 0; |
33 // Moves the cursor in |window| to |point| | 33 // Moves the cursor in |window| to |point| |
34 virtual void Move(gfx::AcceleratedWidget window, const gfx::Point& point) = 0; | 34 virtual void Move(gfx::AcceleratedWidget window, const gfx::Point& point) = 0; |
| 35 |
| 36 // Initialize EvdevThread-specific state. |
| 37 virtual void InitializeOnEvdev() = 0; |
35 }; | 38 }; |
36 | 39 |
37 // DrmCursor manages all cursor state and semantics. | 40 // DrmCursor manages all cursor state and semantics. |
38 class DrmCursor : public CursorDelegateEvdev { | 41 class DrmCursor : public CursorDelegateEvdev { |
39 public: | 42 public: |
40 explicit DrmCursor(DrmWindowHostManager* window_manager); | 43 explicit DrmCursor(DrmWindowHostManager* window_manager); |
41 ~DrmCursor() override; | 44 ~DrmCursor() override; |
42 | 45 |
43 // Sets or resets the DrmProxy |proxy|. If |proxy| is set, the DrmCursor uses | 46 // Sets or resets the DrmProxy |proxy|. If |proxy| is set, the DrmCursor uses |
44 // it to communicate to the GPU process or thread. | 47 // it to communicate to the GPU process or thread. |
(...skipping 15 matching lines...) Expand all Loading... |
60 const gfx::Rect& new_confined_bounds); | 63 const gfx::Rect& new_confined_bounds); |
61 | 64 |
62 // CursorDelegateEvdev: | 65 // CursorDelegateEvdev: |
63 void MoveCursorTo(gfx::AcceleratedWidget window, | 66 void MoveCursorTo(gfx::AcceleratedWidget window, |
64 const gfx::PointF& location) override; | 67 const gfx::PointF& location) override; |
65 void MoveCursorTo(const gfx::PointF& screen_location) override; | 68 void MoveCursorTo(const gfx::PointF& screen_location) override; |
66 void MoveCursor(const gfx::Vector2dF& delta) override; | 69 void MoveCursor(const gfx::Vector2dF& delta) override; |
67 bool IsCursorVisible() override; | 70 bool IsCursorVisible() override; |
68 gfx::PointF GetLocation() override; | 71 gfx::PointF GetLocation() override; |
69 gfx::Rect GetCursorConfinedBounds() override; | 72 gfx::Rect GetCursorConfinedBounds() override; |
| 73 void InitializeOnEvdev() override; |
70 | 74 |
71 private: | 75 private: |
72 void SetCursorLocationLocked(const gfx::PointF& location); | 76 void SetCursorLocationLocked(const gfx::PointF& location); |
73 void SendCursorShowLocked(); | 77 void SendCursorShowLocked(); |
74 void SendCursorHideLocked(); | 78 void SendCursorHideLocked(); |
75 void SendCursorMoveLocked(); | 79 void SendCursorMoveLocked(); |
76 | 80 |
77 // Lock-testing helpers. | 81 // Lock-testing helpers. |
78 void CursorSetLockTested(gfx::AcceleratedWidget window, | 82 void CursorSetLockTested(gfx::AcceleratedWidget window, |
79 const std::vector<SkBitmap>& bitmaps, | 83 const std::vector<SkBitmap>& bitmaps, |
80 const gfx::Point& point, | 84 const gfx::Point& point, |
81 int frame_delay_ms); | 85 int frame_delay_ms); |
82 void MoveLockTested(gfx::AcceleratedWidget window, const gfx::Point& point); | 86 void MoveLockTested(gfx::AcceleratedWidget window, const gfx::Point& point); |
83 | 87 |
84 // The mutex synchronizing this object. | 88 // The mutex synchronizing this object. |
85 base::Lock lock_; | 89 base::Lock lock_; |
86 | 90 |
87 // Enforce our threading constraints. | 91 // Enforce our threading constraints. |
88 base::ThreadChecker thread_checker_; | 92 base::ThreadChecker thread_checker_; |
| 93 base::ThreadChecker evdev_thread_checker_; |
89 | 94 |
90 // The location of the bitmap (the cursor location is the hotspot location). | 95 // The location of the bitmap (the cursor location is the hotspot location). |
91 gfx::Point GetBitmapLocationLocked(); | 96 gfx::Point GetBitmapLocationLocked(); |
92 | 97 |
93 // The current cursor bitmap (immutable). | 98 // The current cursor bitmap (immutable). |
94 scoped_refptr<BitmapCursorOzone> bitmap_; | 99 scoped_refptr<BitmapCursorOzone> bitmap_; |
95 | 100 |
96 // The window under the cursor. | 101 // The window under the cursor. |
97 gfx::AcceleratedWidget window_; | 102 gfx::AcceleratedWidget window_; |
98 | 103 |
99 // The location of the cursor within the window. | 104 // The location of the cursor within the window. |
100 gfx::PointF location_; | 105 gfx::PointF location_; |
101 | 106 |
102 // The bounds of the display under the cursor. | 107 // The bounds of the display under the cursor. |
103 gfx::Rect display_bounds_in_screen_; | 108 gfx::Rect display_bounds_in_screen_; |
104 | 109 |
105 // The bounds that the cursor is confined to in |window|. | 110 // The bounds that the cursor is confined to in |window|. |
106 gfx::Rect confined_bounds_; | 111 gfx::Rect confined_bounds_; |
107 | 112 |
108 DrmWindowHostManager* window_manager_; // Not owned. | 113 DrmWindowHostManager* window_manager_; // Not owned. |
109 | 114 |
110 std::unique_ptr<DrmCursorProxy> proxy_; | 115 std::unique_ptr<DrmCursorProxy> proxy_; |
111 | 116 |
112 DISALLOW_COPY_AND_ASSIGN(DrmCursor); | 117 DISALLOW_COPY_AND_ASSIGN(DrmCursor); |
113 }; | 118 }; |
114 | 119 |
115 } // namespace ui | 120 } // namespace ui |
116 | 121 |
117 #endif // UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ | 122 #endif // UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ |
OLD | NEW |