summaryrefslogtreecommitdiffstats
path: root/ui/base
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-15 00:20:18 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-15 00:20:18 +0000
commit488b420457ae3b003ba2cd9e9dd12fc4067833ec (patch)
tree0f70baea04a2a50ab27203a4b01a2a0d249e1851 /ui/base
parentf3fa076c5af0d1f384fa298bced8fddcac912a6e (diff)
downloadchromium_src-488b420457ae3b003ba2cd9e9dd12fc4067833ec.zip
chromium_src-488b420457ae3b003ba2cd9e9dd12fc4067833ec.tar.gz
chromium_src-488b420457ae3b003ba2cd9e9dd12fc4067833ec.tar.bz2
[Aura] Support always-on-top top level window.
BUG=97256,102582 TEST=AlwaysOnTop related tests in ShellTest should pass. Review URL: http://codereview.chromium.org/8387043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109990 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base')
-rw-r--r--ui/base/x/x11_util.cc22
-rw-r--r--ui/base/x/x11_util.h4
2 files changed, 20 insertions, 6 deletions
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc
index dada148..aa11de8 100644
--- a/ui/base/x/x11_util.cc
+++ b/ui/base/x/x11_util.cc
@@ -114,12 +114,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) {
@@ -134,6 +129,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_;
@@ -218,6 +222,12 @@ int GetDefaultScreen(Display* display) {
Cursor GetXCursor(int cursor_shape) {
CR_DEFINE_STATIC_LOCAL(XCursorCache, cache, ());
+
+ if (cursor_shape == kCursorClearXCursorCache) {
+ cache.Clear();
+ return 0;
+ }
+
return cache.GetCursor(cursor_shape);
}
diff --git a/ui/base/x/x11_util.h b/ui/base/x/x11_util.h
index f9e979c..888e76a 100644
--- a/ui/base/x/x11_util.h
+++ b/ui/base/x/x11_util.h
@@ -68,6 +68,10 @@ UI_EXPORT bool QueryRenderSupport(Display* dpy);
// Return the default screen number for the display
int GetDefaultScreen(Display* display);
+// TODO(xiyuan): Fix the stale XCursorCache problem per http://crbug.com/102759.
+// A special cursor that makes GetXCursor below to clear its XCursorCache.
+const int kCursorClearXCursorCache = -1;
+
// Returns an X11 Cursor, sharable across the process.
// |cursor_shape| is an X font cursor shape, see XCreateFontCursor().
UI_EXPORT Cursor GetXCursor(int cursor_shape);