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.
5 #ifndef UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_
6 #define UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_
8 #include "base/memory/ref_counted.h"
9 #include "ui/base/cursor/cursor.h"
10 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h"
11 #include "ui/gfx/native_widget_types.h"
21 class BitmapCursorOzone
;
22 class BitmapCursorFactoryOzone
;
23 class DriWindowManager
;
24 class HardwareCursorDelegate
;
26 class DriCursor
: public CursorDelegateEvdev
{
28 explicit DriCursor(HardwareCursorDelegate
* hardware
,
29 DriWindowManager
* window_manager
);
30 ~DriCursor() override
;
32 // Set's platform_cursor for widget. SetCursor is not responsible for showing
33 // the cursor. ShowCursor needs to be explicitly called to make the cursor
35 void SetCursor(gfx::AcceleratedWidget widget
, PlatformCursor platform_cursor
);
38 gfx::AcceleratedWidget
GetCursorWindow();
40 // CursorDelegateEvdev:
41 void MoveCursorTo(gfx::AcceleratedWidget widget
,
42 const gfx::PointF
& location
) override
;
43 void MoveCursorTo(const gfx::PointF
& location
) override
;
44 void MoveCursor(const gfx::Vector2dF
& delta
) override
;
45 bool IsCursorVisible() override
;
46 gfx::PointF
location() override
;
47 gfx::Rect
GetCursorDisplayBounds() override
;
50 // The location of the bitmap (the cursor location is the hotspot location).
51 gfx::Point
bitmap_location();
53 // The DRI implementation for setting the hardware cursor.
54 HardwareCursorDelegate
* hardware_
;
56 DriWindowManager
* window_manager_
; // Not owned.
58 // The current cursor bitmap.
59 scoped_refptr
<BitmapCursorOzone
> cursor_
;
61 // The window under the cursor.
62 gfx::AcceleratedWidget cursor_window_
;
64 // The location of the cursor within the window.
65 gfx::PointF cursor_location_
;
70 #endif // UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_