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 #include "ui/ozone/platform/drm/host/drm_cursor.h" | 5 #include "ui/ozone/platform/drm/host/drm_cursor.h" |
6 | 6 |
7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
8 #include "ui/gfx/geometry/point_conversions.h" | 8 #include "ui/gfx/geometry/point_conversions.h" |
9 #include "ui/ozone/platform/drm/host/drm_window_host.h" | 9 #include "ui/ozone/platform/drm/host/drm_window_host.h" |
10 #include "ui/ozone/platform/drm/host/drm_window_host_manager.h" | 10 #include "ui/ozone/platform/drm/host/drm_window_host_manager.h" |
11 | 11 |
12 #if defined(OS_CHROMEOS) | 12 #if defined(OS_CHROMEOS) |
13 #include "ui/events/ozone/chromeos/cursor_controller.h" | 13 #include "ui/events/ozone/chromeos/cursor_controller.h" |
14 #endif | 14 #endif |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 class NullProxy : public DrmCursorProxy { | 20 class NullProxy : public DrmCursorProxy { |
21 public: | 21 public: |
22 NullProxy() {} | 22 NullProxy() {} |
23 ~NullProxy() override {} | 23 ~NullProxy() override {} |
24 | 24 |
25 void CursorSet(gfx::AcceleratedWidget window, | 25 void CursorSet(gfx::AcceleratedWidget window, |
26 const std::vector<SkBitmap>& bitmaps, | 26 const std::vector<SkBitmap>& bitmaps, |
27 const gfx::Point& point, | 27 const gfx::Point& point, |
28 int frame_delay_ms) override {} | 28 int frame_delay_ms) override {} |
29 void Move(gfx::AcceleratedWidget window, const gfx::Point& point) override {} | 29 void Move(gfx::AcceleratedWidget window, const gfx::Point& point) override {} |
30 void InitializeOnEvdev() {} | |
30 | 31 |
31 private: | 32 private: |
32 DISALLOW_COPY_AND_ASSIGN(NullProxy); | 33 DISALLOW_COPY_AND_ASSIGN(NullProxy); |
33 }; | 34 }; |
34 | 35 |
35 } // namespace | 36 } // namespace |
36 | 37 |
37 DrmCursor::DrmCursor(DrmWindowHostManager* window_manager) | 38 DrmCursor::DrmCursor(DrmWindowHostManager* window_manager) |
38 : window_(gfx::kNullAcceleratedWidget), | 39 : window_(gfx::kNullAcceleratedWidget), |
39 window_manager_(window_manager), | 40 window_manager_(window_manager), |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 | 171 |
171 // TODO(spang): Moving between windows doesn't work here, but | 172 // TODO(spang): Moving between windows doesn't work here, but |
172 // is not needed for current uses. | 173 // is not needed for current uses. |
173 SetCursorLocationLocked(screen_location - | 174 SetCursorLocationLocked(screen_location - |
174 display_bounds_in_screen_.OffsetFromOrigin()); | 175 display_bounds_in_screen_.OffsetFromOrigin()); |
175 | 176 |
176 SendCursorMoveLocked(); | 177 SendCursorMoveLocked(); |
177 } | 178 } |
178 | 179 |
179 void DrmCursor::MoveCursor(const gfx::Vector2dF& delta) { | 180 void DrmCursor::MoveCursor(const gfx::Vector2dF& delta) { |
181 DCHECK(evdev_thread_checker_.CalledOnValidThread()); | |
180 TRACE_EVENT0("drmcursor", "DrmCursor::MoveCursor"); | 182 TRACE_EVENT0("drmcursor", "DrmCursor::MoveCursor"); |
181 base::AutoLock lock(lock_); | 183 base::AutoLock lock(lock_); |
182 | 184 |
183 if (window_ == gfx::kNullAcceleratedWidget) | 185 if (window_ == gfx::kNullAcceleratedWidget) |
184 return; | 186 return; |
185 | 187 |
186 gfx::Point location; | 188 gfx::Point location; |
187 #if defined(OS_CHROMEOS) | 189 #if defined(OS_CHROMEOS) |
188 gfx::Vector2dF transformed_delta = delta; | 190 gfx::Vector2dF transformed_delta = delta; |
189 ui::CursorController::GetInstance()->ApplyCursorConfigForWindow( | 191 ui::CursorController::GetInstance()->ApplyCursorConfigForWindow( |
(...skipping 13 matching lines...) Expand all Loading... | |
203 gfx::PointF DrmCursor::GetLocation() { | 205 gfx::PointF DrmCursor::GetLocation() { |
204 base::AutoLock lock(lock_); | 206 base::AutoLock lock(lock_); |
205 return location_ + display_bounds_in_screen_.OffsetFromOrigin(); | 207 return location_ + display_bounds_in_screen_.OffsetFromOrigin(); |
206 } | 208 } |
207 | 209 |
208 gfx::Rect DrmCursor::GetCursorConfinedBounds() { | 210 gfx::Rect DrmCursor::GetCursorConfinedBounds() { |
209 base::AutoLock lock(lock_); | 211 base::AutoLock lock(lock_); |
210 return confined_bounds_ + display_bounds_in_screen_.OffsetFromOrigin(); | 212 return confined_bounds_ + display_bounds_in_screen_.OffsetFromOrigin(); |
211 } | 213 } |
212 | 214 |
215 void DrmCursor::InitializeOnEvdev() { | |
216 evdev_thread_checker_.DetachFromThread(); | |
dnicoara
2016/06/21 14:14:16
Unless this is not called on the evdev thread you
rjkroege
2016/06/21 17:20:52
The evdev_thread_checker_ is initialized on the ma
dnicoara
2016/06/21 17:38:18
Ah, I see your reasoning. My understanding is that
| |
217 proxy_->InitializeOnEvdev(); | |
218 } | |
219 | |
213 void DrmCursor::SetCursorLocationLocked(const gfx::PointF& location) { | 220 void DrmCursor::SetCursorLocationLocked(const gfx::PointF& location) { |
214 gfx::PointF clamped_location = location; | 221 gfx::PointF clamped_location = location; |
215 clamped_location.SetToMax(gfx::PointF(confined_bounds_.origin())); | 222 clamped_location.SetToMax(gfx::PointF(confined_bounds_.origin())); |
216 // Right and bottom edges are exclusive. | 223 // Right and bottom edges are exclusive. |
217 clamped_location.SetToMin( | 224 clamped_location.SetToMin( |
218 gfx::PointF(confined_bounds_.right() - 1, confined_bounds_.bottom() - 1)); | 225 gfx::PointF(confined_bounds_.right() - 1, confined_bounds_.bottom() - 1)); |
219 | 226 |
220 location_ = clamped_location; | 227 location_ = clamped_location; |
221 } | 228 } |
222 | 229 |
(...skipping 26 matching lines...) Expand all Loading... | |
249 } | 256 } |
250 | 257 |
251 void DrmCursor::MoveLockTested(gfx::AcceleratedWidget window, | 258 void DrmCursor::MoveLockTested(gfx::AcceleratedWidget window, |
252 const gfx::Point& point) { | 259 const gfx::Point& point) { |
253 lock_.AssertAcquired(); | 260 lock_.AssertAcquired(); |
254 proxy_->Move(window, point); | 261 proxy_->Move(window, point); |
255 } | 262 } |
256 | 263 |
257 | 264 |
258 } // namespace ui | 265 } // namespace ui |
OLD | NEW |