wayland: Schedule a configure event when borders change

Window::checkWorkspacePosition() before the window is mapped is still
problematic and should be avoided as it can produce undesired constrained
client size (1x1).

Given that XdgToplevelWindow tries to maintain the same frame geometry
size, it should be enough to schedule another configure event instead.
It is going to be in line with the other decoration logic in the
XdgToplevelWindow and it's a better way to handle async geometry updates.

BUG: 480910
This commit is contained in:
Vlad Zahorodnii 2024-02-08 14:37:32 +02:00
parent 5ad63f21e0
commit e974c07001
3 changed files with 18 additions and 8 deletions

View file

@ -2635,15 +2635,9 @@ void Window::setDecoration(std::shared_ptr<KDecoration2::Decoration> decoration)
}
});
connect(decoration.get(), &KDecoration2::Decoration::bordersChanged, this, [this]() {
if (isDeleted()) {
return;
if (!isDeleted()) {
updateDecorationInputShape();
}
GeometryUpdatesBlocker blocker(this);
const QRectF oldGeometry = moveResizeGeometry();
if (!isShade()) {
checkWorkspacePosition(oldGeometry);
}
updateDecorationInputShape();
});
connect(decoration.get(), &KDecoration2::Decoration::resizeOnlyBordersChanged, this, [this]() {
if (!isDeleted()) {

View file

@ -1346,6 +1346,16 @@ void X11Window::createDecoration()
updateFrameExtents();
}
});
connect(decoration.get(), &KDecoration2::Decoration::bordersChanged, this, [this]() {
if (isDeleted()) {
return;
}
GeometryUpdatesBlocker blocker(this);
const QRectF oldGeometry = moveResizeGeometry();
if (!isShade()) {
checkWorkspacePosition(oldGeometry);
}
});
connect(decoratedClient()->decoratedClient(), &KDecoration2::DecoratedClient::sizeChanged, this, [this]() {
if (!isDeleted()) {
updateInputWindow();

View file

@ -695,6 +695,12 @@ void XdgToplevelWindow::handleRolePrecommit()
{
auto configureEvent = static_cast<XdgToplevelConfigure *>(lastAcknowledgedConfigure());
if (configureEvent && decoration() != configureEvent->decoration.get()) {
connect(configureEvent->decoration.get(), &KDecoration2::Decoration::bordersChanged, this, [this]() {
if (!isDeleted()) {
scheduleConfigure();
}
});
setDecoration(configureEvent->decoration);
updateShadow();
}