Chromium Code Reviews

Side by Side Diff: ui/base/x/x11_util.cc

Issue 235043005: x11: Remove X11 message-pump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file defines utility functions for X11 (Linux only). This code has been 5 // This file defines utility functions for X11 (Linux only). This code has been
6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support 6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support
7 // remains woefully incomplete. 7 // remains woefully incomplete.
8 8
9 #include "ui/base/x/x11_util.h" 9 #include "ui/base/x/x11_util.h"
10 10
(...skipping 126 matching lines...)
137 ~XCursorCache() { 137 ~XCursorCache() {
138 Clear(); 138 Clear();
139 } 139 }
140 140
141 ::Cursor GetCursor(int cursor_shape) { 141 ::Cursor GetCursor(int cursor_shape) {
142 // Lookup cursor by attempting to insert a null value, which avoids 142 // Lookup cursor by attempting to insert a null value, which avoids
143 // a second pass through the map after a cache miss. 143 // a second pass through the map after a cache miss.
144 std::pair<std::map<int, ::Cursor>::iterator, bool> it = cache_.insert( 144 std::pair<std::map<int, ::Cursor>::iterator, bool> it = cache_.insert(
145 std::make_pair(cursor_shape, 0)); 145 std::make_pair(cursor_shape, 0));
146 if (it.second) { 146 if (it.second) {
147 XDisplay* display = base::MessagePumpForUI::GetDefaultXDisplay(); 147 XDisplay* display = gfx::GetXDisplay();
148 it.first->second = XCreateFontCursor(display, cursor_shape); 148 it.first->second = XCreateFontCursor(display, cursor_shape);
149 } 149 }
150 return it.first->second; 150 return it.first->second;
151 } 151 }
152 152
153 void Clear() { 153 void Clear() {
154 XDisplay* display = base::MessagePumpForUI::GetDefaultXDisplay(); 154 XDisplay* display = gfx::GetXDisplay();
155 for (std::map<int, ::Cursor>::iterator it = 155 for (std::map<int, ::Cursor>::iterator it =
156 cache_.begin(); it != cache_.end(); ++it) { 156 cache_.begin(); it != cache_.end(); ++it) {
157 XFreeCursor(display, it->second); 157 XFreeCursor(display, it->second);
158 } 158 }
159 cache_.clear(); 159 cache_.clear();
160 } 160 }
161 161
162 private: 162 private:
163 // Maps X11 font cursor shapes to Cursor IDs. 163 // Maps X11 font cursor shapes to Cursor IDs.
164 std::map<int, ::Cursor> cache_; 164 std::map<int, ::Cursor> cache_;
(...skipping 1372 matching lines...)
1537 << "request_code " << static_cast<int>(error_event.request_code) << ", " 1537 << "request_code " << static_cast<int>(error_event.request_code) << ", "
1538 << "minor_code " << static_cast<int>(error_event.minor_code) 1538 << "minor_code " << static_cast<int>(error_event.minor_code)
1539 << " (" << request_str << ")"; 1539 << " (" << request_str << ")";
1540 } 1540 }
1541 1541
1542 // ---------------------------------------------------------------------------- 1542 // ----------------------------------------------------------------------------
1543 // End of x11_util_internal.h 1543 // End of x11_util_internal.h
1544 1544
1545 1545
1546 } // namespace ui 1546 } // namespace ui
OLDNEW

Powered by Google App Engine