| Index: ui/base/x/x11_util.cc
|
| diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc
|
| index cf5f2a8582919894c93b3150cc7dda38635fde3f..e288c3b223859878a8a0f460c48ba67a59fd7ddf 100644
|
| --- a/ui/base/x/x11_util.cc
|
| +++ b/ui/base/x/x11_util.cc
|
| @@ -1309,16 +1309,30 @@ void SetDefaultX11ErrorHandlers() {
|
| }
|
|
|
| bool IsX11WindowFullScreen(XID window) {
|
| - // First check if _NET_WM_STATE property contains _NET_WM_STATE_FULLSCREEN.
|
| - static Atom atom = GetAtom("_NET_WM_STATE_FULLSCREEN");
|
| -
|
| - std::vector<Atom> atom_properties;
|
| - if (GetAtomArrayProperty(window,
|
| - "_NET_WM_STATE",
|
| - &atom_properties) &&
|
| - std::find(atom_properties.begin(), atom_properties.end(), atom)
|
| - != atom_properties.end())
|
| - return true;
|
| + // 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();
|
| + }
|
| + }
|
| + }
|
| +
|
| + gfx::Rect window_rect;
|
| + if (!ui::GetWindowRect(window, &window_rect))
|
| + return false;
|
|
|
| #if defined(TOOLKIT_GTK)
|
| // As the last resort, check if the window size is as large as the main
|
| @@ -1326,17 +1340,21 @@ bool IsX11WindowFullScreen(XID window) {
|
| GdkRectangle monitor_rect;
|
| gdk_screen_get_monitor_geometry(gdk_screen_get_default(), 0, &monitor_rect);
|
|
|
| - gfx::Rect window_rect;
|
| - if (!ui::GetWindowRect(window, &window_rect))
|
| - return false;
|
| -
|
| return monitor_rect.x == window_rect.x() &&
|
| monitor_rect.y == window_rect.y() &&
|
| monitor_rect.width == window_rect.width() &&
|
| monitor_rect.height == window_rect.height();
|
| #else
|
| - NOTIMPLEMENTED();
|
| - return false;
|
| + // We can't use gfx::Screen here because we don't have an aura::Window. So
|
| + // instead just look at the size of the default display.
|
| + //
|
| + // TODO(erg): Actually doing this correctly would require pulling out xrandr,
|
| + // which we don't even do in the desktop screen yet.
|
| + ::Display* display = ui::GetXDisplay();
|
| + ::Screen* screen = DefaultScreenOfDisplay(display);
|
| + int width = WidthOfScreen(screen);
|
| + int height = HeightOfScreen(screen);
|
| + return window_rect.size() == gfx::Size(width, height);
|
| #endif
|
| }
|
|
|
|
|