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

wpf: add support for VT mouse mode #5375

Merged
4 commits merged into from
Apr 17, 2020
Merged

wpf: add support for VT mouse mode #5375

4 commits merged into from
Apr 17, 2020

Conversation

DHowett-MSFT
Copy link
Contributor

Summary of the Pull Request

This pull request ports the VT mouse code from TermControl to WpfTerminalControl. Our WPF control is a lot closer to Win32 than to Xaml, so our mouse event handler looks nothing like the one that we got from Xaml. We can pass events through almost directly, because the window message handling in the mouse input code actually came from conhost. It's awesome.

Neither TermControl nor conhost pass hover events through when the control isn't focused, so I wired up focus events to make sure we acted the same.

Just like Terminal and conhost, mouse events are suppressed when Shift is held.

Validation Steps Performed

Tested with MC, and tested by manually engaging SGR events in an Echo terminal.

image

@DHowett-MSFT DHowett-MSFT requested a review from ZoeyR April 16, 2020 05:27
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.

neat

@zadjii-msft zadjii-msft added Area-Input Related to input processing (key presses, mouse, etc.) Area-WPFControl Things related to the WPF version of the TermControl labels Apr 16, 2020
@WSLUser
Copy link
Contributor

WSLUser commented Apr 16, 2020

our mouse event handler looks nothing like the one that we got from Xaml

We can add XAML controls here for it if you really wanted to. https://docs.microsoft.com/en-us/windows/apps/desktop/modernize/xaml-islands#wpf-and-windows-forms-applications

At some point, we probably should start hosting XAML in WPF.

@DHowett-MSFT
Copy link
Contributor Author

DHowett-MSFT commented Apr 16, 2020

@WSLUser yep, it’s a good idea! Right now our main consumer for the WPF control is Visual Studio, who can’t use the Islands or WinRT activation machinery UWP XAML requires on all the versions of the OS they run on (like, Windows 7 through 10.0.17763).

Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

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

Approving, contingent on @ZoeyR's approval.

@@ -27,6 +35,14 @@ LRESULT CALLBACK HwndTerminal::HwndTerminalWndProc(

if (terminal)
{
if (_IsMouseMessage(uMsg) && terminal->_CanSendVTMouseInput())
Copy link
Contributor

Choose a reason for hiding this comment

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

I really wish we could use _IsMouseMessage in the case statements, I don't like this being separate. But I also wouldn't want to see that large list of message types in the switch 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't like this being separate

I agree totally with all these points. Conhost has them all as case labels, and it's monstrous. I may come through afterwards and refactor this code for flow/order, so we shall get a chance to revisit 😄

@DHowett-MSFT DHowett-MSFT added the AutoMerge Marked for automatic merge by the bot when requirements are met label Apr 17, 2020
@ghost
Copy link

ghost commented Apr 17, 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.

@ghost ghost merged commit f04b7aa into master Apr 17, 2020
@ghost ghost deleted the dev/duhowett/wpf/vt_mouse branch April 17, 2020 02:05
@ghost
Copy link

ghost commented Apr 22, 2020

🎉Windows Terminal Preview v0.11.1121.0 has been released which incorporates this pull request.:tada:

Handy links:

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.) Area-WPFControl Things related to the WPF version of the TermControl AutoMerge Marked for automatic merge by the bot when requirements are met
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants