transactions: handle preemption take 2

This implementation is far simpler than c0d7e71 as it takes advantage of
wlroots's tracking of pending state.

Additionally, we now send frame done events if a view that we are
configuring commits with the wrong dimensions. This is necessary in
order to trigger a redraw for some clients as well as being a more
correct implementation of the protocol.
This commit is contained in:
Isaac Freund
2020-06-09 19:13:28 +02:00
parent 24b1a566de
commit 052c8e1dcb
5 changed files with 51 additions and 12 deletions

View File

@ -139,9 +139,9 @@ fn startTransaction(self: *Self) void {
view.configure();
self.pending_configures += 1;
// We save the current buffer, so we can send an early
// frame done event to give the client a head start on
// redrawing.
// Send a frame done that the client will commit a new frame
// with the dimensions we sent in the configure. Normally this
// event would be sent in the render function.
view.sendFrameDone();
}
@ -165,6 +165,10 @@ fn startTransaction(self: *Self) void {
self.commitTransaction();
}
} else {
// No views need configures, clear the current timer in case we are
// interrupting another transaction and commit.
if (c.wl_event_source_timer_update(self.transaction_timer, 0) < 0)
Log.Error.log("error disarming timer", .{});
self.commitTransaction();
}
}