diff --git a/river/Root.zig b/river/Root.zig index 7aec4cb..5649bf6 100644 --- a/river/Root.zig +++ b/river/Root.zig @@ -311,7 +311,7 @@ pub fn deactivateOutput(root: *Root, output: *Output) void { }; if (fallback_output) |fallback| { var it = output.pending.focus_stack.safeIterator(.reverse); - while (it.next()) |view| view.setPendingOutput(fallback); + while (it.next()) |view| view.setPendingOutput(fallback, fallback.attachMode()); } else { var it = output.pending.focus_stack.iterator(.forward); while (it.next()) |view| view.pending.output = null; @@ -390,7 +390,7 @@ pub fn activateOutput(root: *Root, output: *Output) void { output.pending.tags = root.fallback_pending.tags; { var it = root.fallback_pending.wm_stack.safeIterator(.reverse); - while (it.next()) |view| view.setPendingOutput(output); + while (it.next()) |view| view.setPendingOutput(output, .top); } { // Focus the new output with all seats @@ -407,7 +407,7 @@ pub fn activateOutput(root: *Root, output: *Output) void { const name = view.output_before_evac orelse continue; if (mem.eql(u8, name, mem.span(output.wlr_output.name))) { if (view.pending.output != output) { - view.setPendingOutput(output); + view.setPendingOutput(output, output.attachMode()); } util.gpa.free(name); view.output_before_evac = null; diff --git a/river/View.zig b/river/View.zig index 10847a2..f3380a0 100644 --- a/river/View.zig +++ b/river/View.zig @@ -28,6 +28,7 @@ const wp = @import("wayland").server.wp; const server = &@import("main.zig").server; const util = @import("util.zig"); +const Config = @import("Config.zig"); const ForeignToplevelHandle = @import("ForeignToplevelHandle.zig"); const Output = @import("Output.zig"); const SceneNodeData = @import("SceneNodeData.zig"); @@ -529,12 +530,12 @@ fn saveSurfaceTreeIter( saved.setTransform(buffer.transform); } -pub fn setPendingOutput(view: *View, output: *Output) void { +pub fn setPendingOutput(view: *View, output: *Output, attach_mode: Config.AttachMode) void { view.pending.output = output; view.pending_wm_stack_link.remove(); view.pending_focus_stack_link.remove(); - switch (output.attachMode()) { + switch (attach_mode) { .top => output.pending.wm_stack.prepend(view), .bottom => output.pending.wm_stack.append(view), .after => |n| view.attachAfter(&output.pending, n), @@ -709,7 +710,7 @@ pub fn map(view: *View) !void { }; if (output) |o| { - view.setPendingOutput(o); + view.setPendingOutput(o, o.attachMode()); var it = server.input_manager.seats.iterator(.forward); while (it.next()) |seat| seat.focus(view); diff --git a/river/command/output.zig b/river/command/output.zig index 98d1726..6dccf80 100644 --- a/river/command/output.zig +++ b/river/command/output.zig @@ -78,7 +78,7 @@ pub fn sendToOutput( seat.focused.view.pending.tags = destination_output.pending.tags; } - seat.focused.view.setPendingOutput(destination_output); + seat.focused.view.setPendingOutput(destination_output, destination_output.attachMode()); // When explicitly sending a view to an output, the user likely // does not expect a previously evacuated view moved back to a