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

Unified Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 2924343002: Move ui::GetAtom to gfx::GetAtom (Closed)
Patch Set: fix CrOs build Created 3 years, 6 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
Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
index aacca36ce815f1107eb27c2b36ef2ce4d353a092..1414ba2b760f7f74b9b46760140480fd749f78c3 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -48,6 +48,7 @@
#include "ui/gfx/image/image_skia_rep.h"
#include "ui/gfx/path.h"
#include "ui/gfx/path_x11.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/views/corewm/tooltip_aura.h"
#include "ui/views/linux_ui/linux_ui.h"
#include "ui/views/views_delegate.h"
@@ -731,7 +732,7 @@ void DesktopWindowTreeHostX11::Activate() {
// https://code.google.com/p/wmii/issues/detail?id=266
static bool wm_supports_active_window =
ui::GuessWindowManager() != ui::WM_WMII &&
- ui::WmSupportsHint(ui::GetAtom("_NET_ACTIVE_WINDOW"));
+ ui::WmSupportsHint(gfx::GetAtom("_NET_ACTIVE_WINDOW"));
Time timestamp = ui::X11EventSource::GetInstance()->GetTimestamp();
@@ -740,7 +741,7 @@ void DesktopWindowTreeHostX11::Activate() {
memset(&xclient, 0, sizeof(xclient));
xclient.type = ClientMessage;
xclient.xclient.window = xwindow_;
- xclient.xclient.message_type = ui::GetAtom("_NET_ACTIVE_WINDOW");
+ xclient.xclient.message_type = gfx::GetAtom("_NET_ACTIVE_WINDOW");
xclient.xclient.format = 32;
xclient.xclient.data.l[0] = 1; // Specified we are an app.
xclient.xclient.data.l[1] = timestamp;
@@ -797,7 +798,7 @@ bool DesktopWindowTreeHostX11::IsActive() const {
void DesktopWindowTreeHostX11::Maximize() {
if (HasWMSpecProperty("_NET_WM_STATE_FULLSCREEN")) {
// Unfullscreen the window if it is fullscreen.
- SetWMSpecState(false, ui::GetAtom("_NET_WM_STATE_FULLSCREEN"), None);
+ SetWMSpecState(false, gfx::GetAtom("_NET_WM_STATE_FULLSCREEN"), None);
// Resize the window so that it does not have the same size as a monitor.
// (Otherwise, some window managers immediately put the window back in
@@ -817,8 +818,8 @@ void DesktopWindowTreeHostX11::Maximize() {
// heuristics that are in the PropertyNotify and ConfigureNotify handlers.
restored_bounds_in_pixels_ = bounds_in_pixels_;
- SetWMSpecState(true, ui::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"),
- ui::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ"));
+ SetWMSpecState(true, gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"),
+ gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ"));
if (IsMinimized())
ShowWindowWithState(ui::SHOW_STATE_NORMAL);
}
@@ -830,8 +831,8 @@ void DesktopWindowTreeHostX11::Minimize() {
void DesktopWindowTreeHostX11::Restore() {
should_maximize_after_map_ = false;
- SetWMSpecState(false, ui::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"),
- ui::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ"));
+ SetWMSpecState(false, gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"),
+ gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ"));
if (IsMinimized())
ShowWindowWithState(ui::SHOW_STATE_NORMAL);
}
@@ -851,7 +852,7 @@ bool DesktopWindowTreeHostX11::HasCapture() const {
void DesktopWindowTreeHostX11::SetAlwaysOnTop(bool always_on_top) {
is_always_on_top_ = always_on_top;
- SetWMSpecState(always_on_top, ui::GetAtom("_NET_WM_STATE_ABOVE"), None);
+ SetWMSpecState(always_on_top, gfx::GetAtom("_NET_WM_STATE_ABOVE"), None);
}
bool DesktopWindowTreeHostX11::IsAlwaysOnTop() const {
@@ -859,7 +860,7 @@ bool DesktopWindowTreeHostX11::IsAlwaysOnTop() const {
}
void DesktopWindowTreeHostX11::SetVisibleOnAllWorkspaces(bool always_visible) {
- SetWMSpecState(always_visible, ui::GetAtom("_NET_WM_STATE_STICKY"), None);
+ SetWMSpecState(always_visible, gfx::GetAtom("_NET_WM_STATE_STICKY"), None);
int new_desktop = 0;
if (always_visible) {
@@ -874,7 +875,7 @@ void DesktopWindowTreeHostX11::SetVisibleOnAllWorkspaces(bool always_visible) {
memset (&xevent, 0, sizeof (xevent));
xevent.type = ClientMessage;
xevent.xclient.window = xwindow_;
- xevent.xclient.message_type = ui::GetAtom("_NET_WM_DESKTOP");
+ xevent.xclient.message_type = gfx::GetAtom("_NET_WM_DESKTOP");
xevent.xclient.format = 32;
xevent.xclient.data.l[0] = new_desktop;
xevent.xclient.data.l[1] = 0;
@@ -899,8 +900,8 @@ bool DesktopWindowTreeHostX11::SetWindowTitle(const base::string16& title) {
return false;
window_title_ = title;
std::string utf8str = base::UTF16ToUTF8(title);
- XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_NAME"),
- ui::GetAtom("UTF8_STRING"), 8, PropModeReplace,
+ XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_NAME"),
+ gfx::GetAtom("UTF8_STRING"), 8, PropModeReplace,
reinterpret_cast<const unsigned char*>(utf8str.c_str()),
utf8str.size());
XTextProperty xtp;
@@ -997,7 +998,7 @@ void DesktopWindowTreeHostX11::SetFullscreen(bool fullscreen) {
if (unmaximize_and_remaximize)
Restore();
- SetWMSpecState(fullscreen, ui::GetAtom("_NET_WM_STATE_FULLSCREEN"), None);
+ SetWMSpecState(fullscreen, gfx::GetAtom("_NET_WM_STATE_FULLSCREEN"), None);
if (unmaximize_and_remaximize)
Maximize();
@@ -1042,9 +1043,10 @@ void DesktopWindowTreeHostX11::SetOpacity(float opacity) {
unsigned long cardinality = opacity_8bit * channel_multiplier;
if (cardinality == 0xffffffff) {
- XDeleteProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_WINDOW_OPACITY"));
+ XDeleteProperty(xdisplay_, xwindow_,
+ gfx::GetAtom("_NET_WM_WINDOW_OPACITY"));
} else {
- XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_WINDOW_OPACITY"),
+ XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_WINDOW_OPACITY"),
XA_CARDINAL, 32, PropModeReplace,
reinterpret_cast<unsigned char*>(&cardinality), 1);
}
@@ -1302,22 +1304,22 @@ void DesktopWindowTreeHostX11::InitX11Window(
switch (params.type) {
case Widget::InitParams::TYPE_MENU:
swa.override_redirect = True;
- window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_MENU");
+ window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_MENU");
break;
case Widget::InitParams::TYPE_TOOLTIP:
swa.override_redirect = True;
- window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_TOOLTIP");
+ window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_TOOLTIP");
break;
case Widget::InitParams::TYPE_POPUP:
swa.override_redirect = True;
- window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_NOTIFICATION");
+ window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_NOTIFICATION");
break;
case Widget::InitParams::TYPE_DRAG:
swa.override_redirect = True;
- window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_DND");
+ window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_DND");
break;
default:
- window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_NORMAL");
+ window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_NORMAL");
break;
}
// An in-activatable window should not interact with the system wm.
@@ -1386,8 +1388,8 @@ void DesktopWindowTreeHostX11::InitX11Window(
// should listen for activation events and anything else that GTK+ listens
// for, and do something useful.
::Atom protocols[2];
- protocols[0] = ui::GetAtom("WM_DELETE_WINDOW");
- protocols[1] = ui::GetAtom("_NET_WM_PING");
+ protocols[0] = gfx::GetAtom("WM_DELETE_WINDOW");
+ protocols[1] = gfx::GetAtom("_NET_WM_PING");
XSetWMProtocols(xdisplay_, xwindow_, protocols, 2);
// We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with
@@ -1400,11 +1402,11 @@ void DesktopWindowTreeHostX11::InitX11Window(
static_assert(sizeof(long) >= sizeof(pid_t),
"pid_t should not be larger than long");
long pid = getpid();
- XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_PID"), XA_CARDINAL,
+ XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_PID"), XA_CARDINAL,
32, PropModeReplace, reinterpret_cast<unsigned char*>(&pid),
1);
- XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_WINDOW_TYPE"),
+ XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_WINDOW_TYPE"),
XA_ATOM, 32, PropModeReplace,
reinterpret_cast<unsigned char*>(&window_type), 1);
@@ -1415,18 +1417,18 @@ void DesktopWindowTreeHostX11::InitX11Window(
if ((params.type == Widget::InitParams::TYPE_POPUP ||
params.type == Widget::InitParams::TYPE_BUBBLE) &&
!params.force_show_in_taskbar) {
- state_atom_list.push_back(ui::GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
+ state_atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
}
// If the window should stay on top of other windows, add the
// _NET_WM_STATE_ABOVE property.
is_always_on_top_ = params.keep_on_top;
if (is_always_on_top_)
- state_atom_list.push_back(ui::GetAtom("_NET_WM_STATE_ABOVE"));
+ state_atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_ABOVE"));
workspace_.clear();
if (params.visible_on_all_workspaces) {
- state_atom_list.push_back(ui::GetAtom("_NET_WM_STATE_STICKY"));
+ state_atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_STICKY"));
ui::SetIntProperty(xwindow_, "_NET_WM_DESKTOP", "CARDINAL", kAllDesktops);
} else if (!params.workspace.empty()) {
int workspace;
@@ -1521,7 +1523,7 @@ gfx::Size DesktopWindowTreeHostX11::AdjustSize(
void DesktopWindowTreeHostX11::OnWMStateUpdated() {
std::vector< ::Atom> atom_list;
- // Ignore the return value of ui::GetAtomArrayProperty(). Fluxbox removes the
+ // Ignore the return value of gfx::GetAtomArrayProperty(). Fluxbox removes the
// _NET_WM_STATE property when no _NET_WM_STATE atoms are set.
ui::GetAtomArrayProperty(xwindow_, "_NET_WM_STATE", &atom_list);
@@ -1643,7 +1645,7 @@ void DesktopWindowTreeHostX11::UpdateWMUserTime(
type == ui::ET_TOUCH_PRESSED) {
unsigned long wm_user_time_ms = static_cast<unsigned long>(
(ui::EventTimeFromNative(event) - base::TimeTicks()).InMilliseconds());
- XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_USER_TIME"),
+ XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_USER_TIME"),
XA_CARDINAL, 32, PropModeReplace,
reinterpret_cast<const unsigned char*>(&wm_user_time_ms),
1);
@@ -1657,7 +1659,7 @@ void DesktopWindowTreeHostX11::SetWMSpecState(bool enabled,
memset(&xclient, 0, sizeof(xclient));
xclient.type = ClientMessage;
xclient.xclient.window = xwindow_;
- xclient.xclient.message_type = ui::GetAtom("_NET_WM_STATE");
+ xclient.xclient.message_type = gfx::GetAtom("_NET_WM_STATE");
xclient.xclient.format = 32;
xclient.xclient.data.l[0] =
enabled ? k_NET_WM_STATE_ADD : k_NET_WM_STATE_REMOVE;
@@ -1672,7 +1674,7 @@ void DesktopWindowTreeHostX11::SetWMSpecState(bool enabled,
}
bool DesktopWindowTreeHostX11::HasWMSpecProperty(const char* property) const {
- return window_properties_.find(ui::GetAtom(property)) !=
+ return window_properties_.find(gfx::GetAtom(property)) !=
window_properties_.end();
}
@@ -1853,7 +1855,7 @@ void DesktopWindowTreeHostX11::MapWindow(ui::WindowShowState show_state) {
? 0
: ui::X11EventSource::GetInstance()->GetTimestamp();
if (show_state == ui::SHOW_STATE_INACTIVE || wm_user_time_ms != 0) {
- XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_USER_TIME"),
+ XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_USER_TIME"),
XA_CARDINAL, 32, PropModeReplace,
reinterpret_cast<const unsigned char*>(&wm_user_time_ms),
1);
@@ -2114,12 +2116,12 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
}
case ClientMessage: {
Atom message_type = xev->xclient.message_type;
- if (message_type == ui::GetAtom("WM_PROTOCOLS")) {
+ if (message_type == gfx::GetAtom("WM_PROTOCOLS")) {
Atom protocol = static_cast<Atom>(xev->xclient.data.l[0]);
- if (protocol == ui::GetAtom("WM_DELETE_WINDOW")) {
+ if (protocol == gfx::GetAtom("WM_DELETE_WINDOW")) {
// We have received a close message from the window manager.
OnHostCloseRequested();
- } else if (protocol == ui::GetAtom("_NET_WM_PING")) {
+ } else if (protocol == gfx::GetAtom("_NET_WM_PING")) {
XEvent reply_event = *xev;
reply_event.xclient.window = x_root_window_;
@@ -2129,17 +2131,17 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
SubstructureRedirectMask | SubstructureNotifyMask,
&reply_event);
}
- } else if (message_type == ui::GetAtom("XdndEnter")) {
+ } else if (message_type == gfx::GetAtom("XdndEnter")) {
drag_drop_client_->OnXdndEnter(xev->xclient);
- } else if (message_type == ui::GetAtom("XdndLeave")) {
+ } else if (message_type == gfx::GetAtom("XdndLeave")) {
drag_drop_client_->OnXdndLeave(xev->xclient);
- } else if (message_type == ui::GetAtom("XdndPosition")) {
+ } else if (message_type == gfx::GetAtom("XdndPosition")) {
drag_drop_client_->OnXdndPosition(xev->xclient);
- } else if (message_type == ui::GetAtom("XdndStatus")) {
+ } else if (message_type == gfx::GetAtom("XdndStatus")) {
drag_drop_client_->OnXdndStatus(xev->xclient);
- } else if (message_type == ui::GetAtom("XdndFinished")) {
+ } else if (message_type == gfx::GetAtom("XdndFinished")) {
drag_drop_client_->OnXdndFinished(xev->xclient);
- } else if (message_type == ui::GetAtom("XdndDrop")) {
+ } else if (message_type == gfx::GetAtom("XdndDrop")) {
drag_drop_client_->OnXdndDrop(xev->xclient);
}
break;
@@ -2183,11 +2185,11 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
}
case PropertyNotify: {
::Atom changed_atom = xev->xproperty.atom;
- if (changed_atom == ui::GetAtom("_NET_WM_STATE")) {
+ if (changed_atom == gfx::GetAtom("_NET_WM_STATE")) {
OnWMStateUpdated();
- } else if (changed_atom == ui::GetAtom("_NET_FRAME_EXTENTS")) {
+ } else if (changed_atom == gfx::GetAtom("_NET_FRAME_EXTENTS")) {
OnFrameExtentsUpdated();
- } else if (changed_atom == ui::GetAtom("_NET_WM_DESKTOP")) {
+ } else if (changed_atom == gfx::GetAtom("_NET_WM_DESKTOP")) {
if (UpdateWorkspace())
OnHostWorkspaceChanged();
}

Powered by Google App Engine
This is Rietveld 408576698