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

Unified Diff: ui/platform_window/x11/x11_window_base.cc

Issue 2725383002: Don't exit SetBounds early for X11Window. (Closed)
Patch Set: Add comment. Created 3 years, 9 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/platform_window/x11/x11_window_base.cc
diff --git a/ui/platform_window/x11/x11_window_base.cc b/ui/platform_window/x11/x11_window_base.cc
index db251915c4e1ffda1bc0c77981c0492ed96dcfa5..f6415e8e0c14d7ed3953a510211019e76a332db6 100644
--- a/ui/platform_window/x11/x11_window_base.cc
+++ b/ui/platform_window/x11/x11_window_base.cc
@@ -177,17 +177,24 @@ void X11WindowBase::Close() {
}
void X11WindowBase::SetBounds(const gfx::Rect& bounds) {
- if (bounds == bounds_)
- return;
-
if (window_mapped_) {
XWindowChanges changes = {0};
- unsigned value_mask = CWX | CWY | CWWidth | CWHeight;
- changes.x = bounds.x();
- changes.y = bounds.y();
- changes.width = bounds.width();
- changes.height = bounds.height();
- XConfigureWindow(xdisplay_, xwindow_, value_mask, &changes);
+ unsigned value_mask = 0;
+
+ if (bounds_.size() != bounds.size()) {
+ changes.width = bounds.width();
+ changes.height = bounds.height();
+ value_mask |= CWHeight | CWWidth;
+ }
+
+ if (bounds_.origin() != bounds.origin()) {
+ changes.x = bounds.x();
+ changes.y = bounds.y();
+ value_mask |= CWX | CWY;
+ }
+
+ if (value_mask)
+ XConfigureWindow(xdisplay_, xwindow_, value_mask, &changes);
}
// Assume that the resize will go through as requested, which should be the
@@ -196,6 +203,10 @@ void X11WindowBase::SetBounds(const gfx::Rect& bounds) {
// (possibly synthetic) ConfigureNotify about the actual size and correct
// |bounds_| later.
bounds_ = bounds;
+
+ // Even if the pixel bounds didn't change this call to the delegate should
+ // still happen. The device scale factor may have changed which effectively
+ // changes the bounds.
delegate_->OnBoundsChanged(bounds_);
}
« 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