TragicWarrior / libvterm

Based on libROTE, libvterm is a color terminal emulator. It mimics vt100, rxvt, xterm, and xterm 256 color mode
Other
35 stars 6 forks source link

mouse support #57

Open okbob opened 5 years ago

okbob commented 5 years ago

can be great if libvterm supports mouse

TragicWarrior commented 5 years ago

@okbob , can you describe what you have in mind here?

okbob commented 5 years ago

Your library doesn't handle mouse events and then these events are not propagated to nested window. pspg has mouse support - uses getmouse() and mousemask functions. you can run pspg in gnome-terminal - and you can see - it can process a mouse click, double clicks events. But from vshell, these events are lost on vshell level.

TragicWarrior commented 5 years ago

@okbob , ya. i've given some thought to this before. it's not as straightforward as it sounds. i'll revisit it in though again and see if a clever means comes to mine.

okbob commented 5 years ago

I tested last commit and it is working very well - some combo like ALT - mouse click doesn't work, but it is not too important

TragicWarrior commented 5 years ago

That is correct. I haven't added code for modifier keys like ALT yet.

TragicWarrior commented 5 years ago

@okbob , there is a branch now called mouse-modifiers which should cause CTRL, SHIFT, and ALT to be handled now. I don't have anything to test this with. I can only say that I appear to have not broken anything. Also, the Xterm CSI manual says this about those keys and the mouse:

Note however that the shift and control bits are normally unavailable because
xterm uses the control modifier with mouse for popup menus, and the shift
modifier is used in the default transla-tions for button events.

If you have a way of testing, please let me know... and let me know what you used for my own benefit :)

okbob commented 5 years ago

pá 12. 7. 2019 v 22:56 odesílatel TragicWarrior notifications@github.com napsal:

@okbob https://github.com/okbob , there is a branch now called mouse-modifiers which should cause CTRL, SHIFT, and ALT to be handled now. I don't have anything to test this with. I can only say that I appear to have not broken anything. Also, the Xterm CSI manual says this about those keys and the mouse:

Note however that the shift and control bits are normally unavailable because xterm uses the control modifier with mouse for popup menus, and the shift modifier is used in the default transla-tions for button events.

If you have a way of testing, please let me know... and let me know what you used for my own benefit :)

pspg should to support ALT click and ALT mouse wheel.

I tested it, and it doesn't work

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TragicWarrior/libvterm/issues/57?email_source=notifications&email_token=AAEFO4YGVYM2ZMZANP6QXUDP7DVWVA5CNFSM4GMXGOKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ23KXA#issuecomment-511030620, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEFO45TQKEPWYATWETPWPTP7DVWVANCNFSM4GMXGOKA .

TragicWarrior commented 5 years ago

@okbob , does pspg utilize the ALT keys. if so, what is it used in combination with and what should i expect to happen when used?

okbob commented 5 years ago

pspg uses lot of ALT keys - and few with mouse (I tested vshell and without mouse ALT keys works).

Because I had a bad experience with ncurses double click implementation, I have own implementation of double click. Two mouse click with ALT should to mark row as bookmark (like ALT double click). It detect ALT (27 code) and two BUTTON1_RELEASE (time should be less than 250ms).

TragicWarrior commented 5 years ago

@okbob , thanks. fwiw, you're not alone. i think most seasoned users of ncurses prefer to interpret the raw button clicks on their own because of the side-effects caused by ncurses construction of click events.

okbob commented 5 years ago

I was wrong - ALT is processed by ncurses - mouse is initialized with BUTTON_ALT and I test this mask in bstate (taken by getmouse function).

ncurses double click implementation is too simple, probably is not possible to write better but simple generic solution. When you enable double click detection by ncurses, then any mouse reaction will be visibly slow. I use ncurses mouse support because is very portable, but long time I spent with searching some usable patterns.

TragicWarrior commented 5 years ago

@okbob , ALT + double click is intercepted by Xfce window manager which I use in all of my development environments. is there any other combination I can test with?

okbob commented 5 years ago

ALT and mouse wheel, -- it is like cursor left, cursor right - but it doesn't work on new ncurses - what I know, ncurses supports ALT - BUTTON1 only now.

TragicWarrior commented 5 years ago

ALT + wheel mouse is also intercepted by Xfce by default. :/

I'll have to figure something out.

TragicWarrior commented 5 years ago

@okbob , here's what i've found (at least on Ubuntu 18.04). The only mod buttons that seem to reliably come across in X10 mode are CTRL + BUTTON(x) and ditto for SGR mode except that it seems ALT + BUTTON 2 comes across. I'm about to test on Fedora. Ubuntu 18.04 uses mouse API version 1 which is more limited.

TragicWarrior commented 5 years ago

@okbob , I tested on Fedora 30 and what I see there is very similar. getmouse() is returning CTRL + BUTTON(x) but no other combinations.

okbob commented 5 years ago

ALT-BUTTON1 is working with pspg on Fedora30 in gnome terminal.

TragicWarrior commented 5 years ago

@okbob , perhaps the buttons simply aren't getting passed in by virtualbox. could you try the branch called "mouse-mod-test". basically, when ctrl, shift, or alt is detected with a button click, vshell should terminate. if alt-button(x) is working for you then i'll just consider it a problem with my env and continue coding the rest of the support.

okbob commented 5 years ago

I tested xterm, gnome-terminal, rxvt and nothing is worked.