Read Low Level Mouse Click Unix passed through PuTTY

785 views Asked by At

I use PuTTY to connect to a shell (Unix Server). I can use the mouse to select Text from the CLI. Also, vim can also interact with the mouse, so I know that PuTTY does send mouse input to the server.

My problem is that I want to capture the mouse events in a C++ TUI , much like vim does (just, I will be handling them differently). I have gone through many sites, but none of them describes my problem precisely. I have a feeling that I will need xterm, but I don't know how to use it!

The best links that I found are :

How to read low level mouse click position in linux .

Weird insertion from Vim on mouse click --> How do I read this event?

A blessed UI for Jitsu --> Hats off to this guy!

Can anyone provide a sample code to read the mouse location? I can code the rest of the application then :)

1

There are 1 answers

0
Mats Petersson On BEST ANSWER

It should work just fine to do this using the mouse-interface in ncurses (I'm sure that vim and other applications has no specific knowledge about how SSH/PuTTY communicates, it just picks up the mouse position as it would if it was a local connection - the sshd sorts out all the magic with translating network packets to keypresses and mouse-moves).

Here is a description of how you interface with a mouse in ncurses.