wayland: Remove extra space around the wrapper window in X11 windows

This way no extra buffer space is going to be wasted for a decoration
that isn't there, and it might be nicer for fractional scaling as kwin
won't need to deal with border size voodoo cases.
This commit is contained in:
Vlad Zahorodnii 2024-01-29 11:29:02 +02:00
parent ba37d18ab9
commit 66a491bda6
2 changed files with 9 additions and 14 deletions

View file

@ -217,12 +217,9 @@ SurfaceItemXwayland::SurfaceItemXwayland(X11Window *window, Scene *scene, Item *
QList<QRectF> SurfaceItemXwayland::shape() const
{
const QRectF clipRect = rect() & m_window->clientGeometry().translated(-m_window->bufferGeometry().topLeft());
QList<QRectF> shape = m_window->shapeRegion();
// bounded to clipRect
for (QRectF &shapePart : shape) {
shapePart = shapePart.intersected(clipRect);
shapePart = shapePart.intersected(rect());
}
return shape;
}

View file

@ -2872,7 +2872,7 @@ QSizeF X11Window::clientSizeToFrameSize(const QSizeF &size) const
QRectF X11Window::frameRectToBufferRect(const QRectF &rect) const
{
if (isDecorated()) {
if (!waylandServer() && isDecorated()) {
return rect;
}
return frameRectToClientRect(rect);
@ -4377,10 +4377,10 @@ void X11Window::updateServerGeometry()
const QRectF oldBufferGeometry = m_lastBufferGeometry;
// Compute the old client rect, the client geometry is always inside the buffer geometry.
QRectF oldClientRect = m_lastClientGeometry;
oldClientRect.translate(-m_lastBufferGeometry.topLeft());
const QRectF oldClientRect = m_lastClientGeometry.translated(-m_lastBufferGeometry.topLeft());
const QRectF clientRect = m_clientGeometry.translated(-m_bufferGeometry.topLeft());
if (oldBufferGeometry.size() != m_bufferGeometry.size() || oldClientRect != QRectF(clientPos(), clientSize())) {
if (oldBufferGeometry.size() != m_bufferGeometry.size() || oldClientRect != clientRect) {
resizeDecoration();
// If the client is being interactively resized, then the frame window, the wrapper window,
// and the client window have correct geometry at this point, so we don't have to configure
@ -4389,13 +4389,11 @@ void X11Window::updateServerGeometry()
m_frame.setGeometry(m_bufferGeometry);
}
if (!isShade()) {
const QRectF requestedWrapperGeometry(clientPos(), clientSize());
if (m_wrapper.geometry() != requestedWrapperGeometry) {
m_wrapper.setGeometry(requestedWrapperGeometry);
if (m_wrapper.geometry() != clientRect) {
m_wrapper.setGeometry(clientRect);
}
const QRectF requestedClientGeometry(QPoint(0, 0), clientSize());
if (m_client.geometry() != requestedClientGeometry) {
m_client.setGeometry(requestedClientGeometry);
if (m_client.geometry() != QRectF(QPointF(0, 0), clientRect.size())) {
m_client.setGeometry(QRectF(QPointF(0, 0), clientRect.size()));
}
// SELI - won't this be too expensive?
// THOMAS - yes, but gtk+ clients will not resize without ...