diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-16 21:34:42 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-16 21:34:42 +0000 |
commit | b3dd7665842ee6b0536c6c73ce86f64963795664 (patch) | |
tree | e045cfebc39099cf1f2159e78b05dc40d5cfc8af /ui/aura | |
parent | 9f56b2f4095b98639412f1d3b691a378de1623de (diff) | |
download | chromium_src-b3dd7665842ee6b0536c6c73ce86f64963795664.zip chromium_src-b3dd7665842ee6b0536c6c73ce86f64963795664.tar.gz chromium_src-b3dd7665842ee6b0536c6c73ce86f64963795664.tar.bz2 |
Aura/ash split: Don't use X11 window borders.
This disables window manager borders, and supports dragging of the
skyline, as well as resizing from the corners.
This patch also moves our ::Atom caching out of RootWindowHostLinux and into its own Singleton.
BUG=125106
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10381063
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137525 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura')
-rw-r--r-- | ui/aura/root_window_host_linux.cc | 31 | ||||
-rw-r--r-- | ui/aura/root_window_host_linux.h | 12 |
2 files changed, 12 insertions, 31 deletions
diff --git a/ui/aura/root_window_host_linux.cc b/ui/aura/root_window_host_linux.cc index 4f42775..af30780 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) { diff --git a/ui/aura/root_window_host_linux.h b/ui/aura/root_window_host_linux.h index 34484e4..7accce9 100644 --- a/ui/aura/root_window_host_linux.h +++ b/ui/aura/root_window_host_linux.h @@ -82,18 +82,6 @@ class RootWindowHostLinux : public RootWindowHost, // The bounds of |xwindow_|. gfx::Rect bounds_; - // Names of cached atoms that we fetch during the constructor to minimize - // round trips to the X11 server. - enum AtomList { - ATOM_WM_DELETE_WINDOW = 0, - ATOM__NET_WM_PING, - ATOM__NET_WM_PID, - ATOM_WM_S0, - - ATOM_COUNT - }; - ::Atom cached_atoms_[ATOM_COUNT]; - // True if the window should be focused when the window is shown. bool focus_when_shown_; |