Skip to content

Design: mouse support compatibility

Alexandre Bury edited this page Oct 9, 2017 · 1 revision

The way Cursive will model mouse events depends on the way the various backends handle it:

Termion

Termion can return a MouseEvent which can be Press, Release or Hold, each time with the mouse position as (u16, u16). Only the Press event indicates the button itself, but we can easily remember the last button pressed when sending Release events. Currently no modifiers support apparently (CTRL/ALT/SHIFT).

Ncurses

ncurses can detect when a mouse button is clicked (quickly pressed + released), double-clicked, or triple-clicked, for 5 mouse buttons. Looks like it can detect modifiers, but I haven't tested that yet. I suppose pancurses does the same.

BLT

BearLibTerminal can apparently detect Mouse move, scroll (wheel movement, with a i32), as well as Press/Release events of 5 buttons. It also supports ctrl/shift modifiers, as it does for every other keys. Press/Release events don't include the position, so we'll need to save it from the last MouseMove event.