The gpm (general purpose mouse) daemon tries to be a useful mouse
server for applications running on the Linux console. Its roots are
in the "selection" package, by Andrew Haylett, and the original code
comes from selection itself. This package is intended as a replacement
for "selection", to provide additional facilities. From 0.18 onward
gpm supports xterm as well, so you can run mouse-sensitive
applications under X, and you can easily write curses applications
which support the mouse on both the Linux console and xterm. The xterm
code is portable to any U*x flavour (look at sample/README).