| 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/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 explicit DriCursor(DriWindowManager* window_manager, | 34 explicit DriCursor(DriWindowManager* window_manager, |
| 35 DriGpuPlatformSupportHost* sender); | 35 DriGpuPlatformSupportHost* sender); |
| 36 ~DriCursor() override; | 36 ~DriCursor() override; |
| 37 | 37 |
| 38 void Init(); | 38 void Init(); |
| 39 | 39 |
| 40 // Change the cursor over the specifed window. | 40 // Change the cursor over the specifed window. |
| 41 void SetCursor(gfx::AcceleratedWidget window, PlatformCursor platform_cursor); | 41 void SetCursor(gfx::AcceleratedWidget window, PlatformCursor platform_cursor); |
| 42 | 42 |
| 43 // Handle window lifecycle. | 43 // Handle window lifecycle. |
| 44 void OnWindowAdded(gfx::AcceleratedWidget window, const gfx::Rect& bounds); | 44 void OnWindowAdded(gfx::AcceleratedWidget window, |
| 45 const gfx::Rect& bounds_in_screen, |
| 46 const gfx::Rect& cursor_confined_bounds); |
| 45 void OnWindowRemoved(gfx::AcceleratedWidget window); | 47 void OnWindowRemoved(gfx::AcceleratedWidget window); |
| 46 | 48 |
| 47 // Handle window bounds changes. | 49 // Handle window bounds changes. |
| 48 void PrepareForBoundsChange(gfx::AcceleratedWidget window); | 50 void PrepareForBoundsChange(gfx::AcceleratedWidget window); |
| 49 void CommitBoundsChange(gfx::AcceleratedWidget window, | 51 |
| 50 const gfx::Rect& bounds); | 52 // Confines the cursor to |confined_bounds| for |window|. |
| 53 void ConfineCursorToBounds(gfx::AcceleratedWidget window, |
| 54 const gfx::Rect& bounds); |
| 51 | 55 |
| 52 // CursorDelegateEvdev: | 56 // CursorDelegateEvdev: |
| 53 void MoveCursorTo(gfx::AcceleratedWidget window, | 57 void MoveCursorTo(gfx::AcceleratedWidget window, |
| 54 const gfx::PointF& location) override; | 58 const gfx::PointF& location) override; |
| 55 void MoveCursorTo(const gfx::PointF& screen_location) override; | 59 void MoveCursorTo(const gfx::PointF& screen_location) override; |
| 56 void MoveCursor(const gfx::Vector2dF& delta) override; | 60 void MoveCursor(const gfx::Vector2dF& delta) override; |
| 57 bool IsCursorVisible() override; | 61 bool IsCursorVisible() override; |
| 58 gfx::PointF GetLocation() override; | 62 gfx::PointF GetLocation() override; |
| 59 gfx::Rect GetCursorDisplayBounds() override; | 63 gfx::Rect GetCursorConfinedBounds() override; |
| 60 | 64 |
| 61 // GpuPlatformSupportHost: | 65 // GpuPlatformSupportHost: |
| 62 void OnChannelEstablished( | 66 void OnChannelEstablished( |
| 63 int host_id, | 67 int host_id, |
| 64 scoped_refptr<base::SingleThreadTaskRunner> send_runner, | 68 scoped_refptr<base::SingleThreadTaskRunner> send_runner, |
| 65 const base::Callback<void(IPC::Message*)>& sender) override; | 69 const base::Callback<void(IPC::Message*)>& sender) override; |
| 66 void OnChannelDestroyed(int host_id) override; | 70 void OnChannelDestroyed(int host_id) override; |
| 67 | 71 |
| 68 // IPC::Listener: | 72 // IPC::Listener: |
| 69 bool OnMessageReceived(const IPC::Message& message) override; | 73 bool OnMessageReceived(const IPC::Message& message) override; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 95 // The current cursor bitmap (immutable). | 99 // The current cursor bitmap (immutable). |
| 96 scoped_refptr<BitmapCursorOzone> bitmap; | 100 scoped_refptr<BitmapCursorOzone> bitmap; |
| 97 | 101 |
| 98 // The window under the cursor. | 102 // The window under the cursor. |
| 99 gfx::AcceleratedWidget window; | 103 gfx::AcceleratedWidget window; |
| 100 | 104 |
| 101 // The location of the cursor within the window. | 105 // The location of the cursor within the window. |
| 102 gfx::PointF location; | 106 gfx::PointF location; |
| 103 | 107 |
| 104 // The bounds of the display under the cursor. | 108 // The bounds of the display under the cursor. |
| 105 gfx::Rect bounds; | 109 gfx::Rect display_bounds_in_screen; |
| 110 |
| 111 // The bounds that the cursor is confined to in |window|. |
| 112 gfx::Rect confined_bounds; |
| 106 | 113 |
| 107 int host_id; | 114 int host_id; |
| 108 | 115 |
| 109 // Callback for IPC updates. | 116 // Callback for IPC updates. |
| 110 base::Callback<void(IPC::Message*)> send_callback; | 117 base::Callback<void(IPC::Message*)> send_callback; |
| 111 scoped_refptr<base::SingleThreadTaskRunner> send_runner; | 118 scoped_refptr<base::SingleThreadTaskRunner> send_runner; |
| 112 | 119 |
| 113 // The mutex synchronizing this object. | 120 // The mutex synchronizing this object. |
| 114 base::Lock lock; | 121 base::Lock lock; |
| 115 }; | 122 }; |
| 116 | 123 |
| 117 CursorState state_; | 124 CursorState state_; |
| 118 }; | 125 }; |
| 119 | 126 |
| 120 } // namespace ui | 127 } // namespace ui |
| 121 | 128 |
| 122 #endif // UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_ | 129 #endif // UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_ |
| OLD | NEW |