fix error set for libxev cross-platform

This commit is contained in:
Mitchell Hashimoto
2023-08-09 10:05:48 -07:00
parent e33f6c71de
commit e15b5ab42c

View File

@ -369,12 +369,19 @@ fn cursorCancelCallback(
_: *xev.Completion, _: *xev.Completion,
r: xev.Timer.CancelError!void, r: xev.Timer.CancelError!void,
) xev.CallbackAction { ) xev.CallbackAction {
_ = r catch |err| switch (err) { // This makes it easier to work across platforms where different platforms
// support different sets of errors, so we just unify it.
const CancelError = xev.Timer.CancelError || error{
Canceled,
Unexpected,
};
_ = r catch |err| switch (@as(CancelError, @errSetCast(err))) {
error.Canceled => {}, error.Canceled => {},
// else => { else => {
// log.warn("error in cursor cancel callback err={}", .{err}); log.warn("error in cursor cancel callback err={}", .{err});
// unreachable; unreachable;
// }, },
}; };
return .disarm; return .disarm;