gpm
gpm copied to clipboard
add support to report a mouse events via stdin with esc-sequences:
an xterm-like mouse reporting. A bugs reports to [email protected]
getc() { stty raw dd bs=1 count=1 2>/dev/null stty cooked }
handle_mouse()
{
local c
c="getc
"
[ "$c" = "[" ] || return
c="getc
"
[ "$c" = "M" ] || return
b="getc
"
x="getc
"
y="getc
"
b=printf "%u" "'$b"
x=printf "%u" "'$x"
y=printf "%u" "'$y"
b=$(($b - 32))
x=$(($x - 32))
y=$(($y - 32))
echo "$b $x $y"
}
stty -echo
printf '\033[?1000h'
ESC="printf '\033'
"
while true ; do
c="getc
"
if [ "$c" = "$ESC" ] ; then
handle_mouse
fi
if [ "$c" = "q" ] ; then
break
fi
done
printf '\033[?1000l'
stty echo
echo
Maybe a nice idea, but what about the documentation?
What documentation is needed? Patch for gpm is developed to allow use a mouse control in a turbo vision programs with pseudo terminal as stdin/stdout. This feature can be tested with tmux or mc too. gpm sends some mouse events using a TIOCLLINUX syscall to a program in the current console which enabled a xterm-like mouse reporting (via esc-sequence \033[?1000h)
linux kernel has a TIOCL_SELMOUSEREPORT (TIOCLINUX) support since a version 2.2. But even current version of gpm don't support this. https://googledrive.com/host/0B35PjbLHNzyqNS13R0M1aEctND is an archive (with a real name gpm-xterm.tar.xz) on my google drive with a patch for a current version of gpm to support a mouse position reporting. Archive contain a patch, a test script, a binary of modified gpm and a test program atvedit (an editor from a turbo vision). Start it from a Midnigth commander (or a telnet session) to test a mouse reporting. atvedit don't start from a bash prompt if gpm is running.
2014-11-17 15:09 GMT+04:00, Nico Schottelius [email protected]:
Maybe a nice idea, but what about the documentation?
Reply to this email directly or view it on GitHub: https://github.com/telmich/gpm/pull/4#issuecomment-63289853
What the resolution about this pull request?
How is anyone going to use this without being mentioned in the docs?
How is anyone going to use this without being mentioned in the docs?
"gpm supports now x-term like mouse reporting events on Linux console" in changelog and somewhere in the docs?
Please see #29 for a broader picture!