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

@ -112,12 +112,10 @@ pub fn deinit(self: Self) void {
}
pub fn needsConfigure(self: Self) bool {
if (self.pending_box) |pending_box| {
return pending_box.width != self.current_box.width or
pending_box.height != self.current_box.height;
} else {
return false;
}
return switch (self.impl) {
.xdg_toplevel => |xdg_toplevel| xdg_toplevel.needsConfigure(),
.xwayland_view => |xwayland_view| xwayland_view.needsConfigure(),
};
}
pub fn configure(self: Self) void {
@ -238,6 +236,8 @@ pub fn getTitle(self: Self) [*:0]const u8 {
pub fn map(self: *Self) void {
const root = self.output.root;
Log.Debug.log("View '{}' mapped", .{self.getTitle()});
// Add the view to the stack of its output
const node = @fieldParentPtr(ViewStack(Self).Node, "view", self);
self.output.views.push(node);
@ -260,6 +260,8 @@ pub fn map(self: *Self) void {
pub fn unmap(self: *Self) void {
const root = self.output.root;
Log.Debug.log("View '{}' unmapped", .{self.getTitle()});
self.wlr_surface = null;
// Inform all seats that the view has been unmapped so they can handle focus