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

Unified Diff: ui/base/x/x11_util.cc

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/x/x11_util.h ('k') | ui/ui.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/x/x11_util.cc
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc
index efe05aff1ceaa0d9b72b399d587468a25a355849..05f50ecb71d8c4e91e6771c6b4204da26868c9fb 100644
--- a/ui/base/x/x11_util.cc
+++ b/ui/base/x/x11_util.cc
@@ -453,6 +453,28 @@ XcursorImage* SkBitmapToXcursorImage(const SkBitmap* bitmap,
}
#endif
+void HideHostCursor() {
+ CR_DEFINE_STATIC_LOCAL(XScopedCursor, invisible_cursor,
+ (CreateInvisibleCursor(), ui::GetXDisplay()));
+ XDefineCursor(ui::GetXDisplay(), DefaultRootWindow(ui::GetXDisplay()),
+ invisible_cursor.get());
+}
+
+::Cursor CreateInvisibleCursor() {
+ Display* xdisplay = ui::GetXDisplay();
+ ::Cursor invisible_cursor;
+ char nodata[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ XColor black;
+ black.red = black.green = black.blue = 0;
+ Pixmap blank = XCreateBitmapFromData(xdisplay,
+ DefaultRootWindow(xdisplay),
+ nodata, 8, 8);
+ invisible_cursor = XCreatePixmapCursor(xdisplay, blank, blank,
+ &black, &black, 0, 0);
+ XFreePixmap(xdisplay, blank);
+ return invisible_cursor;
+}
+
XID GetX11RootWindow() {
return DefaultRootWindow(GetXDisplay());
}
@@ -1352,6 +1374,25 @@ XScopedString::~XScopedString() {
XFree(string_);
}
+XScopedCursor::XScopedCursor(::Cursor cursor, Display* display)
+ : cursor_(cursor),
+ display_(display) {
+}
+
+XScopedCursor::~XScopedCursor() {
+ reset(0U);
+}
+
+::Cursor XScopedCursor::get() const {
+ return cursor_;
+}
+
+void XScopedCursor::reset(::Cursor cursor) {
+ if (cursor_)
+ XFreeCursor(display_, cursor_);
+ cursor_ = cursor;
+}
+
// ----------------------------------------------------------------------------
// These functions are declared in x11_util_internal.h because they require
// XLib.h to be included, and it conflicts with many other headers.
« no previous file with comments | « ui/base/x/x11_util.h ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698