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

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

Issue 610263002: Prevent a frameless app from sizing itself to 0x0 on Desktop Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9831992e45a85069008596b94ee2c8a6500057a2..a6f120943f57de515556c227b84f04f8f253b208 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
@@ -891,10 +891,6 @@ void DesktopWindowTreeHostX11::SetBounds(const gfx::Rect& requested_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);
-
if (bounds.width() < min_size_.width() ||
bounds.height() < min_size_.height() ||
(!max_size_.IsEmpty() &&
@@ -902,6 +898,11 @@ void DesktopWindowTreeHostX11::SetBounds(const gfx::Rect& requested_bounds) {
bounds.height() > max_size_.height()))) {
// Update the minimum and maximum sizes in case they have changed.
UpdateMinAndMaxSize();
+
+ gfx::Size size = bounds.size();
+ size.SetToMin(max_size_);
+ size.SetToMax(min_size_);
+ bounds.set_size(size);
}
changes.width = bounds.width();
@@ -1231,7 +1232,11 @@ gfx::Size DesktopWindowTreeHostX11::AdjustSize(
requested_size.height() - 1);
}
}
- return requested_size;
+
+ // Do not request a 0x0 window size. It causes an XError.
+ gfx::Size size = requested_size;
+ size.SetToMax(gfx::Size(1,1));
+ return size;
}
void DesktopWindowTreeHostX11::OnWMStateUpdated() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698