Compare commits

...
Author SHA1 Message Date
agrynco 0da8464fce Merge pull request 'Promote prerelease to main for KSwitcher v0.8.14' (#233) from prerelease into main 2026-12-03 11:00:02 +02:00
agrynco d261b079c6 Merge pull request 'Prepare KSwitcher v0.8.14 with clipboard history refresh' (#232) from codex/release-v0.8.14 into prerelease 2026-12-03 11:00:00 +02:00
agrynco 2b312f33e6 Prepare KSwitcher v0.8.14 for stable delivery 2026-12-03 10:59:57 +02:00
agrynco b3f0f4ab0f Keep new screenshots visible in open clipboard history 2026-12-03 10:53:42 +02:00
agrynco 1f97e9c50e Merge pull request 'Promote prerelease to main for KSwitcher v0.8.13' (#231) from prerelease into main 2026-12-01 22:55:35 +02:00
agrynco f740e7195d Merge pull request 'Prepare KSwitcher v0.8.13 with LAN handoff tray warning' (#230) from codex/release-v0.8.13 into prerelease 2026-12-01 22:55:34 +02:00
agrynco 20930dd05c Prepare KSwitcher v0.8.13 for stable delivery
Refs #227
2026-12-01 22:55:26 +02:00
agrynco f76796c7ea Show a tray warning when held input blocks LAN switching
Refs #227
2026-12-01 22:51:41 +02:00
agrynco 62bb55bccc Merge pull request 'Promote prerelease to main for KSwitcher v0.8.12' (#229) from prerelease into main 2026-12-01 20:46:20 +02:00
agrynco 86346df08e Merge pull request 'Prepare KSwitcher v0.8.12 with LAN input recovery' (#228) from codex/release-v0.8.12 into prerelease 2026-12-01 20:46:18 +02:00
agrynco 8c7129917c Merge pull request 'Promote prerelease to main for KSwitcher v0.8.11' (#226) from prerelease into main 2026-11-30 12:59:38 +02:00
13 changed files with 167 additions and 50 deletions

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.24)
project(KSwitcher VERSION 0.8.12 LANGUAGES C CXX RC)
project(KSwitcher VERSION 0.8.14 LANGUAGES C CXX RC)
if(NOT WIN32)
message(FATAL_ERROR "KSwitcher uses native Windows APIs")
endif()
+6 -5
View File
@@ -140,11 +140,12 @@ worker stops. Hover over the icon to see the connection status and the connected
count when only some paired PCs are connected.
If a held key or button blocks a handoff, the tray and **Settings → Computers**
identify the PC and name the input when available. The hint clears when the
input is released or a handoff succeeds. If Windows still sees an input as held,
choose **Reset held keys and mouse buttons** in the tray menu on the PC named
in the hint. Both computers need v0.8.12 or later for the source PC to display
which input is held on the destination.
identify the PC and name the input when available. Starting with v0.8.13, the
tray icon shows a steady amber exclamation mark until the input is released or a
handoff succeeds.
If Windows still sees an input as held, choose **Reset held keys and mouse buttons**
in the tray menu on the PC named in the hint. Both computers need v0.8.12 or
later for the source PC to display which input is held on the destination.
The source cursor is parked and hidden beneath a tiny no-activation window. A
small banner identifies remote control; no full-screen layered bitmap is retained.
+12
View File
@@ -1,5 +1,17 @@
# Latest Windows release
## v0.8.14 — 2026-12-03
**Clipboard history.** When the open list is at the top, a newly copied or received screenshot appears in the first row. If you have scrolled down to browse older entries, the list keeps your place and preserves your selection.
**Українською.** Коли відкритий список історії прокручено до початку, новий скріншот після копіювання або отримання з іншого ПК видно в першому рядку. Під час перегляду старіших записів список зберігає позицію прокручування та вибраний запис.
## v0.8.13 — 2026-12-01
**Tray warning for LAN cursor handoff.** A steady amber badge with an exclamation mark appears when a held key or mouse button blocks a cursor handoff. Hover over the tray icon to see the affected PC and, when known, the held key or button. The normal connection indicator returns when the input is released or a handoff succeeds.
**Українською.** Якщо затиснута клавіша чи кнопка миші блокує перехід курсора між ПК, у треї з’являється сталий бурштиновий індикатор зі знаком оклику. Наведіть курсор на значок, щоб побачити, на якому ПК виникло блокування та що саме затиснуто, якщо це вдалося визначити. Після відпускання вводу або успішного переходу повертається звичайний індикатор з’єднання.
## v0.8.12 — 2026-12-01
**LAN cursor handoff.** The tray and **Settings → Computers** identify the computer and, when known, the key or mouse button holding up the handoff. If Windows still sees an input as held after you release it, choose **Reset held keys and mouse buttons** from the tray menu on that PC. Update both computers to see which input on the other PC is blocking the handoff.
+1 -1
View File
@@ -1 +1 @@
f21c0f10aeb188f688bf4f3cfec8020d9ffbf92d86f15ad09efbb507dcbe7c49 KSwitcher-win-x64.zip
59a4c6262263159283c72b6fde9ba3038903f4fb438513bf53150c344a4ef33a KSwitcher-win-x64.zip
+11 -11
View File
@@ -1,24 +1,26 @@
{
"schema": 1,
"version": "0.8.14",
"files": [
{
"path": "KSwitcher.exe",
"size": 3311104,
"sha256": "a5454e72ec1dc0acfebd8ed713b8ca9a124cf501ef7ae7ee28e66a865b3e821f"
"size": 3313152,
"sha256": "afd00b7f18abf09032ea98c613b1648f405e734a217c969e9c75cc86f25b3a40"
},
{
"path": "KSwitcher.Config.exe",
"size": 2897408,
"sha256": "3695f4c1f02fdf9aa27230b22f855685e028c82402c1d05f1198e01c28e023aa"
"sha256": "912e8ca6745ed01fcc08a8857aa674b5df0eeb06368dc6ca020d42ed04d68d0d"
},
{
"path": "KSwitcher.Screenshot.exe",
"size": 3209216,
"sha256": "cc0bb2b9bfab49d1c639a97b6ca55aca1bc502f6ca3cc03525f84ff646b7bfd3"
"sha256": "8828d283bf9a736e78ab602c518daee873832d4f73cc2bc5531b1cb07c3dfbb6"
},
{
"path": "KSwitcher.Files.exe",
"size": 6039040,
"sha256": "2ccbd71bff0dd09f3f00aa063c33307dcfb7bf94811a9cd5f15213af73499f2a"
"sha256": "0eb83ff59edfd70d903ad24370c1b59951c7c42517bdf3908dbbe11c1aeeabc0"
},
{
"path": "WebView2Loader.dll",
@@ -127,8 +129,8 @@
},
{
"path": "LAN-PREVIEW.md",
"size": 17689,
"sha256": "d8418e72fe7d78862bc101fe7df6de44a185a49d6001afee1a20bd8d98cffcd5"
"size": 17750,
"sha256": "171e48b9a7f1d772a6534700786fef295ead5b1cab6c6792a306723e2d8bf39b"
},
{
"path": "dictionaries/en.txt",
@@ -168,14 +170,12 @@
{
"path": "tools/StayHere.exe",
"size": 133120,
"sha256": "ad8fa1e781e817f9b04c5148be484d757913941387ffedd4b73fffeb1d119f6a"
"sha256": "9d9d0af5b7886cc308d635472107734e570fb44d49e659262d004859b40f803d"
},
{
"path": "tools/StayHere-README.md",
"size": 2796,
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413"
}
],
"schema": 1,
"version": "0.8.12"
]
}
+3 -3
View File
@@ -14,8 +14,8 @@ IDC_SCREENSHOT_PENCIL CURSOR "icons/lucide/pencil.cur"
1 RT_MANIFEST "app.manifest"
201 RCDATA "update.ps1"
1 VERSIONINFO
FILEVERSION 0,8,12,0
PRODUCTVERSION 0,8,12,0
FILEVERSION 0,8,14,0
PRODUCTVERSION 0,8,14,0
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
BEGIN
@@ -25,7 +25,7 @@ BEGIN
BEGIN
VALUE "FileDescription", "KSwitcher — native keyboard and clipboard utility"
VALUE "ProductName", "KSwitcher"
VALUE "FileVersion", "0.8.12"
VALUE "FileVersion", "0.8.14"
END
END
BLOCK "VarFileInfo"
+30 -9
View File
@@ -1079,23 +1079,37 @@ HBITMAP trayIconBitmap(HICON base, int width, int height, void **data = nullptr)
return nullptr;
}
HICON trayInputIcon(HICON base, int width, int height, uint32_t color)
HICON trayInputIcon(HICON base, int width, int height, uint32_t color, bool blocked = false)
{
if (width < 8 || height < 8) return nullptr;
void *bits{};
const auto bitmap = trayIconBitmap(base, width, height, &bits);
if (!bitmap) return nullptr;
auto pixels = static_cast<uint32_t *>(bits);
const int radius = std::max(3, MulDiv(std::min(width, height), 3, 16));
const int minimumRadius = blocked ? 4 : 3;
const int radius = std::min((std::min(width, height) - 1) / 2,
std::max(minimumRadius, MulDiv(std::min(width, height), minimumRadius, 16)));
const int cx = width - 1 - radius, cy = height - 1 - radius;
constexpr uint32_t ink = 0xff242424;
for (int y = -radius; y <= radius; ++y)
for (int x = -radius; x <= radius; ++x)
{
const int distance = x * x + y * y;
if (distance <= radius * radius)
pixels[(cy + y) * width + cx + x] = distance <= (radius - 1) * (radius - 1)
? color : 0xff242424;
? color : ink;
}
if (blocked)
{
const int stroke = std::max(1, radius / 4);
const int left = cx - (stroke - 1) / 2;
const int dot = cy + std::max(2, radius / 2);
for (int x = left; x < left + stroke; ++x)
{
for (int y = cy - radius / 2; y <= cy; ++y) pixels[y * width + x] = ink;
for (int y = dot; y < dot + stroke; ++y) pixels[y * width + x] = ink;
}
}
// The 32-bit DIB supplies the transparency. The fallback mask is initialized as well.
std::vector<unsigned char> maskBits(size_t((width + 15) / 16) * 2 * height);
HICON icon{};
@@ -1116,6 +1130,16 @@ HICON App::trayBaseIcon(int width, int height) const
return static_cast<HICON>(LoadImageW(instance, MAKEINTRESOURCEW(resource), IMAGE_ICON, width, height, LR_SHARED));
}
HICON App::trayInputBadge(HICON base, int width, int height) const
{
if (inputState != InputState::Active) return nullptr;
if (!trayInputBlock.empty()) return trayInputIcon(base, width, height, 0xffffc457, true);
if (!trayInput.paired) return nullptr;
const uint32_t color = trayInput.stopped ? 0xfff16b66 : !trayInput.online ? 0xffa0a4ab :
!trayInput.reconnecting() ? 0xff45d58c : trayInputPulse ? 0xffffc457 : 0xffac7830;
return trayInputIcon(base, width, height, color);
}
bool App::updateTray(DWORD action)
{
NOTIFYICONDATAW icon{sizeof(icon)};
@@ -1126,7 +1150,8 @@ bool App::updateTray(DWORD action)
icon.uCallbackMessage = TrayMessage;
const int width = GetSystemMetrics(SM_CXSMICON), height = GetSystemMetrics(SM_CYSMICON);
icon.hIcon = trayBaseIcon(width, height);
HICON badge{};
const auto badge = trayInputBadge(icon.hIcon, width, height);
if (badge) icon.hIcon = badge;
auto tip = localBuildTitle(L"KSwitcher");
const auto state = inputState.load();
tip += state == InputState::Active ? L" — Input processing active" :
@@ -1134,10 +1159,6 @@ bool App::updateTray(DWORD action)
if (state == InputState::Active && trayInput.paired)
{
const bool reconnecting = trayInput.reconnecting();
const uint32_t color = trayInput.stopped ? 0xfff16b66 : !trayInput.online ? 0xffa0a4ab :
!reconnecting ? 0xff45d58c : trayInputPulse ? 0xffffc457 : 0xffac7830;
badge = trayInputIcon(icon.hIcon, width, height, color);
if (badge) icon.hIcon = badge;
tip += L"\nMouse & keyboard: ";
if (trayInput.stopped) tip += L"connection stopped";
else if (!trayInput.online) tip += L"all paired PCs offline. Waiting for LAN discovery.";
@@ -3980,7 +4001,7 @@ LRESULT CALLBACK App::windowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
if (app->trayInput.reconnecting())
{
app->trayInputPulse = !app->trayInputPulse;
app->updateTray(NIM_MODIFY);
if (app->trayInputBlock.empty()) app->updateTray(NIM_MODIFY);
}
return 0;
}
+1
View File
@@ -185,6 +185,7 @@ class App
ULONGLONG nextInputBlockNotice{};
bool inputBlockNoticeVisible{};
HICON trayBaseIcon(int width, int height) const;
HICON trayInputBadge(HICON base, int width, int height) const;
bool updateTray(DWORD action);
void refreshTrayInput();
void refreshTrayInputBlock();
+6 -2
View File
@@ -1118,8 +1118,12 @@ LRESULT CALLBACK historyProc(HWND w, UINT msg, WPARAM wp, LPARAM lp)
auto old = selected(w, v);
if (old.empty()) old = v->rememberedSelection;
int top=(int)SendDlgItemMessageW(w,102,LB_GETTOPINDEX,0,0);
auto topId=top>=0 && top<(int)v->items.size()?v->items[top].id:L"";
if (topId.empty()) topId = v->rememberedTop;
// Follow new entries at the top. Anchor the viewport only while browsing older rows.
std::wstring topId;
if (top > 0 && top < (int)v->items.size())
topId = v->items[top].id;
else if (v->items.empty())
topId = v->rememberedTop;
if (v->selectFirstOnResults)
{
old.clear();
+1 -1
View File
@@ -2,7 +2,7 @@
#include "platform.h"
namespace ks
{
inline constexpr wchar_t AppVersion[] = L"0.8.12";
inline constexpr wchar_t AppVersion[] = L"0.8.14";
inline constexpr UINT UpdateMessage = WM_APP + 7;
inline constexpr UINT UpdateCheckIntervalMs = 6 * 60 * 60 * 1000;
inline constexpr UINT UpdateNotificationRetryMs = 5 * 60 * 1000;
+57 -6
View File
@@ -43,6 +43,40 @@ struct InputRegressionAccess {
}
for (const auto &job : jobs) job();
}
static bool probeTrayBlock(App &app)
{
const auto savedConnections = app.trayInput;
const auto savedBlock = app.trayInputBlock;
const auto savedPulse = app.trayInputPulse;
const auto checkBadge = [&](bool blocked) {
for (int size : {16, 32})
{
const auto icon = app.trayInputBadge(app.trayBaseIcon(size, size), size, size);
const bool matches = app.inputState == App::InputState::Active ?
trayIconMatchesLanBadge(icon, size, blocked) : !icon;
if (icon) DestroyIcon(icon);
if (!matches) return false;
}
return true;
};
app.trayInput = {1, 1, 1, false};
app.trayInputBlock.clear();
const bool ready = checkBadge(false);
app.trayInputBlock = L"Cursor handoff blocked on this PC: Tab is held.";
const bool blocked = checkBadge(true);
app.trayInput = {1, 2, 2, false};
app.trayInputPulse = false;
const bool steadyDim = checkBadge(true);
app.trayInputPulse = true;
const bool steadyBright = checkBadge(true);
app.trayInput = {1, 1, 1, false};
app.trayInputBlock.clear();
const bool restored = checkBadge(false);
app.trayInput = savedConnections;
app.trayInputBlock = savedBlock;
app.trayInputPulse = savedPulse;
return ready && blocked && steadyDim && steadyBright && restored;
}
static LRESULT CALLBACK probeInput(HWND w, UINT msg, WPARAM wp, LPARAM lp, UINT_PTR, DWORD_PTR context) {
auto &app = *reinterpret_cast<App *>(context);
static bool queuedSnippet = false;
@@ -50,6 +84,7 @@ struct InputRegressionAccess {
if (msg == WM_EXITMENULOOP && app.inputState == App::InputState::Active)
queuedSnippet = app.queueSnippet(w, 0, 2, w);
if (msg == ProbeTrayIcon) return trayIconMatchesInput(app.trayBaseIcon(16, 16), wp != 0);
if (msg == ProbeTrayBlock) return probeTrayBlock(app);
if (msg != ProbeInputState) return DefSubclassProc(w, msg, wp, lp);
// Also exercise settings/layout updates that would normally re-register shortcuts.
if (wp && app.inputState == App::InputState::Paused) {
@@ -301,11 +336,26 @@ static void historyLayoutChecks(ks::App &app, const std::filesystem::path &temp,
require(SendDlgItemMessageW(history,102,LB_GETCURSEL,0,0)==0 &&
SendDlgItemMessageW(history,102,LB_GETTOPINDEX,0,0)==0,
"fresh history invocation selects and reveals newest screenshot instead of saved selection");
SendDlgItemMessageW(history,102,LB_SETCURSEL,2,0);
app.history->add(ks::textClip(L"background clipboard update"),L"test",app.settings);
ks::refreshHistory(app);
require(pumpUntil(4),"background refresh loads a new item");
require(SendDlgItemMessageW(history,102,LB_GETCURSEL,0,0)==3,
"background refresh preserves the selected record while browsing");
SendDlgItemMessageW(history,102,LB_SETTOPINDEX,0,0);
screenshot.bgra[0] ^= 1;
app.history->add(ks::Clip{{ks::imageDib(screenshot)}},L"new screenshot",app.settings);
ks::refreshHistory(app);
require(pumpUntil(5),"open history loads the new screenshot");
require(SendDlgItemMessageW(history,102,LB_GETTOPINDEX,0,0)==0,
"history at the top immediately shows the new screenshot");
require(SendDlgItemMessageW(history,102,LB_GETCURSEL,0,0)==4,
"showing a new screenshot preserves the selection");
if (capturePreview)
{
RedrawWindow(history, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
ks::InputRegressionAccess::finishHistoryPreviews(app);
pumpUntil(3);
pumpUntil(5);
RedrawWindow(history, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
RECT historyClient{};
GetClientRect(history, &historyClient);
@@ -315,12 +365,13 @@ static void historyLayoutChecks(ks::App &app, const std::filesystem::path &temp,
ks::atomicWrite(std::filesystem::path(ks::executable()).parent_path() / L"clipboard-history.png",
ks::encodePng(ks::decodeImage(preview)));
}
SendDlgItemMessageW(history,102,LB_SETCURSEL,2,0);
app.history->add(ks::textClip(L"background clipboard update"),L"test",app.settings);
SendDlgItemMessageW(history,102,LB_SETTOPINDEX,1,0);
require(SendDlgItemMessageW(history,102,LB_GETTOPINDEX,0,0)==1,
"history can scroll past the newest item");
app.history->add(ks::textClip(L"another clipboard update"),L"test",app.settings);
ks::refreshHistory(app);
require(pumpUntil(4),"background refresh loads a new item");
require(SendDlgItemMessageW(history,102,LB_GETCURSEL,0,0)==3,
"background refresh preserves the selected record while browsing");
require(pumpUntil(6) && SendDlgItemMessageW(history,102,LB_GETTOPINDEX,0,0)==2,
"history preserves the top record when scrolled down");
ShowWindow(history,SW_HIDE);
}
auto childRect=[&](int id) { RECT r{}; GetWindowRect(GetDlgItem(history,id),&r); MapWindowPoints(nullptr,history,(POINT*)&r,2); return r; };
+36 -11
View File
@@ -80,28 +80,51 @@ void chooseInputAction(HWND resident, DWORD pid, const wchar_t *expected)
}
}
bool trayIconMatchesInput(HICON icon, bool active)
namespace {
template<class Check> bool renderedTrayIconMatches(HICON icon, int size, Check check)
{
HDC dc = CreateCompatibleDC(nullptr);
HBITMAP bitmap = CreateBitmap(16, 16, 1, 32, nullptr);
HBITMAP bitmap = CreateBitmap(size, size, 1, 32, nullptr);
bool matches = false;
if (dc && bitmap) {
const auto previous = SelectObject(dc, bitmap);
if (icon && DrawIconEx(dc, 0, 0, icon, 16, 16, 0, nullptr, DI_NORMAL)) {
const auto tile = GetPixel(dc, 2, 8);
const auto white = RGB(255, 255, 255);
const auto gap = GetPixel(dc, 8, 8);
// The active keycap is purple. The pause glyph has two white strokes with a gap.
matches = active ? GetBValue(tile) > GetRValue(tile) + 70 :
GetPixel(dc, 5, 8) == white && GetPixel(dc, 10, 8) == white &&
GetRValue(gap) < 160 && std::abs(GetBValue(gap) - GetRValue(gap)) < 32;
}
if (icon && DrawIconEx(dc, 0, 0, icon, size, size, 0, nullptr, DI_NORMAL)) matches = check(dc);
SelectObject(dc, previous);
}
if (bitmap) DeleteObject(bitmap);
if (dc) DeleteDC(dc);
return matches;
}
}
bool trayIconMatchesInput(HICON icon, bool active)
{
return renderedTrayIconMatches(icon, 16, [active](HDC dc) {
const auto tile = GetPixel(dc, 2, 8);
const auto white = RGB(255, 255, 255);
const auto gap = GetPixel(dc, 8, 8);
// The active keycap is purple. The pause glyph has two white strokes with a gap.
return active ? GetBValue(tile) > GetRValue(tile) + 70 :
GetPixel(dc, 5, 8) == white && GetPixel(dc, 10, 8) == white &&
GetRValue(gap) < 160 && std::abs(GetBValue(gap) - GetRValue(gap)) < 32;
});
}
bool trayIconMatchesLanBadge(HICON icon, int size, bool blocked)
{
return renderedTrayIconMatches(icon, size, [=](HDC dc) {
if (!blocked)
{
const int center = size - 1 - 3 * size / 16;
return GetPixel(dc, center, center) == RGB(69, 213, 140);
}
const int center = size - 1 - size / 4;
const auto amber = RGB(255, 196, 87), ink = RGB(36, 36, 36);
return GetPixel(dc, center - size / 8, center) == amber &&
GetPixel(dc, center, center) == ink && GetPixel(dc, center, center + 1) == amber &&
GetPixel(dc, center, center + size / 8) == ink;
});
}
int testInputPause()
{
@@ -129,6 +152,7 @@ int testInputPause()
return resident && query(resident, ProbeInputState) == 1;
}, "resident did not start with both hooks and shortcuts");
require(query(resident, ProbeTrayIcon, TRUE), "active tray icon missing at startup");
require(query(resident, ProbeTrayBlock), "tray shows a distinct warning during a LAN handoff block and restores green afterward");
constexpr UINT mods = MOD_CONTROL | MOD_SHIFT;
require(!RegisterHotKey(nullptr, 1, mods, VK_F23) && GetLastError() == ERROR_HOTKEY_ALREADY_REGISTERED,
"Files shortcut should be owned by resident before pause");
@@ -136,6 +160,7 @@ int testInputPause()
until([&] { return query(resident, ProbeInputState) == 2; },
"pause did not release both hooks and bindings and cancel the queued snippet");
require(query(resident, ProbeTrayIcon), "pause bars missing after pause");
require(query(resident, ProbeTrayBlock), "the handoff warning does not cover the paused tray icon");
require(RegisterHotKey(nullptr, 1, mods, VK_F23), "another process could not acquire Files shortcut");
require(query(resident, ProbeInputState, 1) == 2, "settings, layout reload or IPC restarted input");
chooseInputAction(resident, child.dwProcessId, L"Resume &input processing");
+2
View File
@@ -3,5 +3,7 @@
inline constexpr UINT ProbeInputState = WM_APP + 200;
inline constexpr UINT ProbeTrayIcon = WM_APP + 201;
inline constexpr UINT ProbeTrayBlock = WM_APP + 202;
bool trayIconMatchesInput(HICON icon, bool active);
bool trayIconMatchesLanBadge(HICON icon, int size, bool blocked);
int testInputPause();