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

Unified Diff: ui/base/x/x11_util.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
« no previous file with comments | « ui/base/x/x11_util.h ('k') | ui/display/manager/chromeos/x11/native_display_delegate_x11.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/x/x11_util.cc
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc
index bf3231c2e8d3375dfabc6ab52550deb7436acfa8..c2ff09a052e90f961137d9e535752f74d6948744 100644
--- a/ui/base/x/x11_util.cc
+++ b/ui/base/x/x11_util.cc
@@ -94,7 +94,7 @@ int DefaultX11IOErrorHandler(XDisplay* d) {
bool GetProperty(XID window, const std::string& property_name, long max_length,
XAtom* type, int* format, unsigned long* num_items,
unsigned char** property) {
- XAtom property_atom = GetAtom(property_name.c_str());
+ XAtom property_atom = gfx::GetAtom(property_name.c_str());
unsigned long remaining_bytes = 0;
return XGetWindowProperty(gfx::GetXDisplay(),
window,
@@ -442,7 +442,7 @@ void SetUseOSWindowFrame(XID window, bool use_os_window_frame) {
motif_hints.flags = (1L << 1);
motif_hints.decorations = use_os_window_frame ? 1 : 0;
- XAtom hint_atom = GetAtom("_MOTIF_WM_HINTS");
+ XAtom hint_atom = gfx::GetAtom("_MOTIF_WM_HINTS");
XChangeProperty(gfx::GetXDisplay(),
window,
hint_atom,
@@ -472,14 +472,11 @@ void SetHideTitlebarWhenMaximizedProperty(XID window,
HideTitlebarWhenMaximized property) {
// XChangeProperty() expects "hide" to be long.
unsigned long hide = property;
- XChangeProperty(gfx::GetXDisplay(),
- window,
- GetAtom("_GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED"),
- XA_CARDINAL,
- 32, // size in bits
- PropModeReplace,
- reinterpret_cast<unsigned char*>(&hide),
- 1);
+ XChangeProperty(gfx::GetXDisplay(), window,
+ gfx::GetAtom("_GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED"),
+ XA_CARDINAL,
+ 32, // size in bits
+ PropModeReplace, reinterpret_cast<unsigned char*>(&hide), 1);
}
void ClearX11DefaultRootWindow() {
@@ -514,7 +511,7 @@ bool IsWindowVisible(XID window) {
// Minimized windows are not visible.
std::vector<XAtom> wm_states;
if (GetAtomArrayProperty(window, "_NET_WM_STATE", &wm_states)) {
- XAtom hidden_atom = GetAtom("_NET_WM_STATE_HIDDEN");
+ XAtom hidden_atom = gfx::GetAtom("_NET_WM_STATE_HIDDEN");
if (base::ContainsValue(wm_states, hidden_atom))
return false;
}
@@ -825,8 +822,8 @@ bool SetIntArrayProperty(XID window,
const std::string& type,
const std::vector<int>& value) {
DCHECK(!value.empty());
- XAtom name_atom = GetAtom(name.c_str());
- XAtom type_atom = GetAtom(type.c_str());
+ XAtom name_atom = gfx::GetAtom(name.c_str());
+ XAtom type_atom = gfx::GetAtom(type.c_str());
// XChangeProperty() expects values of type 32 to be longs.
std::unique_ptr<long[]> data(new long[value.size()]);
@@ -858,8 +855,8 @@ bool SetAtomArrayProperty(XID window,
const std::string& type,
const std::vector<XAtom>& value) {
DCHECK(!value.empty());
- XAtom name_atom = GetAtom(name.c_str());
- XAtom type_atom = GetAtom(type.c_str());
+ XAtom name_atom = gfx::GetAtom(name.c_str());
+ XAtom type_atom = gfx::GetAtom(type.c_str());
// XChangeProperty() expects values of type 32 to be longs.
std::unique_ptr<XAtom[]> data(new XAtom[value.size()]);
@@ -894,10 +891,6 @@ bool SetStringProperty(XID window,
return !err_tracker.FoundNewError();
}
-XAtom GetAtom(const char* name) {
- return X11AtomCache::GetInstance()->GetAtom(name);
-}
-
void SetWindowClassHint(XDisplay* display,
XID window,
const std::string& res_name,
@@ -913,13 +906,12 @@ void SetWindowClassHint(XDisplay* display,
void SetWindowRole(XDisplay* display, XID window, const std::string& role) {
if (role.empty()) {
- XDeleteProperty(display, window, GetAtom("WM_WINDOW_ROLE"));
+ XDeleteProperty(display, window, gfx::GetAtom("WM_WINDOW_ROLE"));
} else {
char* role_c = const_cast<char*>(role.c_str());
- XChangeProperty(display, window, GetAtom("WM_WINDOW_ROLE"), XA_STRING, 8,
- PropModeReplace,
- reinterpret_cast<unsigned char*>(role_c),
- role.size());
+ XChangeProperty(display, window, gfx::GetAtom("WM_WINDOW_ROLE"), XA_STRING,
+ 8, PropModeReplace,
+ reinterpret_cast<unsigned char*>(role_c), role.size());
}
}
@@ -1185,7 +1177,8 @@ std::string GuessWindowManagerName() {
bool IsCompositingManagerPresent() {
static bool is_compositing_manager_present =
- XGetSelectionOwner(gfx::GetXDisplay(), GetAtom("_NET_WM_CM_S0")) != None;
+ XGetSelectionOwner(gfx::GetXDisplay(), gfx::GetAtom("_NET_WM_CM_S0")) !=
+ None;
return is_compositing_manager_present;
}
@@ -1197,7 +1190,7 @@ bool IsX11WindowFullScreen(XID window) {
// If _NET_WM_STATE_FULLSCREEN is in _NET_SUPPORTED, use the presence or
// absence of _NET_WM_STATE_FULLSCREEN in _NET_WM_STATE to determine
// whether we're fullscreen.
- XAtom fullscreen_atom = GetAtom("_NET_WM_STATE_FULLSCREEN");
+ XAtom fullscreen_atom = gfx::GetAtom("_NET_WM_STATE_FULLSCREEN");
if (WmSupportsHint(fullscreen_atom)) {
std::vector<XAtom> atom_properties;
if (GetAtomArrayProperty(window,
@@ -1391,7 +1384,7 @@ XVisualManager::XVisualManager()
for (int i = 0; i < visuals_len; ++i)
visuals_[visual_list[i].visualid].reset(new XVisualData(visual_list[i]));
- XAtom NET_WM_CM_S0 = GetAtom("_NET_WM_CM_S0");
+ XAtom NET_WM_CM_S0 = gfx::GetAtom("_NET_WM_CM_S0");
using_compositing_wm_ = XGetSelectionOwner(display_, NET_WM_CM_S0) != None;
// Choose the opaque visual.
« no previous file with comments | « ui/base/x/x11_util.h ('k') | ui/display/manager/chromeos/x11/native_display_delegate_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698