build: update to zig version 0.9.0
This commit is contained in:
@ -25,10 +25,10 @@ const Error = @import("../command.zig").Error;
|
||||
const Seat = @import("../Seat.zig");
|
||||
|
||||
pub fn attachMode(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
_: std.mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
|
@ -22,10 +22,10 @@ const Seat = @import("../Seat.zig");
|
||||
|
||||
/// Close the focused view, if any.
|
||||
pub fn close(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: []const [:0]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
// Note: we don't call arrange() here as it will be called
|
||||
// automatically when the view is unmapped.
|
||||
|
@ -25,10 +25,10 @@ const Seat = @import("../Seat.zig");
|
||||
const Config = @import("../Config.zig");
|
||||
|
||||
pub fn borderWidth(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
_: std.mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
@ -39,10 +39,10 @@ pub fn borderWidth(
|
||||
}
|
||||
|
||||
pub fn backgroundColor(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
_: std.mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
@ -54,10 +54,10 @@ pub fn backgroundColor(
|
||||
}
|
||||
|
||||
pub fn borderColorFocused(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
_: std.mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
@ -69,10 +69,10 @@ pub fn borderColorFocused(
|
||||
}
|
||||
|
||||
pub fn borderColorUnfocused(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
_: std.mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
@ -84,10 +84,10 @@ pub fn borderColorUnfocused(
|
||||
}
|
||||
|
||||
pub fn borderColorUrgent(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
_: std.mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
@ -99,10 +99,10 @@ pub fn borderColorUrgent(
|
||||
}
|
||||
|
||||
pub fn setCursorWarp(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
_: std.mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
|
@ -27,10 +27,10 @@ const Seat = @import("../Seat.zig");
|
||||
|
||||
/// Declare a new keymap mode
|
||||
pub fn declareMode(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
_: std.mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
@ -40,8 +40,8 @@ pub fn declareMode(
|
||||
|
||||
if (config.mode_to_id.get(new_mode_name) != null) return;
|
||||
|
||||
try config.modes.ensureCapacity(config.modes.items.len + 1);
|
||||
const owned_name = try std.mem.dupe(util.gpa, u8, new_mode_name);
|
||||
try config.modes.ensureUnusedCapacity(1);
|
||||
const owned_name = try util.gpa.dupe(u8, new_mode_name);
|
||||
errdefer util.gpa.free(owned_name);
|
||||
try config.mode_to_id.putNoClobber(owned_name, config.modes.items.len);
|
||||
config.modes.appendAssumeCapacity(Mode.init());
|
||||
|
@ -24,7 +24,7 @@ const Seat = @import("../Seat.zig");
|
||||
|
||||
/// Switch to the given mode
|
||||
pub fn enterMode(
|
||||
allocator: *std.mem.Allocator,
|
||||
allocator: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
|
@ -24,10 +24,10 @@ const Seat = @import("../Seat.zig");
|
||||
|
||||
/// Exit the compositor, terminating the wayland session.
|
||||
pub fn exit(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
_: std.mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len > 1) return Error.TooManyArguments;
|
||||
server.wl_server.terminate();
|
||||
|
@ -23,7 +23,6 @@ const server = &@import("../main.zig").server;
|
||||
const util = @import("../util.zig");
|
||||
|
||||
const View = @import("../View.zig");
|
||||
const ViewStack = @import("view_stack.zig").ViewStack;
|
||||
const Error = @import("../command.zig").Error;
|
||||
const Seat = @import("../Seat.zig");
|
||||
|
||||
@ -33,10 +32,10 @@ const FilterKind = enum {
|
||||
};
|
||||
|
||||
pub fn floatFilterAdd(
|
||||
allocator: *mem.Allocator,
|
||||
seat: *Seat,
|
||||
_: mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 3) return Error.NotEnoughArguments;
|
||||
if (args.len > 3) return Error.TooManyArguments;
|
||||
@ -51,14 +50,14 @@ pub fn floatFilterAdd(
|
||||
const gop = try map.getOrPut(util.gpa, key);
|
||||
if (gop.found_existing) return;
|
||||
errdefer assert(map.remove(key));
|
||||
gop.key_ptr.* = try std.mem.dupe(util.gpa, u8, key);
|
||||
gop.key_ptr.* = try util.gpa.dupe(u8, key);
|
||||
}
|
||||
|
||||
pub fn floatFilterRemove(
|
||||
allocator: *mem.Allocator,
|
||||
seat: *Seat,
|
||||
_: mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 3) return Error.NotEnoughArguments;
|
||||
if (args.len > 3) return Error.TooManyArguments;
|
||||
@ -74,10 +73,10 @@ pub fn floatFilterRemove(
|
||||
}
|
||||
|
||||
pub fn csdFilterAdd(
|
||||
allocator: *mem.Allocator,
|
||||
seat: *Seat,
|
||||
_: mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 3) return Error.NotEnoughArguments;
|
||||
if (args.len > 3) return Error.TooManyArguments;
|
||||
@ -92,16 +91,16 @@ pub fn csdFilterAdd(
|
||||
const gop = try map.getOrPut(util.gpa, key);
|
||||
if (gop.found_existing) return;
|
||||
errdefer assert(map.remove(key));
|
||||
gop.key_ptr.* = try std.mem.dupe(util.gpa, u8, key);
|
||||
gop.key_ptr.* = try util.gpa.dupe(u8, key);
|
||||
|
||||
csdFilterUpdateViews(kind, key, .add);
|
||||
}
|
||||
|
||||
pub fn csdFilterRemove(
|
||||
allocator: *mem.Allocator,
|
||||
seat: *Seat,
|
||||
_: mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 3) return Error.NotEnoughArguments;
|
||||
if (args.len > 3) return Error.TooManyArguments;
|
||||
|
@ -25,10 +25,10 @@ const Error = @import("../command.zig").Error;
|
||||
const Seat = @import("../Seat.zig");
|
||||
|
||||
pub fn focusFollowsCursor(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
_: std.mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
|
@ -28,10 +28,10 @@ const ViewStack = @import("../view_stack.zig").ViewStack;
|
||||
/// Focus either the next or the previous visible view, depending on the enum
|
||||
/// passed. Does nothing if there are 1 or 0 views in the stack.
|
||||
pub fn focusView(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
|
@ -28,11 +28,13 @@ const InputConfig = @import("../InputConfig.zig");
|
||||
const InputManager = @import("../InputManager.zig");
|
||||
|
||||
pub fn listInputs(
|
||||
allocator: *mem.Allocator,
|
||||
seat: *Seat,
|
||||
allocator: mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len > 1) return error.TooManyArguments;
|
||||
|
||||
var input_list = std.ArrayList(u8).init(allocator);
|
||||
const writer = input_list.writer();
|
||||
var prev = false;
|
||||
@ -59,11 +61,13 @@ pub fn listInputs(
|
||||
}
|
||||
|
||||
pub fn listInputConfigs(
|
||||
allocator: *mem.Allocator,
|
||||
seat: *Seat,
|
||||
allocator: mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len > 1) return error.TooManyArguments;
|
||||
|
||||
var input_list = std.ArrayList(u8).init(allocator);
|
||||
const writer = input_list.writer();
|
||||
|
||||
@ -122,10 +126,10 @@ pub fn listInputConfigs(
|
||||
}
|
||||
|
||||
pub fn input(
|
||||
allocator: *mem.Allocator,
|
||||
seat: *Seat,
|
||||
_: mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 4) return Error.NotEnoughArguments;
|
||||
if (args.len > 4) return Error.TooManyArguments;
|
||||
|
@ -26,10 +26,10 @@ const Error = @import("../command.zig").Error;
|
||||
const Seat = @import("../Seat.zig");
|
||||
|
||||
pub fn outputLayout(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
@ -40,10 +40,10 @@ pub fn outputLayout(
|
||||
}
|
||||
|
||||
pub fn defaultLayout(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
_: std.mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
@ -63,10 +63,10 @@ pub fn defaultLayout(
|
||||
/// riverctl send-layout-cmd rivertile "mod-main-factor -0.1"
|
||||
/// riverctl send-layout-cmd rivertile "main-location top"
|
||||
pub fn sendLayoutCmd(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 3) return Error.NotEnoughArguments;
|
||||
if (args.len > 3) return Error.TooManyArguments;
|
||||
@ -81,6 +81,5 @@ pub fn sendLayoutCmd(
|
||||
} else return;
|
||||
|
||||
layout.layout.sendUserCommand(args[2]);
|
||||
|
||||
output.arrangeViews();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ const Seat = @import("../Seat.zig");
|
||||
/// Example:
|
||||
/// map normal Mod4+Shift Return spawn foot
|
||||
pub fn map(
|
||||
allocator: *std.mem.Allocator,
|
||||
allocator: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
@ -46,7 +46,7 @@ pub fn map(
|
||||
|
||||
if (optionals.release and optionals.repeat) return Error.ConflictingOptions;
|
||||
|
||||
const mode_id = try modeNameToId(allocator, seat, args[1 + offset], out);
|
||||
const mode_id = try modeNameToId(allocator, args[1 + offset], out);
|
||||
const modifiers = try parseModifiers(allocator, args[2 + offset], out);
|
||||
const keysym = try parseKeysym(allocator, args[3 + offset], out);
|
||||
|
||||
@ -72,15 +72,15 @@ pub fn map(
|
||||
/// Example:
|
||||
/// map-pointer normal Mod4 BTN_LEFT move-view
|
||||
pub fn mapPointer(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
allocator: std.mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 5) return Error.NotEnoughArguments;
|
||||
if (args.len > 5) return Error.TooManyArguments;
|
||||
|
||||
const mode_id = try modeNameToId(allocator, seat, args[1], out);
|
||||
const mode_id = try modeNameToId(allocator, args[1], out);
|
||||
const modifiers = try parseModifiers(allocator, args[2], out);
|
||||
const event_code = try parseEventCode(allocator, args[3], out);
|
||||
|
||||
@ -111,7 +111,7 @@ pub fn mapPointer(
|
||||
}
|
||||
}
|
||||
|
||||
fn modeNameToId(allocator: *std.mem.Allocator, seat: *Seat, mode_name: []const u8, out: *?[]const u8) !usize {
|
||||
fn modeNameToId(allocator: std.mem.Allocator, mode_name: []const u8, out: *?[]const u8) !usize {
|
||||
const config = &server.config;
|
||||
return config.mode_to_id.get(mode_name) orelse {
|
||||
out.* = try std.fmt.allocPrint(
|
||||
@ -154,7 +154,7 @@ fn pointerMappingExists(
|
||||
return null;
|
||||
}
|
||||
|
||||
fn parseEventCode(allocator: *std.mem.Allocator, name: [:0]const u8, out: *?[]const u8) !u32 {
|
||||
fn parseEventCode(allocator: std.mem.Allocator, name: [:0]const u8, out: *?[]const u8) !u32 {
|
||||
const event_code = c.libevdev_event_code_from_name(c.EV_KEY, name);
|
||||
if (event_code < 1) {
|
||||
out.* = try std.fmt.allocPrint(allocator, "unknown button {s}", .{name});
|
||||
@ -164,7 +164,7 @@ fn parseEventCode(allocator: *std.mem.Allocator, name: [:0]const u8, out: *?[]co
|
||||
return @intCast(u32, event_code);
|
||||
}
|
||||
|
||||
fn parseKeysym(allocator: *std.mem.Allocator, name: [:0]const u8, out: *?[]const u8) !xkb.Keysym {
|
||||
fn parseKeysym(allocator: std.mem.Allocator, name: [:0]const u8, out: *?[]const u8) !xkb.Keysym {
|
||||
const keysym = xkb.Keysym.fromName(name, .case_insensitive);
|
||||
if (keysym == .NoSymbol) {
|
||||
out.* = try std.fmt.allocPrint(allocator, "invalid keysym '{s}'", .{name});
|
||||
@ -174,11 +174,11 @@ fn parseKeysym(allocator: *std.mem.Allocator, name: [:0]const u8, out: *?[]const
|
||||
}
|
||||
|
||||
fn parseModifiers(
|
||||
allocator: *std.mem.Allocator,
|
||||
allocator: std.mem.Allocator,
|
||||
modifiers_str: []const u8,
|
||||
out: *?[]const u8,
|
||||
) !wlr.Keyboard.ModifierMask {
|
||||
var it = std.mem.split(modifiers_str, "+");
|
||||
var it = std.mem.split(u8, modifiers_str, "+");
|
||||
var modifiers = wlr.Keyboard.ModifierMask{};
|
||||
outer: while (it.next()) |mod_name| {
|
||||
if (mem.eql(u8, mod_name, "None")) continue;
|
||||
@ -245,7 +245,7 @@ fn parseOptionalArgs(args: []const []const u8) OptionalArgsContainer {
|
||||
/// Example:
|
||||
/// unmap normal Mod4+Shift Return
|
||||
pub fn unmap(
|
||||
allocator: *std.mem.Allocator,
|
||||
allocator: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
@ -255,7 +255,7 @@ pub fn unmap(
|
||||
const offset = optionals.i;
|
||||
if (args.len - offset < 4) return Error.NotEnoughArguments;
|
||||
|
||||
const mode_id = try modeNameToId(allocator, seat, args[1 + offset], out);
|
||||
const mode_id = try modeNameToId(allocator, args[1 + offset], out);
|
||||
const modifiers = try parseModifiers(allocator, args[2 + offset], out);
|
||||
const keysym = try parseKeysym(allocator, args[3 + offset], out);
|
||||
|
||||
@ -276,15 +276,15 @@ pub fn unmap(
|
||||
/// Example:
|
||||
/// unmap-pointer normal Mod4 BTN_LEFT
|
||||
pub fn unmapPointer(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
allocator: std.mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 4) return Error.NotEnoughArguments;
|
||||
if (args.len > 4) return Error.TooManyArguments;
|
||||
|
||||
const mode_id = try modeNameToId(allocator, seat, args[1], out);
|
||||
const mode_id = try modeNameToId(allocator, args[1], out);
|
||||
const modifiers = try parseModifiers(allocator, args[2], out);
|
||||
const event_code = try parseEventCode(allocator, args[3], out);
|
||||
|
||||
|
@ -27,10 +27,10 @@ const View = @import("../View.zig");
|
||||
const Box = @import("../Box.zig");
|
||||
|
||||
pub fn move(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 3) return Error.NotEnoughArguments;
|
||||
if (args.len > 3) return Error.TooManyArguments;
|
||||
@ -51,10 +51,10 @@ pub fn move(
|
||||
}
|
||||
|
||||
pub fn snap(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
@ -78,10 +78,10 @@ pub fn snap(
|
||||
}
|
||||
|
||||
pub fn resize(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 3) return Error.NotEnoughArguments;
|
||||
if (args.len > 3) return Error.TooManyArguments;
|
||||
|
@ -28,10 +28,10 @@ const Output = @import("../Output.zig");
|
||||
const Seat = @import("../Seat.zig");
|
||||
|
||||
pub fn focusOutput(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
@ -48,10 +48,10 @@ pub fn focusOutput(
|
||||
}
|
||||
|
||||
pub fn sendToOutput(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
|
@ -24,10 +24,10 @@ const Seat = @import("../Seat.zig");
|
||||
|
||||
/// Set the repeat rate and delay for all keyboards.
|
||||
pub fn setRepeat(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 3) return Error.NotEnoughArguments;
|
||||
if (args.len > 3) return Error.TooManyArguments;
|
||||
|
@ -24,8 +24,8 @@ const Seat = @import("../Seat.zig");
|
||||
|
||||
/// Spawn a program.
|
||||
pub fn spawn(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
allocator: std.mem.Allocator,
|
||||
_: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
) Error!void {
|
||||
@ -42,7 +42,7 @@ pub fn spawn(
|
||||
if (pid == 0) {
|
||||
// Clean things up for the child in an intermediate fork
|
||||
if (c.setsid() < 0) unreachable;
|
||||
if (std.os.system.sigprocmask(std.os.SIG_SETMASK, &std.os.empty_sigset, null) < 0) unreachable;
|
||||
if (std.os.system.sigprocmask(std.os.SIG.SETMASK, &std.os.empty_sigset, null) < 0) unreachable;
|
||||
|
||||
const pid2 = std.os.fork() catch c._exit(1);
|
||||
if (pid2 == 0) std.os.execveZ("/bin/sh", &child_args, std.c.environ) catch c._exit(1);
|
||||
@ -52,8 +52,8 @@ pub fn spawn(
|
||||
|
||||
// Wait the intermediate child.
|
||||
const ret = std.os.waitpid(pid, 0);
|
||||
if (!std.os.WIFEXITED(ret.status) or
|
||||
(std.os.WIFEXITED(ret.status) and std.os.WEXITSTATUS(ret.status) != 0))
|
||||
if (!std.os.W.IFEXITED(ret.status) or
|
||||
(std.os.W.IFEXITED(ret.status) and std.os.W.EXITSTATUS(ret.status) != 0))
|
||||
{
|
||||
out.* = try std.fmt.allocPrint(allocator, "fork/execve failed", .{});
|
||||
return Error.Other;
|
||||
|
@ -27,10 +27,10 @@ const ViewStack = @import("../view_stack.zig").ViewStack;
|
||||
|
||||
/// Swap the currently focused view with either the view higher or lower in the visible stack
|
||||
pub fn swap(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
|
@ -24,7 +24,7 @@ const Seat = @import("../Seat.zig");
|
||||
|
||||
/// Switch focus to the passed tags.
|
||||
pub fn setFocusedTags(
|
||||
allocator: *std.mem.Allocator,
|
||||
allocator: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
@ -41,7 +41,7 @@ pub fn setFocusedTags(
|
||||
|
||||
/// Set the spawn tagmask
|
||||
pub fn spawnTagmask(
|
||||
allocator: *std.mem.Allocator,
|
||||
allocator: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
@ -52,7 +52,7 @@ pub fn spawnTagmask(
|
||||
|
||||
/// Set the tags of the focused view.
|
||||
pub fn setViewTags(
|
||||
allocator: *std.mem.Allocator,
|
||||
allocator: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
@ -68,7 +68,7 @@ pub fn setViewTags(
|
||||
|
||||
/// Toggle focus of the passsed tags.
|
||||
pub fn toggleFocusedTags(
|
||||
allocator: *std.mem.Allocator,
|
||||
allocator: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
@ -87,7 +87,7 @@ pub fn toggleFocusedTags(
|
||||
|
||||
/// Toggle the passed tags of the focused view
|
||||
pub fn toggleViewTags(
|
||||
allocator: *std.mem.Allocator,
|
||||
allocator: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
@ -106,11 +106,12 @@ pub fn toggleViewTags(
|
||||
|
||||
/// Switch focus to tags that were selected previously
|
||||
pub fn focusPreviousTags(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const []const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len > 1) return error.TooManyArguments;
|
||||
const previous_tags = seat.focused_output.previous_tags;
|
||||
if (seat.focused_output.pending.tags != previous_tags) {
|
||||
seat.focused_output.previous_tags = seat.focused_output.pending.tags;
|
||||
@ -123,11 +124,12 @@ pub fn focusPreviousTags(
|
||||
|
||||
/// Set the tags of the focused view to the tags that were selected previously
|
||||
pub fn sendToPreviousTags(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const []const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len > 1) return error.TooManyArguments;
|
||||
const previous_tags = seat.focused_output.previous_tags;
|
||||
if (seat.focused == .view) {
|
||||
const view = seat.focused.view;
|
||||
@ -138,7 +140,7 @@ pub fn sendToPreviousTags(
|
||||
}
|
||||
|
||||
fn parseTags(
|
||||
allocator: *std.mem.Allocator,
|
||||
allocator: std.mem.Allocator,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
) Error!u32 {
|
||||
|
@ -25,10 +25,10 @@ const Seat = @import("../Seat.zig");
|
||||
/// Make the focused view float or stop floating, depending on its current
|
||||
/// state.
|
||||
pub fn toggleFloat(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len > 1) return Error.TooManyArguments;
|
||||
|
||||
|
@ -25,10 +25,10 @@ const Seat = @import("../Seat.zig");
|
||||
|
||||
/// Toggle fullscreen state of the currently focused view
|
||||
pub fn toggleFullscreen(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len > 1) return Error.TooManyArguments;
|
||||
|
||||
|
@ -21,10 +21,10 @@ const Error = @import("../command.zig").Error;
|
||||
const Seat = @import("../Seat.zig");
|
||||
|
||||
pub fn xcursorTheme(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 3) return Error.TooManyArguments;
|
||||
|
@ -27,10 +27,10 @@ const ViewStack = @import("../view_stack.zig").ViewStack;
|
||||
/// Bump the focused view to the top of the stack. If the view on the top of
|
||||
/// the stack is focused, bump the second view to the top.
|
||||
pub fn zoom(
|
||||
allocator: *std.mem.Allocator,
|
||||
_: std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const [:0]const u8,
|
||||
out: *?[]const u8,
|
||||
_: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len > 1) return Error.TooManyArguments;
|
||||
|
||||
|
Reference in New Issue
Block a user