From 64a3b72a1cca547eecc52ba33e832c7b1700b31b Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Sat, 18 Apr 2020 13:41:04 +0200 Subject: Split up commands into separate files --- src/command/zoom.zig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/command/zoom.zig (limited to 'src/command/zoom.zig') diff --git a/src/command/zoom.zig b/src/command/zoom.zig new file mode 100644 index 0000000..507620d --- /dev/null +++ b/src/command/zoom.zig @@ -0,0 +1,20 @@ +const c = @import("../c.zig"); + +const Arg = @import("../command.zig").Arg; +const Seat = @import("../seat.zig").Seat; +const View = @import("../view.zig").View; +const ViewStack = @import("../view_stack.zig").ViewStack; + +/// Bump the focused view to the top of the stack. +/// TODO: if the top of the stack is focused, bump the next visible view. +pub fn zoom(seat: *Seat, arg: Arg) void { + if (seat.focused_view) |current_focus| { + const output = seat.focused_output; + const node = @fieldParentPtr(ViewStack(View).Node, "view", current_focus); + if (node != output.views.first) { + output.views.remove(node); + output.views.push(node); + seat.input_manager.server.root.arrange(); + } + } +} -- cgit v1.2.3