Commit deb476e4 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

[server] Introduce SurfaceInterface::boundingRect()

The new method provides a convenient way for determining the rectangle
that bounds the given surface and all of its sub-surfaces. This can be
very handy when determining the effective window geometry.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: apol, kde-frameworks-devel

Tags: #frameworks

Differential Revision:
parent 09147bec
......@@ -772,6 +772,19 @@ QSize SurfaceInterface::size() const
return QSize();
QRect SurfaceInterface::boundingRect() const
QRect rect(QPoint(0, 0), size());
const QList<QPointer<SubSurfaceInterface>> subSurfaces = childSubSurfaces();
for (const SubSurfaceInterface *subSurface : subSurfaces) {
const SurfaceInterface *childSurface = subSurface->surface();
rect |= childSurface->boundingRect().translated(subSurface->position());
return rect;
QPointer< ShadowInterface > SurfaceInterface::shadow() const
......@@ -112,6 +112,14 @@ public:
* @since 5.3
QSize size() const;
* Returns the rectangle that bounds this surface and all of its sub-surfaces.
* QPoint(0, 0) corresponds to the upper left corner of this surface.
* @since 5.69
QRect boundingRect() const;
* @returns The SubSurface for this Surface in case there is one.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment