RediWM is a Wayland compositor written in Zig (OpenGL ES) that includes everything in one process
Keep the flame effects out of the normal path while disabled
oxydizer0aacb60f447f
diff --git a/src/effects/window_minimize.zig b/src/effects/window_minimize.zigindex 5a0ed1d..baf6586 100644--- a/src/effects/window_minimize.zig+++ b/src/effects/window_minimize.zig@@ -43,6 +43,12 @@ fn remove(link: *?*Self, self: *Self) void {gpa.destroy(self);}+/// Whether minimizing may play the flame at all: the cheap, usual "no".+/// `start` still makes the per-window checks.+pub fn wanted(server: *Server) bool {+ return server.ribbons_ready and server.config.effects.minimize().enabled;+}+pub fn start(top: *Top) void {const server = top.server;const binding = server.config.effects.minimize();@@ -124,6 +130,8 @@ fn update(self: *Self, now: i64) void {pub fn tick(output: *Output, now: i64) bool {const server = output.server;+ // Runs every frame: with no snapshot alive there is nothing to cancel or pace.+ if (server.minimize_ribbons == null) return false;if (server.locker != null or !anim.enabled() or anim.reducedMotion()) {cancelAll(server);return false;diff --git a/src/effects/window_move.zig b/src/effects/window_move.zigindex 7fa2127..46f76b2 100644--- a/src/effects/window_move.zig+++ b/src/effects/window_move.zig@@ -52,19 +52,27 @@ pub fn cancelFor(server: *Server, id: u64) void {}pub fn start(top: *Top) void {- startWith(top, top.server.config.effects.window_move, null);+ startWith(top, top.server.config.effects.window_move, false);+}++/// Whether resizes may play the flame (and so follow-through): the cheap,+/// usual "no". Stays true after the ribbon itself has faded away.+pub fn resizeEnabled(server: *Server) bool {+ return server.ribbons_ready and server.config.effects.resize().enabled;}pub fn startResize(top: *Top) void {- startWith(top, top.server.config.effects.resize(), Resize.init(top));+ startWith(top, top.server.config.effects.resize(), true);}-fn startWith(top: *Top, binding: @import("config").effects.Binding, resizing: ?Resize) void {+fn startWith(top: *Top, binding: @import("config").effects.Binding, resize: bool) void {const server = top.server;cancel(server);if (!binding.enabled or !server.ribbons_ready or !anim.enabled() or anim.reducedMotion() or server.locker != null) return;const preset = server.config.effects.find(binding.preset) orelse return;if (preset.opacity == 0) return;+ // Past every early out, so a disabled effect costs a resize nothing.+ const resizing: ?Resize = if (resize) Resize.init(top) else null;const self = gpa.create(Self) catch return;const tree = top.frame_tree.createSceneTree() catch {gpa.destroy(self);diff --git a/src/input/grabs.zig b/src/input/grabs.zigindex 2158827..42741b5 100644--- a/src/input/grabs.zig+++ b/src/input/grabs.zig@@ -276,11 +276,16 @@ pub fn finishResize(input: *Input) void {const session = &(input.resize_session orelse return);const toplevel = session.toplevel;@import("../effects/window_move.zig").stop(input.server);- input.server.scheduleFrames();+ // The flame's fade and follow-through need a frame to start; with the+ // effect off the resize ends exactly as it always did.+ if (@import("../effects/window_move.zig").resizeEnabled(input.server)) input.server.scheduleFrames();toplevel.setResizing(false);const final_size = session.latest_desired_size;const shown = @import("../effects/window_move.zig").resizeSize(toplevel, Toplevel.nowMs(), final_size);+ // Only a follow-through still easing toward the final size leaves work+ // pending. Otherwise dirty is cleared here, so flushResizeConfigure ignores+ // a settling session (it used to return early on `settling`).session.dirty = !std.meta.eql(shown, final_size);if (!session.dirty) {session.outstanding_configure = toplevel.requestSize(final_size.width, final_size.height);diff --git a/src/toplevel/chrome_actions.zig b/src/toplevel/chrome_actions.zigindex 23595f6..1f9b3ac 100644--- a/src/toplevel/chrome_actions.zig+++ b/src/toplevel/chrome_actions.zig@@ -55,10 +55,18 @@ pub fn minimize(toplevel: *Toplevel) void {// X11 clients can ask for this while withdrawn; the stack reorder below// needs the window to be in it.if (toplevel.minimized or !toplevel.in_world) return;+ // The flame snapshots the shown window, and a minimized window's frame is+ // hidden by the visual sync in detachInput (window_tabs.visible), so with+ // the flame on the flag is set after the snapshot. Off, it is set first, as+ // it always was.+ const flame = @import("../effects/window_minimize.zig").wanted(toplevel.server);+ if (!flame) toplevel.minimized = true;toplevel.detachInput();toplevel.finishSwitch();- @import("../effects/window_minimize.zig").start(toplevel);- toplevel.minimized = true;+ if (flame) {+ @import("../effects/window_minimize.zig").start(toplevel);+ toplevel.minimized = true;+ }toplevel.frame_tree.node.setEnabled(false);const server = toplevel.server;diff --git a/src/toplevel/lifecycle.zig b/src/toplevel/lifecycle.zigindex 24c8bf8..e0fa737 100644--- a/src/toplevel/lifecycle.zig+++ b/src/toplevel/lifecycle.zig@@ -35,8 +35,10 @@ pub fn handleSurfaceCommit(toplevel: *Toplevel) void {toplevel.positionDuringResize();// An acknowledgement can carry no pixel damage. Pending resize- // work still needs a frame, even after the flame has faded away.- if (session.dirty and session.outstanding_configure == .none) {+ // work of the flame (following the pointer, or left over once it+ // has faded away) still needs a frame; plain resizes already+ // scheduled theirs, so with the effect off nothing changes.+ if (@import("../effects/window_move.zig").resizeEnabled(toplevel.server) and session.dirty and session.outstanding_configure == .none) {if (session.pacing_output) |output| output.wlr_output.scheduleFrame() else toplevel.server.scheduleFrames();}