https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-accel#members https://devblogs.microsoft.com/oldnewthing/20070316-00/?p=27593
pub const AcceleratorModifiers = struct
pub const AcceleratorModifiers = struct {
value: u8 = 0,
explicit_ascii_or_virtkey: bool = false,
pub const ASCII = 0;
pub const VIRTKEY = 1;
pub const NOINVERT = 1 << 1;
pub const SHIFT = 1 << 2;
pub const CONTROL = 1 << 3;
pub const ALT = 1 << 4;
/// Marker for the last accelerator in an accelerator table
pub const last_accelerator_in_table = 1 << 7;
pub fn apply(self: *AcceleratorModifiers, modifier: rc.AcceleratorTypeAndOptions) void {
if (modifier == .ascii or modifier == .virtkey) self.explicit_ascii_or_virtkey = true;
self.value |= modifierValue(modifier);
}
pub fn isSet(self: AcceleratorModifiers, modifier: rc.AcceleratorTypeAndOptions) bool {
// ASCII is set whenever VIRTKEY is not
if (modifier == .ascii) return self.value & modifierValue(.virtkey) == 0;
return self.value & modifierValue(modifier) != 0;
}
fn modifierValue(modifier: rc.AcceleratorTypeAndOptions) u8 {
return switch (modifier) {
.ascii => ASCII,
.virtkey => VIRTKEY,
.noinvert => NOINVERT,
.shift => SHIFT,
.control => CONTROL,
.alt => ALT,
};
}
pub fn markLast(self: *AcceleratorModifiers) void {
self.value |= last_accelerator_in_table;
}
}