[UI] Fix letterboxing on Linux/Wayland

This commit is contained in:
Herman S.
2025-11-25 14:06:08 +09:00
parent 33645603d6
commit 511e4d3497
3 changed files with 10 additions and 1 deletions
+5
View File
@@ -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;
+1 -1
View File
@@ -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;
}
+4
View File
@@ -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);