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