Add configurable offline layout correction and latest Windows release

This commit is contained in:
2026-10-27 23:50:04 +02:00
parent f683e4178c
commit f1af998029
25 changed files with 142458 additions and 27 deletions
+8 -1
View File
@@ -1,4 +1,5 @@
#pragma once
#include "autocorrect.h"
#include "storage.h"
#include <atomic>
#include <condition_variable>
@@ -11,7 +12,9 @@ namespace ks
{
inline constexpr UINT TrayMessage = WM_APP + 1, ErrorMessage = WM_APP + 2, HistoryMessage = WM_APP + 3,
SnippetMessage = WM_APP + 4;
inline constexpr int Toggle = 1, Case = 2, Translit = 3, Undo = 4, ShowHistory = 5, Direct = 100;
inline constexpr int Toggle = 1, Case = 2, Translit = 3, Undo = 4, ShowHistory = 5, AutoCorrect = 6,
Direct = 100;
inline constexpr UINT AutoCorrectMessage = WM_APP + 6;
inline constexpr UINT CaptureHotkeyMessage = WM_APP + 5;
struct LastTransform
{
@@ -20,6 +23,8 @@ struct LastTransform
int layout = -1;
ULONGLONG at{};
uint64_t version{};
int sourceLayout = -1;
bool autoCorrected = false;
};
class App
{
@@ -30,6 +35,7 @@ class App
std::vector<Layout> layouts;
Settings settings;
std::unique_ptr<History> history;
AutoCorrector autoCorrector;
std::atomic<bool> busy{false}, suspended{false};
std::atomic<DWORD> ownSequence{0};
std::atomic<uint64_t> inputVersion{0};
@@ -70,6 +76,7 @@ class App
std::thread worker;
bool stop{};
UINT taskbarCreated{};
uint64_t pendingAutoVersion{};
std::vector<std::pair<int, Hotkey>> hookBindings;
HotkeyHook hotkeyHook;
static LRESULT CALLBACK windowProc(HWND, UINT, WPARAM, LPARAM);