OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/dri/cursor_factory_evdev_dri.h" | 5 #include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h" |
6 | 6 |
7 #include "ui/gfx/geometry/point_conversions.h" | 7 #include "ui/gfx/geometry/point_conversions.h" |
8 #include "ui/gfx/ozone/dri/dri_surface_factory.h" | 8 #include "ui/gfx/ozone/dri/dri_surface_factory.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
11 | 11 |
12 CursorFactoryEvdevDri::CursorFactoryEvdevDri(gfx::DriSurfaceFactory* dri) | 12 CursorFactoryEvdevDri::CursorFactoryEvdevDri(gfx::DriSurfaceFactory* dri) |
13 : dri_(dri) { | 13 : dri_(dri) { |
14 cursor_window_ = dri_->GetAcceleratedWidget(); | 14 cursor_window_ = dri_->GetAcceleratedWidget(); |
15 cursor_bounds_ = gfx::RectF(0, 0, 2560, 1700); // TODO(spang): Argh! | 15 cursor_bounds_ = gfx::RectF(0, 0, 2560, 1700); // TODO(spang): Argh! |
16 cursor_location_ = | 16 cursor_location_ = |
17 gfx::PointF(cursor_bounds_.width() / 2, cursor_bounds_.height() / 2); | 17 gfx::PointF(cursor_bounds_.width() / 2, cursor_bounds_.height() / 2); |
| 18 |
| 19 // The DRI cursor is invisible unless explicitly set. Therefore, set the |
| 20 // pointer cursor on initialization. |
| 21 // TODO(spang): Move this to DRI window initialization. |
| 22 SetCursor(dri->GetAcceleratedWidget(), GetDefaultCursor(kCursorPointer)); |
18 } | 23 } |
19 | 24 |
20 CursorFactoryEvdevDri::~CursorFactoryEvdevDri() {} | 25 CursorFactoryEvdevDri::~CursorFactoryEvdevDri() {} |
21 | 26 |
22 void CursorFactoryEvdevDri::SetBitmapCursor( | 27 void CursorFactoryEvdevDri::SetBitmapCursor( |
23 gfx::AcceleratedWidget widget, | 28 gfx::AcceleratedWidget widget, |
24 scoped_refptr<BitmapCursorOzone> cursor) { | 29 scoped_refptr<BitmapCursorOzone> cursor) { |
25 if (cursor_ == cursor) | 30 if (cursor_ == cursor) |
26 return; | 31 return; |
27 cursor_ = cursor; | 32 cursor_ = cursor; |
(...skipping 25 matching lines...) Expand all Loading... |
53 } | 58 } |
54 | 59 |
55 gfx::PointF CursorFactoryEvdevDri::location() { return cursor_location_; } | 60 gfx::PointF CursorFactoryEvdevDri::location() { return cursor_location_; } |
56 | 61 |
57 gfx::Point CursorFactoryEvdevDri::bitmap_location() { | 62 gfx::Point CursorFactoryEvdevDri::bitmap_location() { |
58 return gfx::ToFlooredPoint(cursor_location_) - | 63 return gfx::ToFlooredPoint(cursor_location_) - |
59 cursor_->hotspot().OffsetFromOrigin(); | 64 cursor_->hotspot().OffsetFromOrigin(); |
60 } | 65 } |
61 | 66 |
62 } // namespace ui | 67 } // namespace ui |
OLD | NEW |