root: stop tracking xwayland views in transactions

Frame perfection for xwayland views would require too much complexity
to support and would bleed all over the codebase.
This commit is contained in:
Isaac Freund 2020-12-29 20:38:30 +01:00
parent 055fba5c3c
commit a098bbe03a
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11
3 changed files with 7 additions and 16 deletions

View file

@ -355,7 +355,7 @@ fn commitTransaction(self: *Self) void {
} }
defer view_it = view_node.next; defer view_it = view_node.next;
if (!view.shouldTrackConfigure() and view.pending_serial != null) continue; if (view.pending_serial != null and !view.shouldTrackConfigure()) continue;
// Apply pending state of the view // Apply pending state of the view
view.pending_serial = null; view.pending_serial = null;

View file

@ -419,6 +419,9 @@ pub fn fromWlrSurface(surface: *wlr.Surface) ?*Self {
} }
pub fn shouldTrackConfigure(self: Self) bool { pub fn shouldTrackConfigure(self: Self) bool {
// We don't give a damn about frame perfection for xwayland views
if (build_options.xwayland and self.impl == .xwayland_view) return false;
// There are exactly three cases in which we do not track configures // There are exactly three cases in which we do not track configures
// 1. the view was and remains floating // 1. the view was and remains floating
// 2. the view is changing from float/layout to fullscreen // 2. the view is changing from float/layout to fullscreen

View file

@ -77,7 +77,8 @@ pub fn needsConfigure(self: Self) bool {
self.xwayland_surface.height != self.view.pending.box.height; self.xwayland_surface.height != self.view.pending.box.height;
} }
/// Apply pending state /// Apply pending state. Note: we don't set View.serial as
/// shouldTrackConfigure() is always false for xwayland views.
pub fn configure(self: Self) void { pub fn configure(self: Self) void {
const state = &self.view.pending; const state = &self.view.pending;
self.xwayland_surface.setFullscreen(state.fullscreen); self.xwayland_surface.setFullscreen(state.fullscreen);
@ -87,12 +88,6 @@ pub fn configure(self: Self) void {
@intCast(u16, state.box.width), @intCast(u16, state.box.width),
@intCast(u16, state.box.height), @intCast(u16, state.box.height),
); );
// Xwayland surfaces don't use serials, so we will just assume they have
// configured the next time they commit. Set pending serial to a dummy
// value to indicate that a transaction has started. Note: we can't just
// call notifyConfigured() here as the transaction has not yet been fully
// initiated.
self.view.pending_serial = 0x66666666;
} }
/// Close the view. This will lead to the unmap and destroy events being sent /// Close the view. This will lead to the unmap and destroy events being sent
@ -225,19 +220,12 @@ fn handleUnmap(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface: *
/// TODO: check for unexpected change in size and react as needed /// TODO: check for unexpected change in size and react as needed
fn handleCommit(listener: *wl.Listener(*wlr.Surface), surface: *wlr.Surface) void { fn handleCommit(listener: *wl.Listener(*wlr.Surface), surface: *wlr.Surface) void {
const self = @fieldParentPtr(Self, "commit", listener); const self = @fieldParentPtr(Self, "commit", listener);
const view = self.view; self.view.surface_box = Box{
view.surface_box = Box{
.x = 0, .x = 0,
.y = 0, .y = 0,
.width = @intCast(u32, surface.current.width), .width = @intCast(u32, surface.current.width),
.height = @intCast(u32, surface.current.height), .height = @intCast(u32, surface.current.height),
}; };
// See comment in XwaylandView.configure()
if (view.pending_serial != null) {
view.notifyConfiguredOrApplyPending();
}
} }
/// Called then the window updates its title /// Called then the window updates its title