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

Use WinRT VirtualKeyModifiers instead of a custom enum #10603

Merged
4 commits merged into from
Jul 12, 2021

Conversation

mimvdb
Copy link
Contributor

@mimvdb mimvdb commented Jul 9, 2021

Replaces KeyModifiers with the pretty much equivalent
VirtualKeyModifiers enum in winrt.

After doing this I noticed #10593 which changes the KeyChords a lot, but
it seems these PRs are still compatible

The issue also mentions replacing Vkey with
Windows::System::VirtualKey, but I chose not to because that enum only
includes a subset of the keys terminal supports here (no VK_OEM_* keys)

Validation Steps Performed

Changed key bind in config, and confirmed it still works after
restarting terminal

Closes #877

@ghost ghost added Area-CodeHealth Issues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. labels Jul 9, 2021
Copy link
Member

@lhecker lhecker left a comment

Choose a reason for hiding this comment

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

This PR removes the need for ConvertVKModifiers. Nice. 👍
If you want to you could write

using VirtualKeyModifiers = winrt::Windows::System::VirtualKeyModifiers;

here and there, to shorten the code lines, but I'm fine with merging as it is.

@DHowett
Copy link
Member

DHowett commented Jul 10, 2021

So, our initial design for the terminal settings model was intended to avoid a dependency on the Windows.UI namespace-- it is a big namespace that we may not want consumers to depend on.

@zadjii-msft and @carlos-zamora may have opinions.

@DHowett
Copy link
Member

DHowett commented Jul 10, 2021

(At the same time, thanks for the contribution! It's good to have you here :))

@lhecker
Copy link
Member

lhecker commented Jul 10, 2021

@DHowett Isn't VirtualKeyModifiers part of the Windows.System namespace?

@mimvdb
Copy link
Contributor Author

mimvdb commented Jul 10, 2021

Windows.UI is used in several places in the terminal settings model. For example, in ActionArgs Windows::UI::Color for TabColor. The Windows.System namespace does seem te be new, although winrt/Windows.System.h is included in the pch.

@DHowett
Copy link
Member

DHowett commented Jul 12, 2021

Windows.UI is used in several places in the terminal settings model. For example, in ActionArgs Windows::UI::Color for TabColor. The Windows.System namespace does seem te be new, although winrt/Windows.System.h is included in the pch.

@DHowett Dustin Howett FTE Isn't VirtualKeyModifiers part of the Windows.System namespace?

Shows what I get for triaging pull requests on my phone and not reading their bodies. Thanks all! This looks fine to me, but I'd prefer @zadjii-msft sign off.


@msftbot make sure @zadjii-msft signs off

@DHowett
Copy link
Member

DHowett commented Jul 12, 2021

@msftbot make sure @zadjii-msft signs off

@ghost ghost added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jul 12, 2021
@ghost
Copy link

ghost commented Jul 12, 2021

Hello @DHowett!

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 @zadjii-msft

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".

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.

Just a minor suggestion.

I'll probably run into a few conflicts on my end with adding a key chord listener to the actions page in SUI, but that's my problem, not yours haha.

src/cascadia/TerminalApp/TerminalPage.cpp Outdated Show resolved Hide resolved
Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com>
@ghost ghost removed the AutoMerge Marked for automatic merge by the bot when requirements are met label Jul 12, 2021
@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jul 12, 2021
@ghost
Copy link

ghost commented Jul 12, 2021

Hello @DHowett!

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 17e68a0 into microsoft:main Jul 12, 2021
@ghost
Copy link

ghost commented Jul 14, 2021

🎉Windows Terminal Preview v1.10.1933.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-CodeHealth Issues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc. AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KeyChord should just use the existing WinRT types instead of defining our own
5 participants