Commit 5e939495 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Correctly apply initial xdg-shell double buffered state

Some double buffered state, e.g. min and max size, should be applied
when the initial state is committed.


(cherry picked from commit b2d33b49)
parent 3a2870e7
Pipeline #95175 passed with stage
in 8 minutes and 6 seconds
......@@ -145,6 +145,10 @@ XdgSurfaceInterfacePrivate::XdgSurfaceInterfacePrivate(XdgSurfaceInterface *xdgS
void XdgSurfaceInterfacePrivate::commit()
{
if (surface->buffer()) {
firstBufferAttached = true;
}
if (next.acknowledgedConfigureIsSet) {
current.acknowledgedConfigure = next.acknowledgedConfigure;
next.acknowledgedConfigureIsSet = false;
......@@ -156,12 +160,11 @@ void XdgSurfaceInterfacePrivate::commit()
next.windowGeometryIsSet = false;
Q_EMIT q->windowGeometryChanged(current.windowGeometry);
}
isMapped = surface->buffer();
}
void XdgSurfaceInterfacePrivate::reset()
{
firstBufferAttached = false;
isConfigured = false;
current = XdgSurfaceState{};
next = XdgSurfaceState{};
......@@ -315,21 +318,13 @@ XdgToplevelInterfacePrivate::XdgToplevelInterfacePrivate(XdgToplevelInterface *t
void XdgToplevelInterfacePrivate::commit()
{
auto xdgSurfacePrivate = XdgSurfaceInterfacePrivate::get(xdgSurface);
bool isResettable = xdgSurfacePrivate->isConfigured && xdgSurfacePrivate->isMapped;
if (xdgSurfacePrivate->isConfigured) {
xdgSurfacePrivate->commit();
} else {
Q_EMIT q->initializeRequested();
return;
}
if (isResettable && !xdgSurfacePrivate->isMapped) {
if (xdgSurfacePrivate->firstBufferAttached && !xdgSurfacePrivate->surface->buffer()) {
reset();
return;
}
xdgSurfacePrivate->commit();
if (current.minimumSize != next.minimumSize) {
current.minimumSize = next.minimumSize;
Q_EMIT q->minimumSizeChanged(current.minimumSize);
......@@ -338,6 +333,10 @@ void XdgToplevelInterfacePrivate::commit()
current.maximumSize = next.maximumSize;
Q_EMIT q->maximumSizeChanged(current.maximumSize);
}
if (!xdgSurfacePrivate->isConfigured) {
Q_EMIT q->initializeRequested();
}
}
void XdgToplevelInterfacePrivate::reset()
......@@ -646,17 +645,15 @@ void XdgPopupInterfacePrivate::commit()
}
auto xdgSurfacePrivate = XdgSurfaceInterfacePrivate::get(xdgSurface);
bool isResettable = xdgSurfacePrivate->isConfigured && xdgSurfacePrivate->isMapped;
if (xdgSurfacePrivate->isConfigured) {
xdgSurfacePrivate->commit();
} else {
Q_EMIT q->initializeRequested();
if (xdgSurfacePrivate->firstBufferAttached && !xdgSurfacePrivate->surface->buffer()) {
reset();
return;
}
if (isResettable && !xdgSurfacePrivate->isMapped) {
reset();
xdgSurfacePrivate->commit();
if (!xdgSurfacePrivate->isConfigured) {
Q_EMIT q->initializeRequested();
}
}
......
......@@ -103,7 +103,7 @@ public:
QPointer<XdgToplevelInterface> toplevel;
QPointer<XdgPopupInterface> popup;
QPointer<SurfaceInterface> surface;
bool isMapped = false;
bool firstBufferAttached = false;
bool isConfigured = false;
XdgSurfaceState next;
......
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