From aa067a4cf12522ede1752dd2048ce67d07e903f1 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Tue, 19 Nov 2024 21:40:16 +0000 Subject: [PATCH 1/2] xdg-shell: don't report invalid min/max sizes on unset fixes #8522 --- src/protocols/XDGShell.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/protocols/XDGShell.cpp b/src/protocols/XDGShell.cpp index 932882e9..f121070d 100644 --- a/src/protocols/XDGShell.cpp +++ b/src/protocols/XDGShell.cpp @@ -324,10 +324,14 @@ void CXDGToplevelResource::close() { } Vector2D CXDGToplevelResource::layoutMinSize() { + if (current.minSize.x <= 1 && current.minSize.y <= 1) + return {0, 0}; return owner ? current.minSize + owner->current.geometry.pos() : current.minSize; } Vector2D CXDGToplevelResource::layoutMaxSize() { + if (current.maxSize.x <= 1 && current.maxSize.y <= 1) + return {0, 0}; return owner ? current.maxSize + owner->current.geometry.pos() : current.maxSize; } From c4eda46d0ef022a17348623beec4154ba34af691 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Tue, 19 Nov 2024 22:07:25 +0000 Subject: [PATCH 2/2] xdg-shell: even more robust layout min/max size although I don't think any apps use this, but better safe than sorry --- src/protocols/XDGShell.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/protocols/XDGShell.cpp b/src/protocols/XDGShell.cpp index f121070d..688d0006 100644 --- a/src/protocols/XDGShell.cpp +++ b/src/protocols/XDGShell.cpp @@ -324,15 +324,21 @@ void CXDGToplevelResource::close() { } Vector2D CXDGToplevelResource::layoutMinSize() { - if (current.minSize.x <= 1 && current.minSize.y <= 1) - return {0, 0}; - return owner ? current.minSize + owner->current.geometry.pos() : current.minSize; + Vector2D minSize; + if (current.minSize.x > 1) + minSize.x = owner ? current.minSize.x + owner->current.geometry.pos().x : current.minSize.x; + if (current.minSize.y > 1) + minSize.y = owner ? current.minSize.y + owner->current.geometry.pos().y : current.minSize.y; + return minSize; } Vector2D CXDGToplevelResource::layoutMaxSize() { - if (current.maxSize.x <= 1 && current.maxSize.y <= 1) - return {0, 0}; - return owner ? current.maxSize + owner->current.geometry.pos() : current.maxSize; + Vector2D maxSize; + if (current.maxSize.x > 1) + maxSize.x = owner ? current.maxSize.x + owner->current.geometry.pos().x : current.maxSize.x; + if (current.maxSize.y > 1) + maxSize.y = owner ? current.maxSize.y + owner->current.geometry.pos().y : current.maxSize.y; + return maxSize; } CXDGSurfaceResource::CXDGSurfaceResource(SP resource_, SP owner_, SP surface_) :