terminal/src/cascadia/TerminalControl/KeyChord.cpp
Mike Griese eddb99e9b2
Add support for the win key in keybindings (#9783)
## Summary of the Pull Request

Does what it says on the can. People can now use `win` in a keybinding to
indicate that the chord needs <kbd>win</kbd>.

## References
* Done for #653
* See also #8888

## PR Checklist
* [x] Closes #3184
* [x] I work here
* [ ] Tests added/passed
* [ ] Requires documentation to be updated

## Detailed Description of the Pull Request / Additional comments

For the record, I hate this. But it's great for quake mode, so _meh_. There's
shockingly more win keys claimed then you think - many more than the shortcut
guide even shows.

* `win+b`: Focus the tray?
* `win+t`: Focus the taskbar
* `win+p`: Project...
* `win+c`: The powertoys color picker
* `win+v`: cloud clipboard

So the list of valid combos is vanishingly small. It's all about that <kbd>win+~</kbd>

## Validation Steps Performed

Bound
```json
        { "keys": [ "win+`" ], "command": "commandPalette" },
```

and yea, it works as expected
2021-04-15 16:52:28 +00:00

60 lines
1.7 KiB
C++

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "pch.h"
#include "KeyChord.h"
#include "KeyChord.g.cpp"
namespace winrt::Microsoft::Terminal::Control::implementation
{
KeyChord::KeyChord() noexcept :
_modifiers{ 0 },
_vkey{ 0 }
{
}
KeyChord::KeyChord(bool ctrl, bool alt, bool shift, int32_t vkey) noexcept :
_modifiers{ (ctrl ? Control::KeyModifiers::Ctrl : Control::KeyModifiers::None) |
(alt ? Control::KeyModifiers::Alt : Control::KeyModifiers::None) |
(shift ? Control::KeyModifiers::Shift : Control::KeyModifiers::None) },
_vkey{ vkey }
{
}
KeyChord::KeyChord(bool ctrl, bool alt, bool shift, bool win, int32_t vkey) noexcept :
_modifiers{ (ctrl ? Control::KeyModifiers::Ctrl : Control::KeyModifiers::None) |
(alt ? Control::KeyModifiers::Alt : Control::KeyModifiers::None) |
(shift ? Control::KeyModifiers::Shift : Control::KeyModifiers::None) |
(win ? Control::KeyModifiers::Windows : Control::KeyModifiers::None) },
_vkey{ vkey }
{
}
KeyChord::KeyChord(Control::KeyModifiers const& modifiers, int32_t vkey) noexcept :
_modifiers{ modifiers },
_vkey{ vkey }
{
}
Control::KeyModifiers KeyChord::Modifiers() noexcept
{
return _modifiers;
}
void KeyChord::Modifiers(Control::KeyModifiers const& value) noexcept
{
_modifiers = value;
}
int32_t KeyChord::Vkey() noexcept
{
return _vkey;
}
void KeyChord::Vkey(int32_t value) noexcept
{
_vkey = value;
}
}