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

Unified Diff: ui/aura/root_window_host_linux.cc

Issue 10381063: Aura/ash split: Don't use X11 window borders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: derat comments Created 8 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/root_window_host_linux.h ('k') | ui/base/x/x11_atom_cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/root_window_host_linux.cc
diff --git a/ui/aura/root_window_host_linux.cc b/ui/aura/root_window_host_linux.cc
index 4f42775ff14aa9e8c40e44b6a4b72b2f86672dab..af307806dc9cf0b754b7a57dfe47ad3ff15b9bf5 100644
--- a/ui/aura/root_window_host_linux.cc
+++ b/ui/aura/root_window_host_linux.cc
@@ -27,10 +27,12 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/touch/touch_factory.h"
#include "ui/base/view_prop.h"
+#include "ui/base/x/x11_atom_cache.h"
#include "ui/base/x/x11_util.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/image/image.h"
+using ui::X11AtomCache;
using std::max;
using std::min;
@@ -286,15 +288,6 @@ bool ShouldSendCharEventForKeyboardCode(ui::KeyboardCode keycode) {
}
}
-// A list of atoms that we'll intern on host creation to save roundtrips to the
-// X11 server. Must be kept in sync with RootWindowHostLinux::AtomList
-const char* kAtomList[] = {
- "WM_DELETE_WINDOW",
- "_NET_WM_PING",
- "_NET_WM_PID",
- "WM_S0"
-};
-
} // namespace
// A utility class that provides X Cursor for NativeCursors for which we have
@@ -395,16 +388,13 @@ RootWindowHostLinux::RootWindowHostLinux(const gfx::Rect& bounds)
if (RootWindow::hide_host_cursor())
XDefineCursor(xdisplay_, x_root_window_, invisible_cursor_);
- // Grab all the atoms we need now to minimize roundtrips to the X11 server.
- XInternAtoms(xdisplay_, const_cast<char**>(kAtomList), ATOM_COUNT, False,
- cached_atoms_);
-
// TODO(erg): We currently only request window deletion events. We also
// should listen for activation events and anything else that GTK+ listens
// for, and do something useful.
+ X11AtomCache* cache = X11AtomCache::GetInstance();
::Atom protocols[2];
- protocols[0] = cached_atoms_[ATOM_WM_DELETE_WINDOW];
- protocols[1] = cached_atoms_[ATOM__NET_WM_PING];
+ protocols[0] = cache->GetAtom(ui::ATOM_WM_DELETE_WINDOW);
+ protocols[1] = cache->GetAtom(ui::ATOM__NET_WM_PING);
XSetWMProtocols(xdisplay_, xwindow_, protocols, 2);
// We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with
@@ -416,7 +406,7 @@ RootWindowHostLinux::RootWindowHostLinux(const gfx::Rect& bounds)
pid_t pid = getpid();
XChangeProperty(xdisplay_,
xwindow_,
- cached_atoms_[ATOM__NET_WM_PID],
+ cache->GetAtom(ui::ATOM__NET_WM_PID),
XA_CARDINAL,
32,
PropModeReplace,
@@ -588,10 +578,11 @@ bool RootWindowHostLinux::Dispatch(const base::NativeEvent& event) {
}
case ClientMessage: {
Atom message_type = static_cast<Atom>(xev->xclient.data.l[0]);
- if (message_type == cached_atoms_[ATOM_WM_DELETE_WINDOW]) {
+ X11AtomCache* cache = X11AtomCache::GetInstance();
+ if (message_type == cache->GetAtom(ui::ATOM_WM_DELETE_WINDOW)) {
// We have received a close message from the window manager.
root_window_->OnRootWindowHostClosed();
- } else if (message_type == cached_atoms_[ATOM__NET_WM_PING]) {
+ } else if (message_type == cache->GetAtom(ui::ATOM__NET_WM_PING)) {
XEvent reply_event = *xev;
reply_event.xclient.window = x_root_window_;
@@ -840,7 +831,9 @@ void RootWindowHostLinux::PostNativeEvent(
bool RootWindowHostLinux::IsWindowManagerPresent() {
// Per ICCCM 2.8, "Manager Selections", window managers should take ownership
// of WM_Sn selections (where n is a screen number).
- return XGetSelectionOwner(xdisplay_, cached_atoms_[ATOM_WM_S0]) != None;
+ return XGetSelectionOwner(
+ xdisplay_,
+ X11AtomCache::GetInstance()->GetAtom(ui::ATOM_WM_S0)) != None;
}
void RootWindowHostLinux::SetCursorInternal(gfx::NativeCursor cursor) {
« no previous file with comments | « ui/aura/root_window_host_linux.h ('k') | ui/base/x/x11_atom_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698