telmich / gpm

general purpose mouse
http://www.nico.schottelius.org/software/gpm/
GNU General Public License v2.0
84 stars 28 forks source link

add support to report a mouse events via stdin with esc-sequences: #4

Open seyko2 opened 9 years ago

seyko2 commented 9 years ago

an xterm-like mouse reporting. A bugs reports to seyko2@gmail.com

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

telmich commented 9 years ago

Maybe a nice idea, but what about the documentation?

seyko2 commented 9 years ago

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 notifications@github.com:

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

seyko2 commented 8 years ago

What the resolution about this pull request?

telmich commented 8 years ago

How is anyone going to use this without being mentioned in the docs?

seyko2 commented 8 years ago

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?

egmontkob commented 5 years ago

Please see #29 for a broader picture!