Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: ui/ozone/platform/dri/dri_cursor.h

Issue 556073003: [Ozone-DRI] Do proper bounds checks when moving the cursor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@restore-cursor
Patch Set: Cache window Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 } 16 }
17 17
18 namespace ui { 18 namespace ui {
19 19
20 class BitmapCursorOzone; 20 class BitmapCursorOzone;
21 class BitmapCursorFactoryOzone; 21 class BitmapCursorFactoryOzone;
22 class DriWindow;
23 class DriWindowManager;
22 class HardwareCursorDelegate; 24 class HardwareCursorDelegate;
23 25
24 class DriCursor : public CursorDelegateEvdev { 26 class DriCursor : public CursorDelegateEvdev {
25 public: 27 public:
26 explicit DriCursor(HardwareCursorDelegate* hardware); 28 explicit DriCursor(HardwareCursorDelegate* hardware,
29 DriWindowManager* window_manager);
27 virtual ~DriCursor(); 30 virtual ~DriCursor();
28 31
29 void SetCursor(gfx::AcceleratedWidget widget, PlatformCursor platform_cursor); 32 void SetCursor(gfx::AcceleratedWidget widget, PlatformCursor platform_cursor);
30 void ShowCursor(); 33 void ShowCursor();
31 void HideCursor(); 34 void HideCursor();
32 gfx::AcceleratedWidget GetCursorWindow(); 35 gfx::AcceleratedWidget GetCursorWindow();
33 36
34 // CursorDelegateEvdev: 37 // CursorDelegateEvdev:
35 virtual void MoveCursorTo(gfx::AcceleratedWidget widget, 38 virtual void MoveCursorTo(gfx::AcceleratedWidget widget,
36 const gfx::PointF& location) OVERRIDE; 39 const gfx::PointF& location) OVERRIDE;
37 virtual void MoveCursor(const gfx::Vector2dF& delta) OVERRIDE; 40 virtual void MoveCursor(const gfx::Vector2dF& delta) OVERRIDE;
38 virtual bool IsCursorVisible() OVERRIDE; 41 virtual bool IsCursorVisible() OVERRIDE;
39 virtual gfx::PointF location() OVERRIDE; 42 virtual gfx::PointF location() OVERRIDE;
40 43
41 private: 44 private:
42 // The location of the bitmap (the cursor location is the hotspot location). 45 // The location of the bitmap (the cursor location is the hotspot location).
43 gfx::Point bitmap_location(); 46 gfx::Point bitmap_location();
44 47
45 // The DRI implementation for setting the hardware cursor. 48 // The DRI implementation for setting the hardware cursor.
46 HardwareCursorDelegate* hardware_; 49 HardwareCursorDelegate* hardware_;
47 50
51 DriWindowManager* window_manager_; // Not owned.
52
48 // The current cursor bitmap. 53 // The current cursor bitmap.
49 scoped_refptr<BitmapCursorOzone> cursor_; 54 scoped_refptr<BitmapCursorOzone> cursor_;
50 55
51 // The window under the cursor. 56 // The window under the cursor.
52 gfx::AcceleratedWidget cursor_window_; 57 gfx::AcceleratedWidget cursor_widget_;
58
59 // The window associated with |cursor_widget_|.
60 DriWindow* cursor_window_;
53 61
54 // The location of the cursor within the window. 62 // The location of the cursor within the window.
55 gfx::PointF cursor_location_; 63 gfx::PointF cursor_location_;
56 }; 64 };
57 65
58 } // namespace ui 66 } // namespace ui
59 67
60 #endif // UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_ 68 #endif // UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698