Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mouse support #57

Open
okbob opened this issue Jan 1, 2019 · 19 comments
Open

mouse support #57

okbob opened this issue Jan 1, 2019 · 19 comments

Comments

@okbob
Copy link

okbob commented Jan 1, 2019

can be great if libvterm supports mouse

@TragicWarrior
Copy link
Owner

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

@okbob
Copy link
Author

okbob commented Jan 1, 2019

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
Copy link
Owner

@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
Copy link
Author

okbob commented Jul 12, 2019

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
Copy link
Owner

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

@TragicWarrior
Copy link
Owner

TragicWarrior commented Jul 12, 2019

@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
Copy link
Author

okbob commented Jul 13, 2019 via email

@TragicWarrior
Copy link
Owner

@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
Copy link
Author

okbob commented Jul 18, 2019

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
Copy link
Owner

@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
Copy link
Author

okbob commented Jul 18, 2019

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
Copy link
Owner

@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
Copy link
Author

okbob commented Jul 18, 2019

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
Copy link
Owner

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

I'll have to figure something out.

@TragicWarrior
Copy link
Owner

@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
Copy link
Owner

@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
Copy link
Author

okbob commented Jul 26, 2019

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

@TragicWarrior
Copy link
Owner

@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
Copy link
Author

okbob commented Jul 26, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants