Add support for xdg_toplevel.configure_bounds()

With the xdg_toplevel.configure_bounds event, the compositor will be
able to indicate the client the maximum desired surface size.

It can be used to prevent mapping too big application windows, etc.
This commit is contained in:
Vlad Zahorodnii 2021-12-16 21:16:27 +02:00
parent 88e36d0b04
commit 6182744a2b

View file

@ -831,12 +831,23 @@ void XdgToplevelClient::closeWindow()
XdgSurfaceConfigure *XdgToplevelClient::sendRoleConfigure() const
{
QSize framePadding(0, 0);
if (m_nextDecoration) {
framePadding.setWidth(m_nextDecoration->borderLeft() + m_nextDecoration->borderRight());
framePadding.setHeight(m_nextDecoration->borderTop() + m_nextDecoration->borderBottom());
}
QSize nextClientSize = moveResizeGeometry().size();
if (!nextClientSize.isEmpty()) {
if (m_nextDecoration) {
nextClientSize.rwidth() -= m_nextDecoration->borderLeft() + m_nextDecoration->borderRight();
nextClientSize.rheight() -= m_nextDecoration->borderTop() + m_nextDecoration->borderBottom();
}
nextClientSize.rwidth() -= framePadding.width();
nextClientSize.rheight() -= framePadding.height();
}
if (nextClientSize.isEmpty()) {
QSize bounds = workspace()->clientArea(PlacementArea, this, output()).size();
bounds.rwidth() -= framePadding.width();
bounds.rheight() -= framePadding.height();
m_shellSurface->sendConfigureBounds(bounds);
}
const quint32 serial = m_shellSurface->sendConfigure(nextClientSize, m_nextStates);