Choose more consistent commit behavior
Right now we have two commit events: one for wlr_surface
, one for wlr_output
. Each of these structs have a state struct with a pending
and current
field.
When commit
is emitted, I'd expect these assumptions to be true:
- Users should have access to the committed state in the
current
state - Users should be able to figure out what changed in this commit (how?)
- The
pending
state should be empty (it's just been applied)
Questions:
- Should we allow access to the previous state? Note that we don't want to retain locks on buffers longer than necessary.
-
pending.committed
is a bitmask of fields changed since last commit. What shouldcurrent.committed
mean? Right now it seems like it's the union of all commits'pending.committed
.
Right now (1) is true, however:
-
wlr_output
clears the pending state aftercommit
is emitted, breaking (3). The pending state is used by users to figure out what changed (2).wlr_output
provides no access to the previous state. -
wlr_surface
has aprevious
state, howeverprevious.buffer
is an exception and is always set to NULL. (3) is true. Also, the previous state seems to be only used bywlr_surface
itself. Users have no way to figure out what changed (2).
It would be nice to decide on a consistent behavior.