-
-
Notifications
You must be signed in to change notification settings - Fork 781
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
Request: mouse mode 1016 (SGR-Pixels) #1457
Comments
I'd like to see this also.
The DECRQM bits you'd need could be cribbed from similar code: Would you like to take a crack at a PR for this? |
I just might, if you haven't gotten to it in the next couple weeks. :-) I just got it running on my Swing backend, and oooooohhhhh: https://jexer.sourceforge.io/screenshots/cute_mouse.gif EDIT: ...aaand now for the Xterm backend too: https://gitlab.com/klamonte/jexer/-/raw/master/screenshots/xterm_pixel_mouse.gif?raw=true ;-) |
Very cool! |
Multiplexer would error out when mousing over the window! refs: #1457
nice! @klamonte leads the way once again |
@dankamongmen From your comments in dankamongmen/notcurses#2326, I might have implemented it differently/incorrectly here. Internally for wezterm I put in pixelmouse as an offset_x/offset_y which is recomputed back to a pixel position for 1016 mouse reports. Here is why I did it that way (though it took me a few days to figure it out): #1467 (comment) -- which is also how jexer does it. It will work fine for x/y >= 0, but not for negative which I did not know that xterm does. (Honestly I didn't expect negative numbers to be in CSI parameters anyway. I've got to fix my keyboard/mouse parser now.) The good news is that 1006 mode is still reported as >= 1 even when the mouse is grabbed by xterm. @wez Around here
|
Gaaa which might mean another codec version change. Alternative: keep the offset, but set to 0 if actual pixel position is negative. So it would be perhaps incomplete compared to xterm, but not seriously different. |
relative to xterm, you mean? xterm and mlterm seem to be using completely different methods, but wezterm seems to be similar to mlterm. is that expected? note that i'm not yet too sure of these results, so take them with a grain of salt. |
Yup, I meant different from xterm. |
so were you consciously emulating MLterm with your protocol (which i dig)? or are the two only superficially similar? |
i very much hope we don't have three protocols all calling themselves 1016 out there |
No, it was a mistake on my part. We should match xterm since this feature originated there. |
Don't sweat it: if we need to change it, we need to change it :) @klamonte I'm not sure I'm following re: negative numbers. The section of code you highlighted clamps to |
@wez (Pssst: --> https://www.youtube.com/watch?v=WElNELJedug ;-) This is with sixel, it goes even prettier/smoother with iTerm2.) So it seems that we may be A-OK here, and xterm might be buggy. According to @j4james over here CSI parameters are not supposed to be negative. |
I think you're saying that wezterm's sixel implementation needs work? :-) |
More like my encoder should get faster, and better. :-) BTW @dankamongmen has been doing some serious cooking, his new sixel encoder is smokin' hot. |
I know @dankamongmen has said that wezterm's sixel implementaiton needs work :-p |
fwiw, i have not been testing wezterm's sixel implementation since it went to supporting kitty by default, as i much prefer that protocol (both in spirit and in code). afaik, the problems seen in #1270 are still present, but i haven't checked in at least a month. |
nvm, #1270 is long-fixed. i might have another one open? i might not. |
@wez I am seeing 1006 mode reporting for every pixel motion, rather than only motion that crosses a full text cell. Is that something that I broke in the PR? |
Ah, probably! There was some logic somewhere in the event path that would avoid sending the event if the cell coordinates didn't change. What is probably best to do is centralize that in the terminal state (eg: store optional last mouse movement coordinates), then use that to avoid sending a duplicate of the last move event based on the granularity of the reporting mode. We'd want to clear that state when the reporting mode changes and on soft reset. |
So you already have last_mouse_move in terminalstate, and I think it has what we need. I'm adding checks in terminalstate/mouse.rs referencing it and running into this. So my dumb I-don't-know-Rust question:
How do I get at self.last_mouse_move? |
It depends on what you want to do if there was no previous value.
matchwezterm/term/src/terminalstate/mouse.rs Lines 192 to 197 in 91f8a34
uses the
|
@wez Thank you for the pointer, I think this fixes it. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Is your feature request related to a problem? Please describe.
I would like to support pixel-based mouse position in my application.
Describe the solution you'd like
I would like SGR-Pixels (mouse mode 1016) to be supported. The difference between this and 1006 mode which is already supported are:
Describe alternatives you've considered
Two methods to do this are DEC Locator Input (DECLRP) which according to that doc is only supported for REGIS and Tektronix and SGR-Pixels which is supported by xterm and works in normal cases.
Additional context
Other applications desire this too, example: dankamongmen/notcurses#2326
Other features use DECRQM/DECRPM: https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036#feature-detection
I just checked xterm via:
...and verified that click-drag outside the windows does continue to produce mouse events, i.e. xterm continues reporting for the entire mouse grab.
The text was updated successfully, but these errors were encountered: