Commit 97df88c6 authored by David Edmundson's avatar David Edmundson
Browse files

Fix layer shell reset

In the current form any client committing multiple times without
attaching a buffer would unset the cached state and trigger an error.

It's legal (though weird) to commit multiple times before attaching a

We should only reset the state if we commit an empty buffer after having
committed an existing buffer. This brings us in line with XdgShell.

(cherry picked from commit a5c55b68)
parent ed70924a
Pipeline #160715 passed with stage
in 2 minutes and 52 seconds
......@@ -69,6 +69,7 @@ public:
bool isClosed = false;
bool isConfigured = false;
bool isCommitted = false;
bool firstBufferAttached = false;
void zwlr_layer_surface_v1_destroy_resource(Resource *resource) override;
......@@ -290,8 +291,10 @@ void LayerSurfaceV1InterfacePrivate::commit()
if (!surface->isMapped() && isCommitted) {
// detect reset
if (!surface->isMapped() && firstBufferAttached) {
isCommitted = false;
firstBufferAttached = false;
isConfigured = false;
current = LayerSurfaceV1State();
......@@ -303,6 +306,9 @@ void LayerSurfaceV1InterfacePrivate::commit()
const LayerSurfaceV1State previous = std::exchange(current, pending);
isCommitted = true; // Must set the committed state before emitting any signals.
if (surface->isMapped()) {
firstBufferAttached = true;
if (previous.acceptsFocus != current.acceptsFocus) {
Q_EMIT q->acceptsFocusChanged();
Supports Markdown
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