make keyboard modifiers left/right-aware throughout core

This commit is contained in:
Mitchell Hashimoto
2023-08-07 14:33:56 -07:00
parent 4ed21047a7
commit 67cbabd605
9 changed files with 145 additions and 91 deletions

View File

@@ -64,7 +64,9 @@ pub const MouseMomentum = enum(u3) {
};
/// The bitmask for mods for scroll events.
pub const ScrollMods = packed struct(u8) {
pub const ScrollMods = packed struct(ScrollMods.Int) {
pub const Int = u8;
/// True if this is a high-precision scroll event. For example, Apple
/// devices such as Magic Mouse, trackpads, etc. are high-precision
/// and send very detailed scroll events.
@@ -79,10 +81,10 @@ pub const ScrollMods = packed struct(u8) {
// For our own understanding
test {
const testing = std.testing;
try testing.expectEqual(@as(u8, @bitCast(ScrollMods{})), @as(u8, 0b0));
try testing.expectEqual(@as(Int, @bitCast(ScrollMods{})), @as(Int, 0b0));
try testing.expectEqual(
@as(u8, @bitCast(ScrollMods{ .precision = true })),
@as(u8, 0b0000_0001),
@as(Int, @bitCast(ScrollMods{ .precision = true })),
@as(Int, 0b0000_0001),
);
}
};