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

Unified Diff: ui/base/cursor/cursor_loader_x11.h

Issue 10919135: Move ash specific cursor code to CursorManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/cursor/cursor_loader_win.cc ('k') | ui/base/cursor/cursor_loader_x11.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/cursor/cursor_loader_x11.h
diff --git a/ui/base/cursor/cursor_loader_x11.h b/ui/base/cursor/cursor_loader_x11.h
new file mode 100644
index 0000000000000000000000000000000000000000..32f0e1a52f7916739a137a6ae2d985bef2f0dc7b
--- /dev/null
+++ b/ui/base/cursor/cursor_loader_x11.h
@@ -0,0 +1,58 @@
+// Copyright (c) 2012 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 UI_BASE_CURSOR_CURSOR_LOADER_X11_H_
+#define UI_BASE_CURSOR_CURSOR_LOADER_X11_H_
+
+#include <X11/Xcursor/Xcursor.h>
+#include <map>
+
+#include "base/compiler_specific.h"
+#include "ui/base/cursor/cursor.h"
+#include "ui/base/cursor/cursor_loader.h"
+
+namespace ui {
+
+class CursorLoaderX11 : public CursorLoader {
+ public:
+ CursorLoaderX11();
+ virtual ~CursorLoaderX11();
+
+ // Overridden from CursorLoader:
+ virtual void LoadImageCursor(int id,
+ int resource_id,
+ const gfx::Point& hot) OVERRIDE;
+ virtual void LoadAnimatedCursor(int id,
+ int resource_id,
+ const gfx::Point& hot,
+ int frame_delay_ms) OVERRIDE;
+ virtual void UnloadAll() OVERRIDE;
+ virtual void SetPlatformCursor(gfx::NativeCursor* cursor) OVERRIDE;
+
+ private:
+ // Returns true if we have an image resource loaded for the |native_cursor|.
+ bool IsImageCursor(gfx::NativeCursor native_cursor);
+
+ // Gets the X Cursor corresponding to the |native_cursor|.
+ ::Cursor ImageCursorFromNative(gfx::NativeCursor native_cursor);
+
+ // A map to hold all image cursors. It maps the cursor ID to the X Cursor.
+ typedef std::map<int, ::Cursor> ImageCursorMap;
+ ImageCursorMap cursors_;
+
+ // A map to hold all animated cursors. It maps the cursor ID to the pair of
+ // the X Cursor and the corresponding XcursorImages. We need a pointer to the
+ // images so that we can free them on destruction.
+ typedef std::map<int, std::pair< ::Cursor, XcursorImages*> >
+ AnimatedCursorMap;
+ AnimatedCursorMap animated_cursors_;
+
+ ::Cursor invisible_cursor_;
+
+ DISALLOW_COPY_AND_ASSIGN(CursorLoaderX11);
+};
+
+} // namespace ui
+
+#endif // UI_BASE_CURSOR_CURSOR_LOADER_X11_H_
« no previous file with comments | « ui/base/cursor/cursor_loader_win.cc ('k') | ui/base/cursor/cursor_loader_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698