Root: use attach mode top when restoring from fallback

This commit is contained in:
wakwkc
2026-03-07 16:24:17 -08:00
committed by Isaac Freund
parent f0908e2d11
commit bbdc47778d
3 changed files with 8 additions and 7 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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