Implement libinput device configuration

We need to defer config application to the first manage_start event
using a should_manage flag so that all *_support events have arrived
before we try applying the configs

This commit also has two other fixes
- fixes a potential use-after-free by telling InputDevice when a
 LibinputDevice is .removed.
- fix logFn (removed "if (scope != .default) return;")

I used kwm to help figure out the manage pattern for the input config.
Link to kwm: https://github.com/kewuaa/kwm
This commit is contained in:
Ben Buhse 2026-02-10 20:06:17 -06:00
commit 296f875993
No known key found for this signature in database
GPG key ID: 7916ACFCD38FD0B4
5 changed files with 184 additions and 22 deletions

View file

@ -213,11 +213,11 @@ var runtime_log_level: std.log.Level = switch (builtin.mode) {
.ReleaseSafe, .ReleaseFast, .ReleaseSmall => .info,
};
// pub const std_options: std.Options = .{
// // Tell std.log to leave all log level filtering to us.
// .log_level = .debug,
// .logFn = logFn,
// };
pub const std_options: std.Options = .{
// Tell std.log to leave all log level filtering to us.
.log_level = .debug,
.logFn = logFn,
};
pub fn logFn(
comptime level: std.log.Level,
@ -227,8 +227,6 @@ pub fn logFn(
) void {
if (@intFromEnum(level) > @intFromEnum(runtime_log_level)) return;
if (scope != .default) return;
const scope_prefix = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): ";
stderr.print(level.asText() ++ scope_prefix ++ format ++ "\n", args) catch return;