[Quick Accent]Left/Right key action normal behaviour added for less than input delay(#27604)

* [Quick Accent] - Left/Right key action normal behaviour added for less than input delay.
- Showing toolbar bug is resolved.

* [Quick Accent] Used spaces instead of tabs
This commit is contained in:
gokcekantarci
2023-07-26 19:05:21 +03:00
committed by GitHub
parent eb91e8977e
commit a9d129aa5a
4 changed files with 28 additions and 2 deletions

View File

@@ -203,6 +203,18 @@ public class PowerAccent : IDisposable
break; break;
} }
case InputType.Right:
{
SendKeys.SendWait("{RIGHT}");
break;
}
case InputType.Left:
{
SendKeys.SendWait("{LEFT}");
break;
}
case InputType.Char: case InputType.Char:
{ {
if (_selectedIndex != -1) if (_selectedIndex != -1)

View File

@@ -12,7 +12,7 @@
namespace winrt::PowerToys::PowerAccentKeyboardService::implementation namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
{ {
KeyboardListener::KeyboardListener() : KeyboardListener::KeyboardListener() :
m_toolbarVisible(false), m_triggeredWithSpace(false), m_leftShiftPressed(false), m_rightShiftPressed(false) m_toolbarVisible(false), m_triggeredWithSpace(false), m_leftShiftPressed(false), m_rightShiftPressed(false), m_triggeredWithLeftArrow(false), m_triggeredWithRightArrow(false)
{ {
s_instance = this; s_instance = this;
LoggerHelpers::init_logger(L"PowerAccent", L"PowerAccentKeyboardService", "PowerAccent"); LoggerHelpers::init_logger(L"PowerAccent", L"PowerAccentKeyboardService", "PowerAccent");
@@ -174,8 +174,8 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
(triggerPressed == VK_SPACE && m_settings.activationKey == PowerAccentActivationKey::LeftRightArrow) || (triggerPressed == VK_SPACE && m_settings.activationKey == PowerAccentActivationKey::LeftRightArrow) ||
((triggerPressed == VK_LEFT || triggerPressed == VK_RIGHT) && m_settings.activationKey == PowerAccentActivationKey::Space)) ((triggerPressed == VK_LEFT || triggerPressed == VK_RIGHT) && m_settings.activationKey == PowerAccentActivationKey::Space))
{ {
triggerPressed = 0;
Logger::debug(L"Reset trigger key"); Logger::debug(L"Reset trigger key");
return false;
} }
} }
} }
@@ -186,6 +186,8 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
// Keep track if it was triggered with space so that it can be typed on false starts. // Keep track if it was triggered with space so that it can be typed on false starts.
m_triggeredWithSpace = triggerPressed == VK_SPACE; m_triggeredWithSpace = triggerPressed == VK_SPACE;
m_triggeredWithLeftArrow = triggerPressed == VK_LEFT;
m_triggeredWithRightArrow = triggerPressed == VK_RIGHT;
m_toolbarVisible = true; m_toolbarVisible = true;
m_showToolbarCb(letterPressed); m_showToolbarCb(letterPressed);
} }
@@ -241,6 +243,14 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
{ {
m_hideToolbarCb(InputType::Space); m_hideToolbarCb(InputType::Space);
} }
else if (m_triggeredWithLeftArrow)
{
m_hideToolbarCb(InputType::Left);
}
else if (m_triggeredWithRightArrow)
{
m_hideToolbarCb(InputType::Right);
}
else else
{ {
m_hideToolbarCb(InputType::None); m_hideToolbarCb(InputType::None);

View File

@@ -55,6 +55,8 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
std::function<void(TriggerKey, bool)> m_nextCharCb; std::function<void(TriggerKey, bool)> m_nextCharCb;
std::function<bool(LetterKey)> m_isLanguageLetterCb; std::function<bool(LetterKey)> m_isLanguageLetterCb;
bool m_triggeredWithSpace; bool m_triggeredWithSpace;
bool m_triggeredWithLeftArrow;
bool m_triggeredWithRightArrow;
spdlog::stopwatch m_stopwatch; spdlog::stopwatch m_stopwatch;
bool m_leftShiftPressed; bool m_leftShiftPressed;
bool m_rightShiftPressed; bool m_rightShiftPressed;

View File

@@ -60,6 +60,8 @@ namespace PowerToys
{ {
None, None,
Space, Space,
Left,
Right,
Char Char
}; };