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

Unified Diff: ash/display/cursor_window_controller.h

Issue 145313003: Implement cursor compositing mode on Ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Get rid of current_cursor_set_ and requested_cursor_set_ Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ash/display/cursor_window_controller.h
diff --git a/ash/display/cursor_window_controller.h b/ash/display/cursor_window_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..e2aece7e8fc791dcbde578b6a0dde4ebf8cb3880
--- /dev/null
+++ b/ash/display/cursor_window_controller.h
@@ -0,0 +1,77 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_
+#define ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_
+
+#include "ui/aura/window.h"
+#include "ui/base/cursor/cursor.h"
+#include "ui/gfx/display.h"
+
+namespace ash {
+namespace test{
+class MirrorWindowTestApi;
+}
+
+namespace internal {
+
+class CursorWindowDelegate;
+
+// Draws a mouse cursor on a given container window.
+// When cursor compositing is disabled, CursorWindowController is responsible
+// to scale and rotate the mouse cursor bitmap to match settings of the
+// primary display.
+// When cursor compositing is enabled, just draw the cursor as-is.
+class CursorWindowController {
+ public:
+ CursorWindowController();
+ ~CursorWindowController();
+
+ // Sets cursor compositing mode on/off.
+ void SetCursorCompositingEnabled(bool enabled);
+ bool is_cursor_compositing_enabled() const {
+ return is_cursor_compositing_enabled_;
+ }
+
+ // Sets the container window for the cursor window controller.
+ // Closes the cursor window if |container| is NULL.
+ void SetContainer(aura::Window* container);
+
+ // Sets the bounds of the container in screen coordinates.
+ void SetBoundsInScreen(const gfx::Rect& bounds);
+
+ // Sets cursor location, shape, set and visibility.
+ void UpdateLocation();
+ void SetCursor(gfx::NativeCursor cursor);
+ void SetCursorSet(ui::CursorSetType);
+ void SetVisibility(bool visible);
+
+ private:
+ friend class test::MirrorWindowTestApi;
+
+ void UpdateCursorImage();
+
+ bool is_cursor_compositing_enabled_;
+ aura::Window* container_;
+
+ // The bounds of the container in screen coordinates.
+ gfx::Rect bounds_in_screen_;
+
+ // The native_type of the cursor, see definitions in cursor.h
+ int cursor_type_;
+
+ ui::CursorSetType cursor_set_;
+ gfx::Display::Rotation cursor_rotation_;
+ gfx::Point hot_point_;
+
+ scoped_ptr<aura::Window> cursor_window_;
+ scoped_ptr<CursorWindowDelegate> delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(CursorWindowController);
+};
+
+} // namespace internal
+} // namespace ash
+
+#endif // ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698