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.
This commit is contained in:
parent
f4070a23d5
commit
4da5fff033
2 changed files with 19 additions and 22 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue