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

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

Issue 8387043: [Aura] Support always-on-top top level window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win_aura bot Created 9 years, 1 month 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: ui/base/x/x11_util.cc
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc
index 873996fd451f7b7ae3cbe9798b332282b70de9d1..4beee61d2d6035c3eb2a550526838bd94786cd6b 100644
--- a/ui/base/x/x11_util.cc
+++ b/ui/base/x/x11_util.cc
@@ -113,12 +113,7 @@ class XCursorCache {
public:
XCursorCache() {}
~XCursorCache() {
- Display* display = base::MessagePumpForUI::GetDefaultXDisplay();
- for (std::map<int, Cursor>::iterator it =
- cache_.begin(); it != cache_.end(); ++it) {
- XFreeCursor(display, it->second);
- }
- cache_.clear();
+ Clear();
}
Cursor GetCursor(int cursor_shape) {
@@ -133,6 +128,15 @@ class XCursorCache {
return it.first->second;
}
+ void Clear() {
+ Display* display = base::MessagePumpForUI::GetDefaultXDisplay();
+ for (std::map<int, Cursor>::iterator it =
+ cache_.begin(); it != cache_.end(); ++it) {
+ XFreeCursor(display, it->second);
+ }
+ cache_.clear();
+ }
+
private:
// Maps X11 font cursor shapes to Cursor IDs.
std::map<int, Cursor> cache_;
@@ -215,8 +219,15 @@ int GetDefaultScreen(Display* display) {
return XDefaultScreen(display);
}
+const int kCursorClearXCursorCache = -1;
Cursor GetXCursor(int cursor_shape) {
static XCursorCache cache;
+
+ if (cursor_shape == kCursorClearXCursorCache) {
+ cache.Clear();
+ return NULL;
+ }
+
return cache.GetCursor(cursor_shape);
}

Powered by Google App Engine
This is Rietveld 408576698