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

Unified Diff: ui/aura/window_tree_host_x11.cc

Issue 2914103002: Remove usages of XInternAtom (Closed)
Patch Set: Address sadrul and sergeyu comments Created 3 years, 7 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/aura/window_tree_host_x11.h ('k') | ui/base/clipboard/clipboard_aurax11.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window_tree_host_x11.cc
diff --git a/ui/aura/window_tree_host_x11.cc b/ui/aura/window_tree_host_x11.cc
index af16258823ff6c266cf96651c6378f5fb397ce15..f59d99ecee569cdff01cbcc1ad6a9fb2c619c73f 100644
--- a/ui/aura/window_tree_host_x11.cc
+++ b/ui/aura/window_tree_host_x11.cc
@@ -59,13 +59,6 @@ namespace aura {
namespace {
-const char* kAtomsToCache[] = {
- "WM_DELETE_WINDOW",
- "_NET_WM_PING",
- "_NET_WM_PID",
- NULL
-};
-
constexpr uint32_t kInputEventMask =
ButtonPressMask | ButtonReleaseMask | FocusChangeMask | KeyPressMask |
KeyReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask;
@@ -122,8 +115,7 @@ WindowTreeHostX11::WindowTreeHostX11(const gfx::Rect& bounds)
x_root_window_(DefaultRootWindow(xdisplay_)),
current_cursor_(ui::CursorType::kNull),
window_mapped_(false),
- bounds_(bounds),
- atom_cache_(xdisplay_, kAtomsToCache) {
+ bounds_(bounds) {
XSetWindowAttributes swa;
memset(&swa, 0, sizeof(swa));
swa.background_pixmap = None;
@@ -153,8 +145,8 @@ WindowTreeHostX11::WindowTreeHostX11(const gfx::Rect& bounds)
// should listen for activation events and anything else that GTK+ listens
// for, and do something useful.
::Atom protocols[2];
- protocols[0] = atom_cache_.GetAtom("WM_DELETE_WINDOW");
- protocols[1] = atom_cache_.GetAtom("_NET_WM_PING");
+ protocols[0] = ui::GetAtom("WM_DELETE_WINDOW");
+ protocols[1] = ui::GetAtom("_NET_WM_PING");
XSetWMProtocols(xdisplay_, xwindow_, protocols, 2);
// We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with
@@ -168,16 +160,9 @@ WindowTreeHostX11::WindowTreeHostX11(const gfx::Rect& bounds)
static_assert(sizeof(long) >= sizeof(pid_t),
"pid_t should not be larger than long");
long pid = getpid();
- XChangeProperty(xdisplay_,
- xwindow_,
- atom_cache_.GetAtom("_NET_WM_PID"),
- XA_CARDINAL,
- 32,
- PropModeReplace,
- reinterpret_cast<unsigned char*>(&pid), 1);
-
- // Allow subclasses to create and cache additional atoms.
- atom_cache_.allow_uncached_atoms();
+ XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_PID"), XA_CARDINAL,
+ 32, PropModeReplace, reinterpret_cast<unsigned char*>(&pid),
+ 1);
XRRSelectInput(xdisplay_, x_root_window_,
RRScreenChangeNotifyMask | RROutputChangeNotifyMask);
@@ -322,10 +307,10 @@ uint32_t WindowTreeHostX11::DispatchEvent(const ui::PlatformEvent& event) {
break;
case ClientMessage: {
Atom message_type = static_cast<Atom>(xev->xclient.data.l[0]);
- if (message_type == atom_cache_.GetAtom("WM_DELETE_WINDOW")) {
+ if (message_type == ui::GetAtom("WM_DELETE_WINDOW")) {
// We have received a close message from the window manager.
OnHostCloseRequested();
- } else if (message_type == atom_cache_.GetAtom("_NET_WM_PING")) {
+ } else if (message_type == ui::GetAtom("_NET_WM_PING")) {
XEvent reply_event = *xev;
reply_event.xclient.window = x_root_window_;
« no previous file with comments | « ui/aura/window_tree_host_x11.h ('k') | ui/base/clipboard/clipboard_aurax11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698