tty(windows): fix mouse wheel direction calculation

This commit is contained in:
CJ van den Berg 2024-06-13 14:52:52 +02:00 committed by Tim Culverhouse
parent 36696e8785
commit 3a0392c282

View file

@ -291,10 +291,10 @@ pub fn nextEvent(self: *Tty) !Event {
// High word of dwButtonState represents mouse wheel. Positive is wheel_up, negative
// is wheel_down
// Low word represents button state
const mouse_wheel_direction: i32 = blk: {
const wheelu64: u64 = event.dwButtonState >> 16;
const wheelu32: u32 = @truncate(wheelu64);
break :blk @bitCast(wheelu32);
const mouse_wheel_direction: i16 = blk: {
const wheelu32: u32 = event.dwButtonState >> 16;
const wheelu16: u16 = @truncate(wheelu32);
break :blk @bitCast(wheelu16);
};
const buttons: u16 = @truncate(event.dwButtonState);