Index: ui/views/widget/desktop_aura/desktop_root_window_host_linux.cc |
diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_linux.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_linux.cc |
index cc2a404e27e86d7ccec266013668610884342216..81c2c7852f100ad4264865d34b452810bc1b1e31 100644 |
--- a/ui/views/widget/desktop_aura/desktop_root_window_host_linux.cc |
+++ b/ui/views/widget/desktop_aura/desktop_root_window_host_linux.cc |
@@ -451,10 +451,18 @@ gfx::Rect DesktopRootWindowHostLinux::GetWorkAreaBoundsInScreen() const { |
return gfx::Rect(value[0], value[1], value[2], value[3]); |
} |
- // TODO(erg): As a fallback, we should return the bounds for the current |
- // monitor. However, that's pretty difficult and requires futzing with XRR. |
- NOTIMPLEMENTED(); |
- return gfx::Rect(); |
+ // Fetch the geometry of the root window. |
+ Window root; |
+ int x, y; |
+ unsigned int width, height; |
+ unsigned int border_width, depth; |
+ if (!XGetGeometry(xdisplay_, x_root_window_, &root, &x, &y, |
+ &width, &height, &border_width, &depth)) { |
+ NOTIMPLEMENTED(); |
+ return gfx::Rect(0, 0, 10, 10); |
+ } |
+ |
+ return gfx::Rect(x, y, width, height); |
} |
void DesktopRootWindowHostLinux::SetShape(gfx::NativeRegion native_region) { |
@@ -692,6 +700,10 @@ void DesktopRootWindowHostLinux::SetBounds(const gfx::Rect& bounds) { |
unsigned value_mask = 0; |
if (size_changed) { |
+ // X11 will send an XError at our process if have a 0 sized window. |
+ DCHECK_GT(bounds.width(), 0); |
+ DCHECK_GT(bounds.height(), 0); |
+ |
changes.width = bounds.width(); |
changes.height = bounds.height(); |
value_mask |= CWHeight | CWWidth; |