Remember and ignore hotkey combination before capturing

When capturing a new hotkey combination, we want to get only the delta of the keys and buttons being pressed during the capturing. 

ref T585
This commit is contained in:
Roland Rossgotterer
2019-04-11 10:08:58 +02:00
committed by Mat Sutcliffe
parent c51a1b8c7b
commit 563a69e3f5
5 changed files with 62 additions and 9 deletions

View File

@@ -93,6 +93,7 @@ namespace BlackCore
{
m_captureActive = true;
m_capturedCombination = {};
m_combinationBeforeCapture = m_lastCombination;
}
void CInputManager::callFunctionsBy(const QString &action, bool isKeyDown, bool shouldEmit)
@@ -156,15 +157,20 @@ namespace BlackCore
{
if (m_captureActive)
{
if (currentCombination.size() < m_capturedCombination.size())
CHotkeyCombination deltaCombination = currentCombination.getDeltaComparedTo(m_combinationBeforeCapture);
// Don't continue if there is no relevant combination yet
if (m_capturedCombination.isEmpty() && deltaCombination.isEmpty()) { return; }
if (deltaCombination.size() < m_capturedCombination.size())
{
emit combinationSelectionFinished(m_capturedCombination);
m_captureActive = false;
}
else
{
emit combinationSelectionChanged(currentCombination);
m_capturedCombination = currentCombination;
emit combinationSelectionChanged(deltaCombination);
m_capturedCombination = deltaCombination;
}
return;
}