Skip to content

Commit

Permalink
More comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed Apr 14, 2021
1 parent 784ec73 commit b20222f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/cascadia/TerminalSettingsModel/KeyMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
return keyModifiers;
}

// Method Description:
// - Build a map of all the globalSummon actions.
// - quakeMode actions are included in this, but expanded to the equivalent
// set of GlobalSummonArgs
// Arguments:
// - <none>
// Return Value:
// - a map of KeyChord -> ActionAndArgs containing all globally bindable actions.
Windows::Foundation::Collections::IMap<Control::KeyChord, Model::ActionAndArgs> KeyMapping::FetchGlobalHotkeys()
{
std::unordered_map<Control::KeyChord, Model::ActionAndArgs, KeyChordHash, KeyChordEquality> justGlobals;
Expand All @@ -153,7 +161,10 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// Manually replace the QuakeMode action with a globalSummon
// that has the appropriate action args.
auto args = winrt::make_self<GlobalSummonArgs>();

// We want to summon the window with the name "_quake" specifically.
args->Name(L"_quake");

Model::ActionAndArgs actionAndArgs{ ShortcutAction::GlobalSummon, *args };
justGlobals[k] = actionAndArgs;
}
Expand Down
15 changes: 15 additions & 0 deletions src/cascadia/WindowsTerminal/IslandWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,12 @@ void IslandWindow::_SetIsFullscreen(const bool fullscreenEnabled)
}
}

// Method Description:
// - Call UnregisterHotKey once for each entry in hotkeyList, to unset all the bound global hotkeys.
// Arguments:
// - hotkeyList: a list of hotkeys to unbind
// Return Value:
// - <none>
void IslandWindow::UnsetHotkeys(const std::vector<winrt::Microsoft::Terminal::Control::KeyChord>& hotkeyList)
{
for (int i = 0; i < hotkeyList.size(); i++)
Expand All @@ -911,6 +917,15 @@ void IslandWindow::UnsetHotkeys(const std::vector<winrt::Microsoft::Terminal::Co
}
}

// Method Description:
// - Call RegisterHotKey once for each entry in hotkeyList, to attempt to
// register that keybinding as a global hotkey.
// - When these keys are pressed, we'll get a WM_HOTKEY message with the payload
// containing the index we registered here.
// Arguments:
// - hotkeyList: a list of hotkeys to bind
// Return Value:
// - <none>
void IslandWindow::SetGlobalHotkeys(const std::vector<winrt::Microsoft::Terminal::Control::KeyChord>& hotkeyList)
{
int index = 0;
Expand Down

1 comment on commit b20222f

@github-actions

This comment was marked as outdated.

Please sign in to comment.