ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / ash / display / cursor_window_controller.h
blob6e55c2f9b7235bdf850cc5c0b2ebcef0c1777eb3
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 ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_
6 #define ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_
8 #include "ash/ash_export.h"
9 #include "ui/aura/window.h"
10 #include "ui/base/cursor/cursor.h"
11 #include "ui/gfx/display.h"
13 namespace ash {
14 namespace test {
15 class MirrorWindowTestApi;
18 class CursorWindowDelegate;
20 // Draws a mouse cursor on a given container window.
21 // When cursor compositing is disabled, CursorWindowController is responsible
22 // to scale and rotate the mouse cursor bitmap to match settings of the
23 // primary display.
24 // When cursor compositing is enabled, just draw the cursor as-is.
25 class ASH_EXPORT CursorWindowController {
26 public:
27 CursorWindowController();
28 ~CursorWindowController();
30 bool is_cursor_compositing_enabled() const {
31 return is_cursor_compositing_enabled_;
34 // Sets cursor compositing mode on/off.
35 void SetCursorCompositingEnabled(bool enabled);
37 // Updates the container window for the cursor window controller.
38 void UpdateContainer();
40 // Sets the display on which to draw cursor.
41 // Only applicable when cursor compositing is enabled.
42 void SetDisplay(const gfx::Display& display);
44 // Sets cursor location, shape, set and visibility.
45 void UpdateLocation();
46 void SetCursor(gfx::NativeCursor cursor);
47 void SetCursorSet(ui::CursorSetType);
48 void SetVisibility(bool visible);
50 private:
51 friend class test::MirrorWindowTestApi;
53 // Sets the container window for the cursor window controller.
54 // Closes the cursor window if |container| is NULL.
55 void SetContainer(aura::Window* container);
57 // Sets the bounds of the container in screen coordinates.
58 void SetBoundsInScreen(const gfx::Rect& bounds);
60 // Updates cursor image based on current cursor state.
61 void UpdateCursorImage();
63 bool is_cursor_compositing_enabled_;
64 aura::Window* container_;
66 // The bounds of the container in screen coordinates.
67 gfx::Rect bounds_in_screen_;
69 // The native_type of the cursor, see definitions in cursor.h
70 int cursor_type_;
72 ui::CursorSetType cursor_set_;
73 gfx::Display::Rotation cursor_rotation_;
74 gfx::Point hot_point_;
76 // The display on which the cursor is drawn.
77 // For mirroring mode, the display is always the primary display.
78 gfx::Display display_;
80 scoped_ptr<aura::Window> cursor_window_;
81 scoped_ptr<CursorWindowDelegate> delegate_;
83 DISALLOW_COPY_AND_ASSIGN(CursorWindowController);
86 } // namespace ash
88 #endif // ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_