diff options
| author | tv <tv@krebsco.de> | 2026-11-16 02:15:46 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-16 04:12:12 +0100 |
| commit | 37a5a4be992d8893ca2a81fbc1ca250b4895e5df (patch) | |
| tree | 94781ad678d0d813cba64f6cfbbe7003cb4b75dd /src | |
| parent | 7a9ba1533ecb3e6ccdf140fbb6bcb72fddb7b06c (diff) | |
decodeMouseEvent: admit buttons 8 to 11
Terminals report buttons 8 to 11 (often back and forward) with bit 128 of
the button byte set. decodeMouseEvent ignored that bit and reported them
as buttons 1 to 3 and as an X10 release.
The case analysis is now total, so the error for unknown buttons is gone;
it could not be reached anyway.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Scanner.hs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/Scanner.hs b/src/Scanner.hs index 993793c..24546be 100644 --- a/src/Scanner.hs +++ b/src/Scanner.hs @@ -164,16 +164,12 @@ hWaitLookAhead t h = do decodeMouseEvent :: Int -> Int -> Int -> Bool -> Scan decodeMouseEvent b x y pressed = let - button = case (b .&. 3) + (b .&. 64) of - 0 -> 1 - 1 -> 2 - 2 -> 3 - 64 -> 4 -- wheel up - 65 -> 5 -- wheel down - 66 -> 6 -- wheel left - 67 -> 7 -- wheel right - 3 -> 0 -- X10 release - btn -> error $ "TODO proper parseNormalButton error: " ++ show btn + button = case (b .&. 192, b .&. 3) of + (0, 3) -> 0 -- X10 release + (0, n) -> n + 1 -- buttons 1 to 3 + (64, n) -> n + 4 -- wheel up, down, left, right + (128, n) -> n + 8 -- buttons 8 to 11 + (_, n) -> n + 12 -- unassigned in ScanMouse { mouseButton = button |
