-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
CoreMouseService #2323
CoreMouseService #2323
Conversation
- use onProtocolChange - remove mouse states from Terminal.ts - remove selectionService from InputHandler - fix up events in VT200 mode - fix move event with no buttons in ANY mode
Just tested, works fine and I haven't been able to break it. I like the way you are approaching the protocol / encoding thingy. Should we expose the |
@mofux Hmm I see two possible use cases here:
Maybe you have other use cases in mind that would justify adding mouse primitives to the public API, for those two above I dont see enough value currently. |
Not sure yet how to deal with some of the default actions:
Especially escaping mouse actions with some modifier to get the default actions back is tricky to get done right - currently the selection manager does that with Shift to get selection back. Imho the Alt modifier is meant to enable column selection (does not work for me since xfce binds window movement to it). Imho those escape modifiers need some attention/rework as well. @Tyriar Thats the reason why I think we might need an event listener service, that does the juggling/routing of the events correctly. Currently it is hard to track the correct "listener states" since they are scattered over several places in |
I'm not sure if the mouse move code on OS X will lead to mouse move events without correct button code, as that code seems have to workaround restrictions in the event interface. |
@textshell ❤️ Wow many thx for sharing your knowledge about emulators and interaction, much appreciated! Answered as good as I can, gonna have to review the button section again (for the wheel stuff and more than 3 buttons).
Yes its stated in the JS API that it cannot report buttons pressed during move due to an OS restriction. The browsers have implemented own shims around that according to MDN and are likely to report the last one pressed. I have implemented a workaround to take that into account, still this needs serious testing under OSX with different browsers. |
Thanks. I've spend a lot of time staring at code of terminal implementations and we really need to share our knowledge in this space. Also i fundamentally believe it's best if terminals behave the same except if there is a good reason to differ. Feel free to mention me when it's unclear what terminal sequences do exactly in other terminals. Although i have not yet covered enough terminals i try to document what i learn over at https://terminalguide.netlify.com/. For newly invented sequences of terminals i've not yet covered i try to at least have a short note pointing to external resources, so it would be nice to know when xterm.js invents new sequences as well (via mention or issue/pr in terminalguide's github repository). But of course new sequences are also a topic for terminal-wg. |
@textshell I don't think this would ever happen outside of a proposal on terminal-wg |
Sure thing, we still have to catch up at several edges. (Just started to cleanup many of the partly faulty implemented VT commands.)
As @Tyriar already pointed out, we are not much interested in doing fancy private stuff on our own, still we leave the window open for integrators to do so (via customizable OSC and CSI entries, DCS and ESC yet to come #2332). |
@textshell Added AUX button support to the core libs, but had to leave out support for those in the frontend part, since I cannot get reliable values from other terminals. Tested with a 5 button mouse, seems all emulators I have dont agree here on what to send:
Thats to much of cutting edge for me atm, thus I limit the button support to 3 buttons + wheel for now, which seems to be somewhat uniform across the emulators. Also added wheelLeft and wheelRight support, if you have a mouse capable to do this, maybe you can test it? Otherwise I gonna disable this as well for now. |
Tested mouse move with several buttons pressed under Mojave in Safari - works and reports the same button as under Linux (lowest button). |
Yes that was fixed later.
That's odd. I get My debian inspired compile options are
I don't have a mouse with left/right scrolling handy and my usual remapping tricks don't seem to work in firefox. So i can't test this. |
@jerch My use-case for making |
@textshell Thx, your compile settings work for me too. Had DEC locator on before, maybe those dont work in combination, did not investigate. Now I can test at least button 4 and 5. @mofux I am not against adding some mouse stuff to the API. Still my primary goal for this PR is to get the core stuff working as close as possible to the standard and to fix the most obvious errors. Maybe we could discuss that in a separate issue/PR? Same with the escape rules for the standard actions. Created new issues for that:
|
@textshell Successfully tested button 4 and 5 thanks to your compile string. Also left/right wheel works (just replaced up/down with those to see if it gets reported correctly, so direction might be wrong). Still I deactivated support for both for these reasons:
I think we are on the safe side with the current 3 button + wheel restriction. It also shares the best conformance to other emulators. Somewhat offtopic: Once again, up for review. |
I'm not an expert on these things, but the randomly googled mouse event test page does not have any trouble handling them in chromium. I just tested in firefox and there it does not capture those events. So that seems to be browser dependent.
If someone cares enough there will be someone to test this with real hardware.
The 3 buttons, wheel up and down plus a hopefully correct but disabled implementation for the rest should be pretty safe, yes.
Yes, i have some mouse wishes as well. But they are more in the direction of coexistance of the terminal functions users expect and having some kind of mouse support in the application at the same time. But that's for another time and for terminal-wg indeed.
No problem. |
@textshell Thx again for helping getting this done 👍 |
Merged in the mouse integration tests. Couple of changes applied:
Left to do:
I think I gonna skip UTF8 and URXVT tests for now to lower the runtime of the mouse tests. They are likely to be removed anyway (#2334). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't do much testing in this area but tmux mouse mode to move panes seems to work. LGTM 👍
Part one of the mouse rewrite. This PR introduces a
CoreMouseService
which deals with the following:The service already simplifies alot of the code mess in
Terminal.ts
. The remaining mouse related parts mostly deal with event handler registration/dispatching on the DOM, which can be moved into the browser mouse service in a second PR.Up for review.