input: Improve input device name format
The name now includes the type, for the case of a physical device advertising more than one logical device.
This commit is contained in:
committed by
Isaac Freund
parent
53f84b76f3
commit
422cd3e01f
@ -46,11 +46,15 @@ pub const InputDevice = struct {
|
||||
identifier: []const u8,
|
||||
|
||||
pub fn init(self: *InputDevice, device: *wlr.InputDevice) !void {
|
||||
// The identifier is formatted exactly as in Sway
|
||||
const identifier = try std.fmt.allocPrint(
|
||||
util.gpa,
|
||||
"{}:{}:{s}",
|
||||
.{ device.vendor, device.product, mem.trim(u8, mem.span(device.name), &ascii.spaces) },
|
||||
"{s}-{}-{}-{s}",
|
||||
.{
|
||||
@tagName(device.type),
|
||||
device.vendor,
|
||||
device.product,
|
||||
mem.trim(u8, mem.span(device.name), &ascii.spaces),
|
||||
},
|
||||
);
|
||||
for (identifier) |*char| {
|
||||
if (char.* == ' ' or !std.ascii.isPrint(char.*)) {
|
||||
|
Reference in New Issue
Block a user