mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[QuickAccent]Add setting to select language (#20798)
* add selection of country langages * Add Greek and Iceland countries * Update src/modules/poweraccent/PowerAccent.Core/PowerAccent.Core.csproj * fix ß in all section * remove greek * improve UI * langage to language * remove GR reference * change 'All' to 'All available' * adding Romanian and Hungarian * Missing characters * Add Italian * Fix translation key Remove GameMode activation * Fix PR build issues * Callback to get if a letter is part of the language * Add additional dlls to installer * Fix new dlls signing * Fix spelling * Add description to language selection Co-authored-by: Damien LEROY <dleroy@veepee.com>
This commit is contained in:
@@ -68,6 +68,15 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
|
||||
};
|
||||
}
|
||||
|
||||
void KeyboardListener::SetIsLanguageLetterDelegate(IsLanguageLetter isLanguageLetterDelegate)
|
||||
{
|
||||
m_isLanguageLetterCb = [trigger = std::move(isLanguageLetterDelegate)](LetterKey key) {
|
||||
bool result;
|
||||
trigger(key, result);
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
void KeyboardListener::UpdateActivationKey(int32_t activationKey)
|
||||
{
|
||||
m_settings.activationKey = static_cast<PowerAccentActivationKey>(activationKey);
|
||||
@@ -80,7 +89,7 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
|
||||
|
||||
bool KeyboardListener::OnKeyDown(KBDLLHOOKSTRUCT info) noexcept
|
||||
{
|
||||
if (std::find(std::begin(letters), end(letters), static_cast<LetterKey>(info.vkCode)) != end(letters))
|
||||
if (std::find(std::begin(letters), end(letters), static_cast<LetterKey>(info.vkCode)) != end(letters) && m_isLanguageLetterCb(static_cast<LetterKey>(info.vkCode)))
|
||||
{
|
||||
m_stopwatch.reset();
|
||||
letterPressed = static_cast<LetterKey>(info.vkCode);
|
||||
@@ -139,7 +148,7 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
|
||||
|
||||
bool KeyboardListener::OnKeyUp(KBDLLHOOKSTRUCT info) noexcept
|
||||
{
|
||||
if (std::find(std::begin(letters), end(letters), static_cast<LetterKey>(info.vkCode)) != end(letters))
|
||||
if (std::find(std::begin(letters), end(letters), static_cast<LetterKey>(info.vkCode)) != end(letters) && m_isLanguageLetterCb(static_cast<LetterKey>(info.vkCode)))
|
||||
{
|
||||
letterPressed = LetterKey::None;
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
|
||||
void SetShowToolbarEvent(ShowToolbar showToolbarEvent);
|
||||
void SetHideToolbarEvent(HideToolbar hideToolbarEvent);
|
||||
void SetNextCharEvent(NextChar NextCharEvent);
|
||||
void SetIsLanguageLetterDelegate(IsLanguageLetter IsLanguageLetterDelegate);
|
||||
|
||||
void UpdateActivationKey(int32_t activationKey);
|
||||
void UpdateInputTime(int32_t inputTime);
|
||||
@@ -49,18 +50,47 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
|
||||
std::function<void(LetterKey)> m_showToolbarCb;
|
||||
std::function<void(InputType)> m_hideToolbarCb;
|
||||
std::function<void(TriggerKey)> m_nextCharCb;
|
||||
std::function<bool(LetterKey)> m_isLanguageLetterCb;
|
||||
bool m_triggeredWithSpace;
|
||||
spdlog::stopwatch m_stopwatch;
|
||||
|
||||
static inline const std::vector<LetterKey> letters = { LetterKey::VK_A,
|
||||
LetterKey::VK_C,
|
||||
LetterKey::VK_E,
|
||||
LetterKey::VK_I,
|
||||
LetterKey::VK_N,
|
||||
LetterKey::VK_O,
|
||||
LetterKey::VK_S,
|
||||
LetterKey::VK_U,
|
||||
LetterKey::VK_Y };
|
||||
static inline const std::vector<LetterKey> letters = { LetterKey::VK_0,
|
||||
LetterKey::VK_1,
|
||||
LetterKey::VK_2,
|
||||
LetterKey::VK_3,
|
||||
LetterKey::VK_4,
|
||||
LetterKey::VK_5,
|
||||
LetterKey::VK_6,
|
||||
LetterKey::VK_7,
|
||||
LetterKey::VK_8,
|
||||
LetterKey::VK_9,
|
||||
LetterKey::VK_A,
|
||||
LetterKey::VK_B,
|
||||
LetterKey::VK_C,
|
||||
LetterKey::VK_D,
|
||||
LetterKey::VK_E,
|
||||
LetterKey::VK_F,
|
||||
LetterKey::VK_G,
|
||||
LetterKey::VK_H,
|
||||
LetterKey::VK_I,
|
||||
LetterKey::VK_J,
|
||||
LetterKey::VK_K,
|
||||
LetterKey::VK_L,
|
||||
LetterKey::VK_M,
|
||||
LetterKey::VK_N,
|
||||
LetterKey::VK_O,
|
||||
LetterKey::VK_P,
|
||||
LetterKey::VK_Q,
|
||||
LetterKey::VK_R,
|
||||
LetterKey::VK_S,
|
||||
LetterKey::VK_T,
|
||||
LetterKey::VK_U,
|
||||
LetterKey::VK_V,
|
||||
LetterKey::VK_W,
|
||||
LetterKey::VK_X,
|
||||
LetterKey::VK_Y,
|
||||
LetterKey::VK_Z,
|
||||
LetterKey::VK_COMMA };
|
||||
LetterKey letterPressed{};
|
||||
|
||||
static inline const std::vector<TriggerKey> triggers = { TriggerKey::Right, TriggerKey::Left, TriggerKey::Space };
|
||||
|
||||
@@ -5,15 +5,43 @@ namespace PowerToys
|
||||
enum LetterKey
|
||||
{
|
||||
None = 0x00,
|
||||
VK_0 = 0x30,
|
||||
VK_1 = 0x31,
|
||||
VK_2 = 0x32,
|
||||
VK_3 = 0x33,
|
||||
VK_4 = 0x34,
|
||||
VK_5 = 0x35,
|
||||
VK_6 = 0x36,
|
||||
VK_7 = 0x37,
|
||||
VK_8 = 0x38,
|
||||
VK_9 = 0x39,
|
||||
VK_A = 0x41,
|
||||
VK_B = 0x42,
|
||||
VK_C = 0x43,
|
||||
VK_D = 0x44,
|
||||
VK_E = 0x45,
|
||||
VK_F = 0x46,
|
||||
VK_G = 0x47,
|
||||
VK_H = 0x48,
|
||||
VK_I = 0x49,
|
||||
VK_J = 0x4A,
|
||||
VK_K = 0x4B,
|
||||
VK_L = 0x4C,
|
||||
VK_M = 0x4D,
|
||||
VK_N = 0x4E,
|
||||
VK_O = 0x4F,
|
||||
VK_P = 0x50,
|
||||
VK_Q = 0x51,
|
||||
VK_R = 0x52,
|
||||
VK_S = 0x53,
|
||||
VK_T = 0x54,
|
||||
VK_U = 0x55,
|
||||
VK_Y = 0x59
|
||||
VK_V = 0x56,
|
||||
VK_W = 0x57,
|
||||
VK_X = 0x58,
|
||||
VK_Y = 0x59,
|
||||
VK_Z = 0x5A,
|
||||
VK_COMMA = 0xBC
|
||||
};
|
||||
|
||||
enum TriggerKey
|
||||
@@ -33,6 +61,7 @@ namespace PowerToys
|
||||
[version(1.0), uuid(37197089-5438-4479-af57-30ab3f3c8be4)] delegate void ShowToolbar(LetterKey key);
|
||||
[version(1.0), uuid(8eb79d6b-1826-424f-9fbc-af21ae19725e)] delegate void HideToolbar(InputType inputType);
|
||||
[version(1.0), uuid(db72d45c-a5a2-446f-bdc1-506e9121764a)] delegate void NextChar(TriggerKey inputSpace);
|
||||
[version(1.0), uuid(20be2919-2b91-4313-b6e0-4c3484fe91ef)] delegate void IsLanguageLetter(LetterKey key, [out] boolean* result);
|
||||
|
||||
[default_interface] runtimeclass KeyboardListener {
|
||||
KeyboardListener();
|
||||
@@ -41,6 +70,7 @@ namespace PowerToys
|
||||
void SetShowToolbarEvent(event ShowToolbar showToolbarEvent);
|
||||
void SetHideToolbarEvent(event HideToolbar hideToolbarEvent);
|
||||
void SetNextCharEvent(event NextChar nextCharEvent);
|
||||
void SetIsLanguageLetterDelegate(IsLanguageLetter isLanguageLetterDelegate);
|
||||
void UpdateActivationKey(Int32 activationKey);
|
||||
void UpdateInputTime(Int32 inputTime);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user