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

Unified Diff: components/exo/shell_surface.cc

Issue 1492803004: exo: Add SetGeometry function to ShellSurface class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@exosphere-xdg-shell
Patch Set: implement xdg_surface_set_window_geometry Created 5 years 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 | « components/exo/shell_surface.h ('k') | components/exo/shell_surface_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/shell_surface.cc
diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc
index 40bbd7f01dd034cbad5bc006063ee7afb0e971a1..163b55889d0b6e2e186257b4f34a7e4f47acb6de 100644
--- a/components/exo/shell_surface.cc
+++ b/components/exo/shell_surface.cc
@@ -180,6 +180,18 @@ void ShellSurface::Move() {
}
}
+void ShellSurface::SetGeometry(const gfx::Rect& geometry) {
+ TRACE_EVENT1("exo", "ShellSurface::SetGeometry", "geometry",
+ geometry.ToString());
+
+ if (geometry.IsEmpty()) {
+ DLOG(WARNING) << "Surface geometry must be non-empty";
+ return;
+ }
+
+ geometry_ = geometry;
+}
+
scoped_refptr<base::trace_event::TracedValue> ShellSurface::AsTracedValue()
const {
scoped_refptr<base::trace_event::TracedValue> value =
@@ -198,7 +210,8 @@ void ShellSurface::OnSurfaceCommit() {
// Update surface bounds and widget size.
gfx::Point origin;
views::View::ConvertPointToWidget(this, &origin);
- surface_->SetBounds(gfx::Rect(origin, surface_->layer()->size()));
+ surface_->SetBounds(gfx::Rect(origin - geometry_.OffsetFromOrigin(),
+ surface_->layer()->size()));
widget_->SetSize(widget_->non_client_view()->GetPreferredSize());
// Show widget if not already visible.
@@ -248,6 +261,9 @@ views::NonClientFrameView* ShellSurface::CreateNonClientFrameView(
// views::Views overrides:
gfx::Size ShellSurface::GetPreferredSize() const {
+ if (!geometry_.IsEmpty())
+ return geometry_.size();
+
return surface_ ? surface_->GetPreferredSize() : gfx::Size();
}
« no previous file with comments | « components/exo/shell_surface.h ('k') | components/exo/shell_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698