river: remove InputManager.server
The server is now global so this is no longer needed.
This commit is contained in:
@ -17,6 +17,8 @@
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
const server = &@import("../main.zig").server;
|
||||
|
||||
const Error = @import("../command.zig").Error;
|
||||
const Seat = @import("../Seat.zig");
|
||||
|
||||
@ -29,7 +31,6 @@ pub fn borderWidth(
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
|
||||
const server = seat.input_manager.server;
|
||||
server.config.border_width = try std.fmt.parseInt(u32, args[1], 10);
|
||||
server.root.arrangeAll();
|
||||
server.root.startTransaction();
|
||||
@ -44,7 +45,7 @@ pub fn backgroundColor(
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
|
||||
seat.input_manager.server.config.background_color = try parseRgba(args[1]);
|
||||
server.config.background_color = try parseRgba(args[1]);
|
||||
}
|
||||
|
||||
pub fn borderColorFocused(
|
||||
@ -56,7 +57,7 @@ pub fn borderColorFocused(
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
|
||||
seat.input_manager.server.config.border_color_focused = try parseRgba(args[1]);
|
||||
server.config.border_color_focused = try parseRgba(args[1]);
|
||||
}
|
||||
|
||||
pub fn borderColorUnfocused(
|
||||
@ -68,7 +69,7 @@ pub fn borderColorUnfocused(
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
|
||||
seat.input_manager.server.config.border_color_unfocused = try parseRgba(args[1]);
|
||||
server.config.border_color_unfocused = try parseRgba(args[1]);
|
||||
}
|
||||
|
||||
/// Parse a color in the format #RRGGBB or #RRGGBBAA
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
const server = &@import("../main.zig").server;
|
||||
const util = @import("../util.zig");
|
||||
|
||||
const Mode = @import("../Mode.zig");
|
||||
@ -34,7 +35,7 @@ pub fn declareMode(
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
|
||||
const config = &seat.input_manager.server.config;
|
||||
const config = &server.config;
|
||||
const new_mode_name = args[1];
|
||||
|
||||
if (config.mode_to_id.get(new_mode_name) != null) return;
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
const server = &@import("../main.zig").server;
|
||||
|
||||
const Error = @import("../command.zig").Error;
|
||||
const Seat = @import("../Seat.zig");
|
||||
|
||||
@ -39,9 +41,8 @@ pub fn enterMode(
|
||||
return Error.Other;
|
||||
}
|
||||
|
||||
const config = seat.input_manager.server.config;
|
||||
const target_mode = args[1];
|
||||
const mode_id = config.mode_to_id.get(target_mode) orelse {
|
||||
const mode_id = server.config.mode_to_id.get(target_mode) orelse {
|
||||
out.* = try std.fmt.allocPrint(
|
||||
allocator,
|
||||
"cannot enter non-existant mode '{}'",
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
const server = &@import("../main.zig").server;
|
||||
|
||||
const Error = @import("../command.zig").Error;
|
||||
const Seat = @import("../Seat.zig");
|
||||
|
||||
@ -28,5 +30,5 @@ pub fn exit(
|
||||
out: *?[]const u8,
|
||||
) Error!void {
|
||||
if (args.len > 1) return Error.TooManyArguments;
|
||||
seat.input_manager.server.wl_server.terminate();
|
||||
server.wl_server.terminate();
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
const server = &@import("../main.zig").server;
|
||||
const util = @import("../util.zig");
|
||||
|
||||
const Error = @import("../command.zig").Error;
|
||||
@ -40,7 +41,7 @@ pub fn floatFilterAdd(
|
||||
) Error!void {
|
||||
try appendFilter(
|
||||
allocator,
|
||||
&seat.input_manager.server.config.float_filter,
|
||||
&server.config.float_filter,
|
||||
args,
|
||||
);
|
||||
}
|
||||
@ -53,7 +54,7 @@ pub fn csdFilterAdd(
|
||||
) Error!void {
|
||||
try appendFilter(
|
||||
allocator,
|
||||
&seat.input_manager.server.config.csd_filter,
|
||||
&server.config.csd_filter,
|
||||
args,
|
||||
);
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
const server = &@import("../main.zig").server;
|
||||
const util = @import("../util.zig");
|
||||
|
||||
const Config = @import("../Config.zig");
|
||||
@ -32,8 +33,6 @@ pub fn focusFollowsCursor(
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
|
||||
const server = seat.input_manager.server;
|
||||
|
||||
server.config.focus_follows_cursor =
|
||||
std.meta.stringToEnum(Config.FocusFollowsCursorMode, args[1]) orelse return Error.UnknownOption;
|
||||
}
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
const server = &@import("../main.zig").server;
|
||||
|
||||
const Direction = @import("../command.zig").Direction;
|
||||
const Error = @import("../command.zig").Error;
|
||||
const Output = @import("../Output.zig");
|
||||
@ -34,21 +36,20 @@ pub fn focusOutput(
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
|
||||
const direction = std.meta.stringToEnum(Direction, args[1]) orelse return Error.InvalidDirection;
|
||||
const root = &seat.input_manager.server.root;
|
||||
|
||||
// If the noop output is focused, there are no other outputs to switch to
|
||||
if (seat.focused_output == &root.noop_output) {
|
||||
std.debug.assert(root.outputs.len == 0);
|
||||
if (seat.focused_output == &server.root.noop_output) {
|
||||
std.debug.assert(server.root.outputs.len == 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Focus the next/prev output in the list if there is one, else wrap
|
||||
const focused_node = @fieldParentPtr(std.TailQueue(Output).Node, "data", seat.focused_output);
|
||||
seat.focusOutput(switch (direction) {
|
||||
.next => if (focused_node.next) |node| &node.data else &root.outputs.first.?.data,
|
||||
.previous => if (focused_node.prev) |node| &node.data else &root.outputs.last.?.data,
|
||||
.next => if (focused_node.next) |node| &node.data else &server.root.outputs.first.?.data,
|
||||
.previous => if (focused_node.prev) |node| &node.data else &server.root.outputs.last.?.data,
|
||||
});
|
||||
|
||||
seat.focus(null);
|
||||
root.startTransaction();
|
||||
server.root.startTransaction();
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ const mem = std.mem;
|
||||
const wl = @import("wayland").server.wl;
|
||||
const util = @import("../util.zig");
|
||||
|
||||
const server = &@import("../main.zig").server;
|
||||
|
||||
const Error = @import("../command.zig").Error;
|
||||
const Seat = @import("../Seat.zig");
|
||||
|
||||
@ -46,7 +48,6 @@ pub fn defaultLayout(
|
||||
if (args.len < 2) return Error.NotEnoughArguments;
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
|
||||
const server = seat.input_manager.server;
|
||||
server.config.default_layout_namespace = try util.gpa.dupe(u8, args[1]);
|
||||
var it = server.root.all_outputs.first;
|
||||
while (it) |node| : (it = node.next) {
|
||||
|
@ -21,6 +21,7 @@ const wlr = @import("wlroots");
|
||||
const xkb = @import("xkbcommon");
|
||||
|
||||
const c = @import("../c.zig");
|
||||
const server = &@import("../main.zig").server;
|
||||
const util = @import("../util.zig");
|
||||
|
||||
const Error = @import("../command.zig").Error;
|
||||
@ -47,7 +48,7 @@ pub fn map(
|
||||
const modifiers = try parseModifiers(allocator, args[2 + offset], out);
|
||||
const keysym = try parseKeysym(allocator, args[3 + offset], out);
|
||||
|
||||
const mode_mappings = &seat.input_manager.server.config.modes.items[mode_id].mappings;
|
||||
const mode_mappings = &server.config.modes.items[mode_id].mappings;
|
||||
|
||||
const new = try Mapping.init(keysym, modifiers, optionals.release, args[4 + offset ..]);
|
||||
errdefer new.deinit();
|
||||
@ -96,7 +97,7 @@ pub fn mapPointer(
|
||||
.action = action,
|
||||
};
|
||||
|
||||
const mode_pointer_mappings = &seat.input_manager.server.config.modes.items[mode_id].pointer_mappings;
|
||||
const mode_pointer_mappings = &server.config.modes.items[mode_id].pointer_mappings;
|
||||
if (pointerMappingExists(mode_pointer_mappings, modifiers, event_code)) |current| {
|
||||
mode_pointer_mappings.items[current] = new;
|
||||
} else {
|
||||
@ -105,7 +106,7 @@ pub fn mapPointer(
|
||||
}
|
||||
|
||||
fn modeNameToId(allocator: *std.mem.Allocator, seat: *Seat, mode_name: []const u8, out: *?[]const u8) !usize {
|
||||
const config = seat.input_manager.server.config;
|
||||
const config = &server.config;
|
||||
return config.mode_to_id.get(mode_name) orelse {
|
||||
out.* = try std.fmt.allocPrint(
|
||||
allocator,
|
||||
@ -255,7 +256,7 @@ pub fn unmap(
|
||||
const modifiers = try parseModifiers(allocator, args[2 + offset], out);
|
||||
const keysym = try parseKeysym(allocator, args[3 + offset], out);
|
||||
|
||||
const mode_mappings = &seat.input_manager.server.config.modes.items[mode_id].mappings;
|
||||
const mode_mappings = &server.config.modes.items[mode_id].mappings;
|
||||
const mapping_idx = mappingExists(mode_mappings, modifiers, keysym, optionals.release) orelse return;
|
||||
|
||||
var mapping = mode_mappings.swapRemove(mapping_idx);
|
||||
@ -279,7 +280,7 @@ pub fn unmapPointer(
|
||||
const modifiers = try parseModifiers(allocator, args[2], out);
|
||||
const event_code = try parseEventCode(allocator, args[3], out);
|
||||
|
||||
const mode_pointer_mappings = &seat.input_manager.server.config.modes.items[mode_id].pointer_mappings;
|
||||
const mode_pointer_mappings = &server.config.modes.items[mode_id].pointer_mappings;
|
||||
const mapping_idx = pointerMappingExists(mode_pointer_mappings, modifiers, event_code) orelse return;
|
||||
|
||||
_ = mode_pointer_mappings.swapRemove(mapping_idx);
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
const server = &@import("../main.zig").server;
|
||||
|
||||
const Error = @import("../command.zig").Error;
|
||||
const Seat = @import("../Seat.zig");
|
||||
const View = @import("../View.zig");
|
||||
@ -36,8 +38,6 @@ pub fn opacity(
|
||||
if (args.len < 6) return Error.NotEnoughArguments;
|
||||
if (args.len > 6) return Error.TooManyArguments;
|
||||
|
||||
const server = seat.input_manager.server;
|
||||
|
||||
// Focused opacity
|
||||
server.config.opacity.focused = try std.fmt.parseFloat(f32, args[1]);
|
||||
if (server.config.opacity.focused < 0.0 or server.config.opacity.focused > 1.0)
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
const server = &@import("../main.zig").server;
|
||||
|
||||
const Direction = @import("../command.zig").Direction;
|
||||
const Error = @import("../command.zig").Error;
|
||||
const Output = @import("../Output.zig");
|
||||
@ -34,20 +36,19 @@ pub fn sendToOutput(
|
||||
if (args.len > 2) return Error.TooManyArguments;
|
||||
|
||||
const direction = std.meta.stringToEnum(Direction, args[1]) orelse return Error.InvalidDirection;
|
||||
const root = &seat.input_manager.server.root;
|
||||
|
||||
if (seat.focused == .view) {
|
||||
// If the noop output is focused, there is nowhere to send the view
|
||||
if (seat.focused_output == &root.noop_output) {
|
||||
std.debug.assert(root.outputs.len == 0);
|
||||
if (seat.focused_output == &server.root.noop_output) {
|
||||
std.debug.assert(server.root.outputs.len == 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Send to the next/prev output in the list if there is one, else wrap
|
||||
const current_node = @fieldParentPtr(std.TailQueue(Output).Node, "data", seat.focused_output);
|
||||
const destination_output = switch (direction) {
|
||||
.next => if (current_node.next) |node| &node.data else &root.outputs.first.?.data,
|
||||
.previous => if (current_node.prev) |node| &node.data else &root.outputs.last.?.data,
|
||||
.next => if (current_node.next) |node| &node.data else &server.root.outputs.first.?.data,
|
||||
.previous => if (current_node.prev) |node| &node.data else &server.root.outputs.last.?.data,
|
||||
};
|
||||
|
||||
// Move the view to the target output
|
||||
@ -57,6 +58,6 @@ pub fn sendToOutput(
|
||||
seat.focus(null);
|
||||
seat.focused_output.arrangeViews();
|
||||
destination_output.arrangeViews();
|
||||
root.startTransaction();
|
||||
server.root.startTransaction();
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
const server = &@import("../main.zig").server;
|
||||
|
||||
const Error = @import("../command.zig").Error;
|
||||
const Seat = @import("../Seat.zig");
|
||||
|
||||
@ -33,9 +35,8 @@ pub fn setRepeat(
|
||||
const rate = try std.fmt.parseInt(u31, args[1], 10);
|
||||
const delay = try std.fmt.parseInt(u31, args[2], 10);
|
||||
|
||||
const config = &seat.input_manager.server.config;
|
||||
config.repeat_rate = rate;
|
||||
config.repeat_delay = delay;
|
||||
server.config.repeat_rate = rate;
|
||||
server.config.repeat_delay = delay;
|
||||
|
||||
var it = seat.keyboards.first;
|
||||
while (it) |node| : (it = node.next) {
|
||||
|
Reference in New Issue
Block a user