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

Unified Diff: ui/base/x/x11_util.cc

Issue 291093012: Fix some views unittests on desktop Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: docs Created 6 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
Index: ui/base/x/x11_util.cc
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc
index 8560f1bb594b79dbcf6d23f205aeef34b2382ca8..e51faaaf940c2de31dff802f74a0bef6e3e348e5 100644
--- a/ui/base/x/x11_util.cc
+++ b/ui/base/x/x11_util.cc
@@ -1192,21 +1192,16 @@ 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.
- std::vector<Atom> supported_atoms;
- if (GetAtomArrayProperty(GetX11RootWindow(),
- "_NET_SUPPORTED",
- &supported_atoms)) {
- Atom atom = GetAtom("_NET_WM_STATE_FULLSCREEN");
-
- if (std::find(supported_atoms.begin(), supported_atoms.end(), atom)
- != supported_atoms.end()) {
- std::vector<Atom> atom_properties;
- if (GetAtomArrayProperty(window,
- "_NET_WM_STATE",
- &atom_properties)) {
- return std::find(atom_properties.begin(), atom_properties.end(), atom)
- != atom_properties.end();
- }
+ Atom fullscreen_atom = GetAtom("_NET_WM_STATE_FULLSCREEN");
+ if (WmSupportsHint(fullscreen_atom)) {
+ std::vector<Atom> atom_properties;
+ if (GetAtomArrayProperty(window,
+ "_NET_WM_STATE",
+ &atom_properties)) {
+ return std::find(atom_properties.begin(),
+ atom_properties.end(),
+ fullscreen_atom) !=
+ atom_properties.end();
}
}
@@ -1226,6 +1221,18 @@ bool IsX11WindowFullScreen(XID window) {
return window_rect.size() == gfx::Size(width, height);
}
+bool WmSupportsHint(Atom atom) {
+ std::vector<Atom> supported_atoms;
+ if (!GetAtomArrayProperty(GetX11RootWindow(),
+ "_NET_SUPPORTED",
+ &supported_atoms)) {
+ return false;
+ }
+
+ return std::find(supported_atoms.begin(), supported_atoms.end(), atom) !=
+ supported_atoms.end();
+}
+
const unsigned char* XRefcountedMemory::front() const {
return x11_data_;
}

Powered by Google App Engine
This is Rietveld 408576698