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

Move MouseInput from TermAdapter to TermInput #4848

Merged
7 commits merged into from
Mar 12, 2020
Merged

Conversation

carlos-zamora
Copy link
Member

@carlos-zamora carlos-zamora commented Mar 9, 2020

Summary of the Pull Request

Move the contents and functionality of MouseInput from TerminalAdapter
to TerminalInput.

References

#545 - VT Mouse Mode (Terminal)
#376 - VT Mouse Mode (ConPty)

Detailed Description of the Pull Request / Additional comments

Pretty straightforward. The MouseInput class was a bit large though so I
split it up into a few files. This should make TerminalInput a bit
easier to manage.

  • mouseInputState: enable some of the modes for mouse input. All saved
    to _mouseInputState.
  • mouseInput: basically just HandleMouse() and any helper functions

Validation Steps Performed

Tests should still pass.

@carlos-zamora carlos-zamora added the Area-Input Related to input processing (key presses, mouse, etc.) label Mar 9, 2020
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I'm okay with this, but I'm curious why you decided to merge the classes into one rather than leave MouseInput encapsulated

src/terminal/input/terminalInput.hpp Show resolved Hide resolved
src/terminal/input/mouseInput.cpp Show resolved Hide resolved
@zadjii-msft zadjii-msft added Needs-Second It's a PR that needs another sign-off Product-Meta The product is the management of the products. labels Mar 10, 2020
@ghost ghost requested review from miniksa and leonMSFT March 10, 2020 12:55
@DHowett-MSFT
Copy link
Contributor

I was wondering about the merging too. I dunno; did we set a bad precedent with TerminalCore? 😄

@DHowett-MSFT
Copy link
Contributor

At the same time, if you don't dislike it too much (@zadjii-msft), i guess it consolidates "things about generating VT input" into a single place!

src/host/server.h Outdated Show resolved Hide resolved
@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Mar 10, 2020
@zadjii-msft
Copy link
Member

I didn't hate it enough to block it 😋

@carlos-zamora
Copy link
Member Author

I was wondering about the merging too. I dunno; did we set a bad precedent with TerminalCore? 😄

That's exactly what I was looking at... uh oh. But the nice thing now is that all kind of input is consistently in TerminalInput, rather than a random MouseInput object off on the side.

That said, I'll just redirect all calls to terminalMouseInput to go through the input buffer instead. I feel like that's cleaner but both of y'all know the code better so let me know if I'm going down the wrong path here.

@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Mar 10, 2020
src/host/server.h Outdated Show resolved Hide resolved
@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Mar 10, 2020
@DHowett-MSFT DHowett-MSFT added the AutoMerge Marked for automatic merge by the bot when requirements are met label Mar 10, 2020
@ghost
Copy link

ghost commented Mar 10, 2020

Hello @DHowett-MSFT!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@DHowett-MSFT DHowett-MSFT removed the AutoMerge Marked for automatic merge by the bot when requirements are met label Mar 10, 2020
Copy link
Contributor

@DHowett-MSFT DHowett-MSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broke mouse mode in conhost

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Mar 10, 2020
@carlos-zamora
Copy link
Member Author

@DHowett-MSFT and I investigation findings:

  • the input sequences are getting added to the input queue but they just stay there
  • The removed callback would call WakeUpReadersWaitingForData(), whereas the new callback _HandleTerminalInputCallback() does not.

Looks like we need to make the input buffer wake up the reader if it's still asleep. I'll work on a proper fix for this tomorrow morning.

@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Mar 11, 2020
@DHowett-MSFT
Copy link
Contributor

@msftbot make sure @miniksa signs off

@ghost ghost added the AutoMerge Marked for automatic merge by the bot when requirements are met label Mar 11, 2020
@ghost
Copy link

ghost commented Mar 11, 2020

Hello @DHowett-MSFT!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I'll only merge this pull request if it's approved by @miniksa

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@DHowett-MSFT DHowett-MSFT removed the AutoMerge Marked for automatic merge by the bot when requirements are met label Mar 11, 2020
@carlos-zamora
Copy link
Member Author

Verified that #4859 still works with the newest change.

Copy link
Contributor

@DHowett-MSFT DHowett-MSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't care that this variable is called _vtInputShouldSuppress. We need a followup Area-CodeHealth + Area-Input workitem to clean up whose responsibility it is to notify connected clients in conhost.

@DHowett-MSFT
Copy link
Contributor

@msftbot forget everything i just told you

@DHowett-MSFT DHowett-MSFT added the AutoMerge Marked for automatic merge by the bot when requirements are met label Mar 12, 2020
@ghost ghost merged commit 23f7420 into master Mar 12, 2020
@ghost ghost deleted the dev/cazamor/vtmm/mouse-input branch March 12, 2020 22:25
DHowett-MSFT pushed a commit that referenced this pull request Mar 13, 2020
## Summary of the Pull Request
Make TerminalControl synthesize mouse events and Terminal send them to
the TerminalInput's MouseInput module.

The implementation here takes significant inspiration from how we handle
KeyEvents.

## References
Closes #545 - VT Mouse Mode (Terminal)
References #376 - VT Mouse Mode (ConPty)

### TerminalControl
- `_TrySendMouseEvent` attempts to send a mouse event via TermInput.
  Similar to `_TrySendKeyEvent`
- Use the above function to try and send the mouse event _before_
  deciding to modify the selection

### TerminalApi
- Hookup (re)setting the various modes to handle VT Input
- Terminal is _always_ in VT Input mode (important for #4856)

### TerminalDispatch
- Hookup (re)setting the various modes to handle VT Input

### TerminalInput
- Convert the mouse input position from viewport position to buffer
  position
- Then send it over to the MouseInput in TerminalInput to actually do it
  (#4848)

## Validation Steps Performed
Tests should still pass.
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Input Related to input processing (key presses, mouse, etc.) AutoMerge Marked for automatic merge by the bot when requirements are met Needs-Second It's a PR that needs another sign-off Product-Meta The product is the management of the products.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants