OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/base/x/x11_atom_cache.h" | |
6 | |
7 #include <X11/Xatom.h> | |
8 | |
9 #include "base/message_pump_x.h" | |
10 | |
11 namespace { | |
12 | |
13 // A list of atoms that we'll intern on host creation to save roundtrips to the | |
14 // X11 server. Must be kept in sync with AtomCache::AtomName | |
Daniel Erat
2012/05/15 20:59:41
This makes me nervous (especially combined with no
Elliot Glaysher
2012/05/15 21:56:32
Done.
| |
15 const char* kAtomList[] = { | |
16 "WM_DELETE_WINDOW", | |
17 "_NET_WM_MOVERESIZE", | |
18 "_NET_WM_PING", | |
19 "_NET_WM_PID", | |
20 "WM_S0", | |
21 "_MOTIF_WM_HINTS" | |
22 }; | |
23 | |
24 } // namespace | |
25 | |
26 namespace ui { | |
27 | |
28 X11AtomCache* X11AtomCache::GetInstance() { | |
29 return Singleton<X11AtomCache>::get(); | |
30 } | |
31 | |
32 ::Atom X11AtomCache::GetAtom(AtomName name) const { | |
33 return cached_atoms_[name]; | |
34 } | |
35 | |
36 X11AtomCache::X11AtomCache() { | |
37 // Grab all the atoms we need now to minimize roundtrips to the X11 server. | |
38 XInternAtoms(base::MessagePumpX::GetDefaultXDisplay(), | |
39 const_cast<char**>(kAtomList), ATOM_COUNT, False, | |
40 cached_atoms_); | |
41 } | |
42 | |
43 X11AtomCache::~X11AtomCache() {} | |
44 | |
45 } // namespace ui | |
46 | |
47 | |
OLD | NEW |