| 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/ozone/platform/dri/dri_surface_factory.h" | 8 #include "ui/ozone/platform/dri/dri_surface_factory.h" |
| 9 | 9 |
| 10 namespace ui { | 10 namespace ui { |
| 11 | 11 |
| 12 CursorFactoryEvdevDri::CursorFactoryEvdevDri(DriSurfaceFactory* dri) | 12 CursorFactoryEvdevDri::CursorFactoryEvdevDri(DriSurfaceFactory* dri) |
| 13 : dri_(dri) { | 13 : dri_(dri) { |
| 14 // TODO(dnicoara) Assume the first widget since at this point there are no | 14 // TODO(dnicoara) Assume the first widget since at this point there are no |
| 15 // widgets initialized. | 15 // widgets initialized. |
| 16 cursor_window_ = DriSurfaceFactory::kDefaultWidgetHandle; | 16 cursor_window_ = DriSurfaceFactory::kDefaultWidgetHandle; |
| 17 cursor_location_ = gfx::PointF(2560 / 2, 1700 / 2); // TODO(spang): Argh! | 17 cursor_location_ = gfx::PointF(2560 / 2, 1700 / 2); // TODO(spang): Argh! |
| 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(cursor_window_, GetDefaultCursor(kCursorPointer)); | |
| 23 } | 18 } |
| 24 | 19 |
| 25 CursorFactoryEvdevDri::~CursorFactoryEvdevDri() {} | 20 CursorFactoryEvdevDri::~CursorFactoryEvdevDri() {} |
| 26 | 21 |
| 27 void CursorFactoryEvdevDri::SetBitmapCursor( | 22 void CursorFactoryEvdevDri::SetBitmapCursor( |
| 28 gfx::AcceleratedWidget widget, | 23 gfx::AcceleratedWidget widget, |
| 29 scoped_refptr<BitmapCursorOzone> cursor) { | 24 scoped_refptr<BitmapCursorOzone> cursor) { |
| 30 if (cursor_ == cursor) | 25 if (cursor_ == cursor) |
| 31 return; | 26 return; |
| 32 | 27 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 63 } | 58 } |
| 64 | 59 |
| 65 gfx::PointF CursorFactoryEvdevDri::location() { return cursor_location_; } | 60 gfx::PointF CursorFactoryEvdevDri::location() { return cursor_location_; } |
| 66 | 61 |
| 67 gfx::Point CursorFactoryEvdevDri::bitmap_location() { | 62 gfx::Point CursorFactoryEvdevDri::bitmap_location() { |
| 68 return gfx::ToFlooredPoint(cursor_location_) - | 63 return gfx::ToFlooredPoint(cursor_location_) - |
| 69 cursor_->hotspot().OffsetFromOrigin(); | 64 cursor_->hotspot().OffsetFromOrigin(); |
| 70 } | 65 } |
| 71 | 66 |
| 72 } // namespace ui | 67 } // namespace ui |
| OLD | NEW |