diff --git a/src/xenia/ui/surface.h b/src/xenia/ui/surface.h index af4495cb6..613c2d444 100644 --- a/src/xenia/ui/surface.h +++ b/src/xenia/ui/surface.h @@ -71,6 +71,11 @@ class Surface { return true; } + // Updates the cached size for surfaces that don't query size dynamically. + // Called by the window when resizing. Default implementation is a no-op + // for surfaces that query their size dynamically (e.g., XCB, Win32). + virtual void SetSize(uint32_t width, uint32_t height) {} + protected: Surface() = default; diff --git a/src/xenia/ui/surface_gnulinux.h b/src/xenia/ui/surface_gnulinux.h index 88832674d..4e503b9ce 100644 --- a/src/xenia/ui/surface_gnulinux.h +++ b/src/xenia/ui/surface_gnulinux.h @@ -43,7 +43,7 @@ class WaylandWindowSurface final : public Surface { wl_display* display() const { return display_; } wl_surface* surface() const { return surface_; } - void SetSize(uint32_t width, uint32_t height) { + void SetSize(uint32_t width, uint32_t height) override { width_ = width; height_ = height; } diff --git a/src/xenia/ui/window.cc b/src/xenia/ui/window.cc index 2ce5faae5..24127c4a2 100644 --- a/src/xenia/ui/window.cc +++ b/src/xenia/ui/window.cc @@ -501,6 +501,10 @@ bool Window::OnActualSizeUpdate( actual_physical_height_ = new_physical_height; // The listeners may reference the presenter, update the presenter first. if (presenter_surface_) { + // Update surface size for surfaces that cache dimensions (e.g., Wayland). + // This must be done before OnSurfaceResizeFromUIThread so the presenter + // gets the correct size when it queries the surface. + presenter_surface_->SetSize(new_physical_width, new_physical_height); presenter_->OnSurfaceResizeFromUIThread(); } UISetupEvent e(this);