TERMKEY_INTERPRET_MOUSE(3)
π TERMKEY_INTERPRET_MOUSE(3) π
okay bestie, welcome to the Library Functions Manual page for termkey_interpret_mouse, a genuine little icon of the termkey library. she's here to decode the mouse gossip your terminal is handing you πβ¨
β¨ NAME β¨
termkey_interpret_mouse β interpret opaque mouse event data
πΈ SYNOPSIS πΈ
#include <termkey.h>
TermKeyResult termkey_interpret_mouse(TermKey *tk, const TermKeyKey *key,
TermKeyMouseEvent *ev, int *button, int *line, int *col);
and don't forget to link with -ltermkey, no cap π
π¦ DESCRIPTION π¦
so termkey_interpret_mouse() takes the mouse event chillin' inside key and fills in the variables behind all those pointers you passed in. it's giving "translator bestie" fr fr.
you should call this one whentermkey_getkey(3)(or one of her little friends) hands you back a key event whose type isTERMKEY_TYPE_MOUSE. that's the vibe check β if it's not that type, this function is not the main character here.
also, any of those pointers can just be NULL if you don't want that particular value back. lowkey generous of her π«Ά
the ev variable is gonna end up being one of these:
TERMKEY_MOUSE_UNKNOWNβ an unknown mouse event. mystery behavior, we don't know her πTERMKEY_MOUSE_PRESSβ a mouse button was pressed, andbuttonwill contain its number πTERMKEY_MOUSE_DRAGβ the mouse was moved while holding a button down, andbuttonwill contain its number π¦TERMKEY_MOUSE_RELEASEβ a mouse button was released, or the mouse was moved while no button was pressed. if it's known,buttonwill contain the number of the button that got released. but heads up: not all terminals can report this, so it may just be0instead. it's not her fault, the terminal simply didn't tell her π
and the line and col variables get filled in with the mouse position, indexed from 1 (yes, from one, we're not doing zero-indexed chaos here).
real talk though β because the TermKeyKey structure only has a limited number of bytes, the line and column numbers are capped at 2047 and 4095 respectively. so if your cursor is out here living its best life at column 9000... she can't see it. that's the limit, periodt.
π RETURN VALUE π
if you pass her a key event of the type TERMKEY_TYPE_MOUSE, this function returns TERMKEY_RES_KEY and does exactly the thing described above to all the variables whose pointers you handed over. slay β¨
for any other event types, she returns TERMKEY_RES_NONE, and what happens to those variables of yours... is undefined. not "probably fine", not "she'll try her best" β undefined. so please, only call her for mouse events, bestie, i'm begging π
π SEE ALSO π
and that's the whole page, you ate it up π this was TERMKEY_INTERPRET_MOUSE(3) from the Library Functions Manual, and yeah, the same title shows up again at the bottom of the original β that's just how man pages do, iconic behavior honestly. go forth and interpret those mice, bestie πππ
π¦ where this page comes from
- alpine 3.24: libtermkey-doc 0.22-r4 Β· MIT
- debian trixie: libtermkey-dev 0.22-2+b1 Β· MIT
- epel 10: libtermkey-devel 0.22-2.el10_0 Β· MIT
- epel 9: libtermkey-devel 0.22-2.el9 Β· MIT
- fedora 43: libtermkey-devel 0.22-11.fc43 Β· MIT
- fedora 43: libtermkey-devel 0.22-11.fc43 Β· MIT
- fedora 44: libtermkey-devel 0.22-12.fc44 Β· MIT
- fedora 44: libtermkey-devel 0.22-12.fc44 Β· MIT
- nixos 26.05: libtermkey 0.22
- nixpkgs unstable: libtermkey 0.22
- opensuse-leap 16.0: libtermkey-devel 0.22-bp160.1.11 Β· MIT
- opensuse-leap 16.0: libtermkey-devel 0.22-bp160.1.11 Β· MIT
- opensuse-leap 16.0: libtermkey-devel 0.22-bp160.1.11 Β· MIT
- opensuse-leap 16.0: libtermkey-devel 0.22-bp160.1.11 Β· MIT
- ubuntu questing: libtermkey-dev 0.22-2
- ubuntu resolute: libtermkey-dev 0.22-2build1 Β· MIT
- ubuntu stonking: libtermkey-dev 0.22-3 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms