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. 4 5#ifndef UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_ 6#define UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_ 7 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" 12 13namespace gfx { 14class PointF; 15class Vector2dF; 16} 17 18namespace ui { 19 20class BitmapCursorOzone; 21class BitmapCursorFactoryOzone; 22class DriWindowManager; 23class HardwareCursorDelegate; 24 25class DriCursor : public CursorDelegateEvdev { 26 public: 27 explicit DriCursor(HardwareCursorDelegate* hardware, 28 DriWindowManager* window_manager); 29 virtual ~DriCursor(); 30 31 void SetCursor(gfx::AcceleratedWidget widget, PlatformCursor platform_cursor); 32 void ShowCursor(); 33 void HideCursor(); 34 gfx::AcceleratedWidget GetCursorWindow(); 35 36 // CursorDelegateEvdev: 37 virtual void MoveCursorTo(gfx::AcceleratedWidget widget, 38 const gfx::PointF& location) OVERRIDE; 39 virtual void MoveCursor(const gfx::Vector2dF& delta) OVERRIDE; 40 virtual bool IsCursorVisible() OVERRIDE; 41 virtual gfx::PointF location() OVERRIDE; 42 43 private: 44 // The location of the bitmap (the cursor location is the hotspot location). 45 gfx::Point bitmap_location(); 46 47 // The DRI implementation for setting the hardware cursor. 48 HardwareCursorDelegate* hardware_; 49 50 DriWindowManager* window_manager_; // Not owned. 51 52 // The current cursor bitmap. 53 scoped_refptr<BitmapCursorOzone> cursor_; 54 55 // The window under the cursor. 56 gfx::AcceleratedWidget cursor_window_; 57 58 // The location of the cursor within the window. 59 gfx::PointF cursor_location_; 60}; 61 62} // namespace ui 63 64#endif // UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_ 65