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"
20 class BitmapCursorOzone;
21 class BitmapCursorFactoryOzone;
22 class DriWindowManager;
23 class HardwareCursorDelegate;
25 class DriCursor : public CursorDelegateEvdev {
27 explicit DriCursor(HardwareCursorDelegate* hardware,
28 DriWindowManager* window_manager);
29 ~DriCursor() override;
31 // Set's platform_cursor for widget. SetCursor is not responsible for showing
32 // the cursor. ShowCursor needs to be explicitly called to make the cursor
34 void SetCursor(gfx::AcceleratedWidget widget, PlatformCursor platform_cursor);
37 gfx::AcceleratedWidget GetCursorWindow();
39 // CursorDelegateEvdev:
40 void MoveCursorTo(gfx::AcceleratedWidget widget,
41 const gfx::PointF& location) override;
42 void MoveCursor(const gfx::Vector2dF& delta) override;
43 bool IsCursorVisible() override;
44 gfx::PointF location() override;
47 // The location of the bitmap (the cursor location is the hotspot location).
48 gfx::Point bitmap_location();
50 // The DRI implementation for setting the hardware cursor.
51 HardwareCursorDelegate* hardware_;
53 DriWindowManager* window_manager_; // Not owned.
55 // The current cursor bitmap.
56 scoped_refptr<BitmapCursorOzone> cursor_;
58 // The window under the cursor.
59 gfx::AcceleratedWidget cursor_window_;
61 // The location of the cursor within the window.
62 gfx::PointF cursor_location_;
67 #endif // UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_