Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d376ef694 | ||
|
|
1367fd6636 | ||
|
|
5a70d35c27 | ||
|
|
0da8464fce | ||
|
|
d261b079c6 | ||
|
|
2b312f33e6 | ||
|
|
b3f0f4ab0f | ||
|
|
1f97e9c50e | ||
|
|
f740e7195d | ||
|
|
62bb55bccc | ||
|
|
8c7129917c |
No files matched your search
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(KSwitcher VERSION 0.8.13 LANGUAGES C CXX RC)
|
||||
project(KSwitcher VERSION 0.8.15 LANGUAGES C CXX RC)
|
||||
if(NOT WIN32)
|
||||
message(FATAL_ERROR "KSwitcher uses native Windows APIs")
|
||||
endif()
|
||||
@@ -70,7 +70,10 @@ target_link_libraries(KSwitcherFiles PRIVATE kscore)
|
||||
target_include_directories(kscore PUBLIC src PRIVATE vendor "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
||||
target_compile_definitions(kscore PUBLIC UNICODE _UNICODE WIN32_LEAN_AND_MEAN NOMINMAX _WIN32_WINNT=0x0A00)
|
||||
target_link_libraries(kscore PUBLIC ws2_32 bcrypt iphlpapi winhttp user32 shell32 shlwapi advapi32 crypt32 imm32 comctl32 gdi32 ole32 oleaut32 taskschd comdlg32 uuid windowscodecs runtimeobject uiautomationcore dwmapi)
|
||||
file(GLOB KSWITCHER_NAVIGATION_ICONS CONFIGURE_DEPENDS "resources/icons/navigation/*.ico")
|
||||
set_property(SOURCE resources/app.rc APPEND PROPERTY OBJECT_DEPENDS
|
||||
${KSWITCHER_NAVIGATION_ICONS}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/resources/navigation_icons.inc"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/resources/update.ps1"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/resources/kswitcher.ico"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/resources/kswitcher-paused.ico"
|
||||
@@ -390,6 +393,8 @@ set_tests_properties(clipboard-history-layout PROPERTIES RUN_SERIAL TRUE TIMEOUT
|
||||
add_test(NAME offline-help-window COMMAND KSwitcherInputTests --help-layout)
|
||||
set_tests_properties(offline-help-window PROPERTIES RUN_SERIAL TRUE TIMEOUT 20)
|
||||
add_test(NAME tray-input-pause COMMAND KSwitcherInputTests --input-pause)
|
||||
add_test(NAME navigation-icons COMMAND KSwitcherInputTests --navigation-icons)
|
||||
set_tests_properties(navigation-icons PROPERTIES TIMEOUT 20)
|
||||
add_test(NAME screenshot-ui-regressions COMMAND KSwitcherScreenshotUITests)
|
||||
add_test(NAME screenshot-editor-layout COMMAND KSwitcherScreenshotUITests --layout-only)
|
||||
set_tests_properties(screenshot-editor-layout PROPERTIES RUN_SERIAL TRUE TIMEOUT 20)
|
||||
|
||||
@@ -144,8 +144,11 @@ 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.
|
||||
in the tray menu. One click resets this PC and sends the request to every
|
||||
paired PC with an active input-sharing connection. Computers with older builds
|
||||
ignore the remote request. An offline PC does not receive it when it reconnects.
|
||||
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.
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# Latest Windows release
|
||||
|
||||
## v0.8.15 — 2026-12-04
|
||||
|
||||
**Settings and tray menu.** Every section in the Settings sidebar and every command in the main tray menu now has an outline icon. Shared commands such as Snippets and keyboard shortcuts use the same symbol in both places.
|
||||
|
||||
**LAN input recovery.** **Reset held keys and mouse buttons** now resets this PC and asks each connected, paired PC to clear stuck input. Update both PCs to use remote reset.
|
||||
|
||||
**Українською.** Усі розділи бічної панелі налаштувань і всі команди головного меню в треї отримали контурні іконки. Спільні команди, як-от Snippets і шорткати, мають однаковий символ в обох меню.
|
||||
|
||||
**Відновлення вводу через LAN.** Команда **«Скинути затиснуті клавіші й кнопки миші»** скидає ввід на цьому ПК і надсилає запит кожному підключеному спареному ПК. Для віддаленого скидання оновіть обидва ПК.
|
||||
|
||||
|
||||
## 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.
|
||||
|
||||
@@ -1 +1 @@
|
||||
daf147ac8e63db06c9afaa521aa4187e2bae511fae15e117543ac5a8b2b157e9 KSwitcher-win-x64.zip
|
||||
bdc1ddd2cfca17ff040dc52e74f76a3ae3d89e57b4138f75c79339d62b51dc67 KSwitcher-win-x64.zip
|
||||
@@ -1,181 +1,181 @@
|
||||
{
|
||||
"version": "0.8.13",
|
||||
"schema": 1,
|
||||
"files": [
|
||||
{
|
||||
"sha256": "d261aede51439e4ed185753aea9cbf44764471e7fadf779b666caa624075f665",
|
||||
"path": "KSwitcher.exe",
|
||||
"size": 3312640
|
||||
"sha256": "589783aa5bbb7727ebc1ad6dc0987bec6a6d11daaa40e7bcb193be06360a3db2",
|
||||
"size": 3534336
|
||||
},
|
||||
{
|
||||
"sha256": "b26b62a2710ed2e8c714b6bca4e5f2e9ae7d55a15cd85de3b4d19fab1cb77a84",
|
||||
"path": "KSwitcher.Config.exe",
|
||||
"size": 2897408
|
||||
"sha256": "4673bb360f53264524e3015fa923c9ecab31073d64f0103916ce27ef95e1e471",
|
||||
"size": 3118592
|
||||
},
|
||||
{
|
||||
"sha256": "631805b3928e921d30ad70e542b0985b0e430006455ece81f64711cfe215d432",
|
||||
"path": "KSwitcher.Screenshot.exe",
|
||||
"size": 3209216
|
||||
"sha256": "67ea80117d5db8432b1fbcb30606fd8fc8f91e43cd6a3fe2447c0209fb5b3220",
|
||||
"size": 3427328
|
||||
},
|
||||
{
|
||||
"sha256": "9dff79e1891be3e911dff1f06ad7162eba8a1721d93d5e4f96c7f0be41179a55",
|
||||
"path": "KSwitcher.Files.exe",
|
||||
"size": 6039040
|
||||
"sha256": "ab882ea94b5ce5a56711ac83f1029cdf13c9c1d88412cf6d3b3b2f6e48708df6",
|
||||
"size": 6040064
|
||||
},
|
||||
{
|
||||
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6",
|
||||
"path": "WebView2Loader.dll",
|
||||
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6",
|
||||
"size": 194912
|
||||
},
|
||||
{
|
||||
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f",
|
||||
"path": "terminal/addon-fit-LICENSE.txt",
|
||||
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f",
|
||||
"size": 1103
|
||||
},
|
||||
{
|
||||
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527",
|
||||
"path": "terminal/addon-fit.js",
|
||||
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527",
|
||||
"size": 1521
|
||||
},
|
||||
{
|
||||
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef",
|
||||
"path": "terminal/index.html",
|
||||
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef",
|
||||
"size": 527
|
||||
},
|
||||
{
|
||||
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473",
|
||||
"path": "terminal/markdown-it-LICENSE.txt",
|
||||
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473",
|
||||
"size": 1073
|
||||
},
|
||||
{
|
||||
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e",
|
||||
"path": "terminal/markdown-it.js",
|
||||
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e",
|
||||
"size": 100786
|
||||
},
|
||||
{
|
||||
"sha256": "98984c8f76bd231dab00ef54034bfc2f29b365ee0b31c05edb16ad5216bd5bc2",
|
||||
"path": "terminal/markdown.html",
|
||||
"sha256": "98984c8f76bd231dab00ef54034bfc2f29b365ee0b31c05edb16ad5216bd5bc2",
|
||||
"size": 3800
|
||||
},
|
||||
{
|
||||
"sha256": "8b5429a035ce8ce11f77a222b5ee946844fd1e2999e1bb5c8f7c030ddbb1ff96",
|
||||
"path": "terminal/markdown.js",
|
||||
"sha256": "8b5429a035ce8ce11f77a222b5ee946844fd1e2999e1bb5c8f7c030ddbb1ff96",
|
||||
"size": 18721
|
||||
},
|
||||
{
|
||||
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80",
|
||||
"path": "terminal/mermaid-LICENSE.txt",
|
||||
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80",
|
||||
"size": 1089
|
||||
},
|
||||
{
|
||||
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3",
|
||||
"path": "terminal/mermaid.js",
|
||||
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3",
|
||||
"size": 5537838
|
||||
},
|
||||
{
|
||||
"sha256": "838707e2813f7d007f7f60670a78ae4a4a6c97ca9a235d623cb85e16dc50e0c7",
|
||||
"path": "terminal/terminal.js",
|
||||
"sha256": "838707e2813f7d007f7f60670a78ae4a4a6c97ca9a235d623cb85e16dc50e0c7",
|
||||
"size": 6627
|
||||
},
|
||||
{
|
||||
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd",
|
||||
"path": "terminal/xterm-LICENSE.txt",
|
||||
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd",
|
||||
"size": 1261
|
||||
},
|
||||
{
|
||||
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6",
|
||||
"path": "terminal/xterm.css",
|
||||
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6",
|
||||
"size": 7112
|
||||
},
|
||||
{
|
||||
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972",
|
||||
"path": "terminal/xterm.js",
|
||||
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972",
|
||||
"size": 488663
|
||||
},
|
||||
{
|
||||
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c",
|
||||
"path": "LICENSE",
|
||||
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c",
|
||||
"size": 4401
|
||||
},
|
||||
{
|
||||
"sha256": "61e08da79c44061654015ce6b0c4061c23ee1dd18237fbf09e9bfda3c0ea2831",
|
||||
"path": "json-LICENSE.txt",
|
||||
"sha256": "61e08da79c44061654015ce6b0c4061c23ee1dd18237fbf09e9bfda3c0ea2831",
|
||||
"size": 1096
|
||||
},
|
||||
{
|
||||
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625",
|
||||
"path": "files-text-license.txt",
|
||||
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625",
|
||||
"size": 883
|
||||
},
|
||||
{
|
||||
"sha256": "57d6d9b1f85ac93b3bc73f6f7bdf4346e896c4644d6fa461c380ae29070c029d",
|
||||
"path": "files-archive-license.txt",
|
||||
"sha256": "57d6d9b1f85ac93b3bc73f6f7bdf4346e896c4644d6fa461c380ae29070c029d",
|
||||
"size": 4990
|
||||
},
|
||||
{
|
||||
"sha256": "7997c62a2f766674ceb99976485a6cf5c772309e79101a400c421d526b82f6e4",
|
||||
"path": "files-image-license.txt",
|
||||
"sha256": "7997c62a2f766674ceb99976485a6cf5c772309e79101a400c421d526b82f6e4",
|
||||
"size": 3044
|
||||
},
|
||||
{
|
||||
"sha256": "19c254c71ee49aefbd8854ac55b05d719c5f1e4f8ef9a982324b898501b39594",
|
||||
"path": "files-sftp-license.txt",
|
||||
"sha256": "19c254c71ee49aefbd8854ac55b05d719c5f1e4f8ef9a982324b898501b39594",
|
||||
"size": 2064
|
||||
},
|
||||
{
|
||||
"sha256": "d9a53cb9190dfde2415df54c131b8bd293efbd627014a4e0976cea717ae855ae",
|
||||
"path": "README.md",
|
||||
"sha256": "d9a53cb9190dfde2415df54c131b8bd293efbd627014a4e0976cea717ae855ae",
|
||||
"size": 108205
|
||||
},
|
||||
{
|
||||
"sha256": "171e48b9a7f1d772a6534700786fef295ead5b1cab6c6792a306723e2d8bf39b",
|
||||
"path": "LAN-PREVIEW.md",
|
||||
"size": 17750
|
||||
"sha256": "46d91a76c4a19acb576f0232bdc1d163302cc21f5fbd8fe26e4f93f72ae9c40d",
|
||||
"size": 17941
|
||||
},
|
||||
{
|
||||
"sha256": "d0c022b27b9fbc2ff7b6b8bec723cc1adc4eef517202f9ff77eed5d8bea3acb9",
|
||||
"path": "dictionaries/en.txt",
|
||||
"sha256": "d0c022b27b9fbc2ff7b6b8bec723cc1adc4eef517202f9ff77eed5d8bea3acb9",
|
||||
"size": 732485
|
||||
},
|
||||
{
|
||||
"sha256": "0bdfb0201d1803634f268cdff0993b8349d2c70e956a06dbb667c8dd65254ec5",
|
||||
"path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt",
|
||||
"sha256": "0bdfb0201d1803634f268cdff0993b8349d2c70e956a06dbb667c8dd65254ec5",
|
||||
"size": 20566
|
||||
},
|
||||
{
|
||||
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311",
|
||||
"path": "dictionaries/README.md",
|
||||
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311",
|
||||
"size": 2265
|
||||
},
|
||||
{
|
||||
"sha256": "80e6b6a27815973535f7facb636c597eb845dfee45cfabfc4e9b3341b9332849",
|
||||
"path": "dictionaries/ru.txt",
|
||||
"sha256": "80e6b6a27815973535f7facb636c597eb845dfee45cfabfc4e9b3341b9332849",
|
||||
"size": 1109134
|
||||
},
|
||||
{
|
||||
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408",
|
||||
"path": "dictionaries/sources.json",
|
||||
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408",
|
||||
"size": 1280
|
||||
},
|
||||
{
|
||||
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf",
|
||||
"path": "dictionaries/uk.txt",
|
||||
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf",
|
||||
"size": 940799
|
||||
},
|
||||
{
|
||||
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a",
|
||||
"path": "tools/README.txt",
|
||||
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a",
|
||||
"size": 993
|
||||
},
|
||||
{
|
||||
"sha256": "73b8f40a3b5e9c855f47bd7014b61902ead707c6eb19729903d01edfa546f8cf",
|
||||
"path": "tools/StayHere.exe",
|
||||
"sha256": "980020501d65b5efe5cd947393a9584e523844ef82ec2aff9cb51f3aea7d68eb",
|
||||
"size": 133120
|
||||
},
|
||||
{
|
||||
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413",
|
||||
"path": "tools/StayHere-README.md",
|
||||
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413",
|
||||
"size": 2796
|
||||
}
|
||||
],
|
||||
"schema": 1
|
||||
"version": "0.8.15"
|
||||
}
|
||||
@@ -7,6 +7,9 @@ IDI_KSWITCHER_HISTORY ICON "kswitcher-history.ico"
|
||||
IDI_KSWITCHER_SCREENSHOT ICON "kswitcher-screenshot.ico"
|
||||
IDI_KSWITCHER_HELP ICON "kswitcher-help.ico"
|
||||
IDI_KSWITCHER_DONATE ICON "kswitcher-donate.ico"
|
||||
#define NAVIGATION_ICON(name, id, file) id ICON file
|
||||
#include "navigation_icons.inc"
|
||||
#undef NAVIGATION_ICON
|
||||
#ifdef KS_SCREENSHOT_RESOURCES
|
||||
IDI_SCREENSHOT_QUESTION ICON "icons/question.ico"
|
||||
IDC_SCREENSHOT_PENCIL CURSOR "icons/lucide/pencil.cur"
|
||||
@@ -14,8 +17,8 @@ IDC_SCREENSHOT_PENCIL CURSOR "icons/lucide/pencil.cur"
|
||||
1 RT_MANIFEST "app.manifest"
|
||||
201 RCDATA "update.ps1"
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 0,8,13,0
|
||||
PRODUCTVERSION 0,8,13,0
|
||||
FILEVERSION 0,8,15,0
|
||||
PRODUCTVERSION 0,8,15,0
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
BEGIN
|
||||
@@ -25,7 +28,7 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "FileDescription", "KSwitcher — native keyboard and clipboard utility"
|
||||
VALUE "ProductName", "KSwitcher"
|
||||
VALUE "FileVersion", "0.8.13"
|
||||
VALUE "FileVersion", "0.8.15"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 7.4 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
@@ -0,0 +1,40 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 120" fill="none" stroke="#000" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round">
|
||||
<g id="Gear" transform="translate(0 0)"><circle cx="12" cy="12" r="3"/><path d="m10 3-.6 2.4-2 .9-2.2-1.2-2 3.5L5 10.3v3.4l-1.8 1.7 2 3.5 2.2-1.2 2 .9.6 2.4h4l.6-2.4 2-.9 2.2 1.2 2-3.5-1.8-1.7v-3.4l1.8-1.7-2-3.5-2.2 1.2-2-.9L14 3z"/></g>
|
||||
<g id="Check" transform="translate(24 0)"><path d="m3 15 3 3 6-7M13 18h8M3 6h9m3 0h6"/></g>
|
||||
<g id="Book" transform="translate(48 0)"><path d="M4 19V5a2 2 0 0 1 2-2h13v18H6a2 2 0 0 1 0-4h13M8 7h7M8 10h5"/></g>
|
||||
<g id="Ban" transform="translate(72 0)"><circle cx="12" cy="12" r="9"/><path d="m6 6 12 12"/></g>
|
||||
<g id="Personal" transform="translate(96 0)"><path d="M4 19V5a2 2 0 0 1 2-2h13v18H6a2 2 0 0 1 0-4h13M8 13c0-3 7-3 7 0"/><circle cx="11.5" cy="7.5" r="1.5"/></g>
|
||||
<g id="Bounds" transform="translate(120 0)"><path d="M7 4H4v16h3m10-16h3v16h-3M8 12h8m-1-1 1 1-1 1m-6-2-1 1 1 1"/></g>
|
||||
<g id="Replace" transform="translate(144 0)"><path d="M3 7h17m-4-4 4 4-4 4m5 6H4m4-4-4 4 4 4"/></g>
|
||||
<g id="Globe" transform="translate(168 0)"><circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c5 5 5 13 0 18-5-5-5-13 0-18z"/></g>
|
||||
<g id="Chat" transform="translate(0 24)"><path d="M4 5h16v11H9l-5 4zM8 13l2.5-5 2.5 5m-4-1.5h3m3-.5h2"/></g>
|
||||
<g id="Keyboard" transform="translate(24 24)"><rect x="2" y="5" width="20" height="14" rx="2"/><path d="M6 9h.01M10 9h.01M14 9h.01M18 9h.01M6 13h.01M10 13h.01M14 13h.01M18 13h.01M8 16h8"/></g>
|
||||
<g id="Command" transform="translate(48 24)"><path d="M9 9V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3z"/></g>
|
||||
<g id="Clip" transform="translate(72 24)"><rect x="8" y="3" width="8" height="4" rx="1"/><path d="M8 5H5v16h14V5h-3M8 12h8m-8 4h6"/></g>
|
||||
<g id="Scan" transform="translate(96 24)"><path d="M8 3H3v5m13-5h5v5m0 8v5h-5M3 16v5h5m-1-12h10M7 12h10M7 15h6"/></g>
|
||||
<g id="Snippet" transform="translate(120 24)"><path d="M5 3h10l4 4v14H5zM14 3v5h5m-9 4-2 2 2 2m4-4 2 2-2 2"/></g>
|
||||
<g id="Mouse" transform="translate(144 24)"><rect x="6" y="3" width="12" height="18" rx="6"/><path d="M12 3v6"/></g>
|
||||
<g id="Sync" transform="translate(168 24)"><path d="M20 10a8 8 0 0 0-14-4L3 9m0-5v5h5m-4 5a8 8 0 0 0 14 4l3-3m0 5v-5h-5"/></g>
|
||||
<g id="Vault" transform="translate(0 48)"><rect x="4" y="10" width="16" height="11" rx="2"/><path d="M8 10V7a4 4 0 1 1 8 0v3m-4 5v2"/></g>
|
||||
<g id="Drive" transform="translate(24 48)"><path d="M8 4h7l7 12-4 5H6l-4-5zm0 0 7 12h7M2 16h13l3 5"/></g>
|
||||
<g id="Computers" transform="translate(48 48)"><rect x="2" y="4" width="14" height="11" rx="1"/><path d="M6 19h6m-3-4v4m7-9h6v10h-5m2-3h.01"/></g>
|
||||
<g id="Manage" transform="translate(72 48)"><rect x="2" y="4" width="17" height="12" rx="1"/><path d="M10 16v4m-4 0h8m3-8h5m-2.5-2.5v5"/></g>
|
||||
<g id="Pulse" transform="translate(96 48)"><path d="M2 12h5l3-7 4 14 3-7h5"/></g>
|
||||
<g id="Connect" transform="translate(120 48)"><path d="m9 7 4-4m4 8 4-4m-10-2 8 8m-2-2-5 5a4 4 0 0 1-6-6l5-5M7 15l-4 6"/></g>
|
||||
<g id="Pause" transform="translate(144 48)"><rect x="5" y="4" width="4" height="16" rx="1"/><rect x="15" y="4" width="4" height="16" rx="1"/></g>
|
||||
<g id="Reset" transform="translate(168 48)"><path d="M3 5v5h5m-5 0a9 9 0 1 1 1 7m8-9v4l3 2"/></g>
|
||||
<g id="History" transform="translate(0 72)"><path d="M8 5H5v16h14V5h-3"/><rect x="8" y="3" width="8" height="4" rx="1"/><path d="M12 10v4l3 2"/></g>
|
||||
<g id="Capture" transform="translate(24 72)"><path d="M8 3H3v5m13-5h5v5m0 8v5h-5M3 16v5h5"/><circle cx="12" cy="12" r="3"/></g>
|
||||
<g id="Folder" transform="translate(48 72)"><path d="M3 6h7l2 2h9v12H3z"/></g>
|
||||
<g id="Tools" transform="translate(72 72)"><path d="M21 5a5 5 0 0 1-6 7L7 20a2 2 0 0 1-3-3l8-8a5 5 0 0 1 7-6l-3 3 2 2z"/></g>
|
||||
<g id="Sun" transform="translate(96 72)"><circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M2 12h2m16 0h2M5 5l1.5 1.5m11 11L19 19M5 19l1.5-1.5m11-11L19 5"/></g>
|
||||
<g id="ClipPause" transform="translate(120 72)"><path d="M8 5H5v16h14V5h-3M10 11v6m4-6v6"/><rect x="8" y="3" width="8" height="4" rx="1"/></g>
|
||||
<g id="FolderOpen" transform="translate(144 72)"><path d="M3 19V5h7l2 2h8v4M3 19l4-8h15l-4 8z"/></g>
|
||||
<g id="Log" transform="translate(168 72)"><path d="M5 3h10l4 4v14H5zM14 3v5h5M8 12h8m-8 4h8"/></g>
|
||||
<g id="Update" transform="translate(0 96)"><path d="M12 3v12m-4-4 4 4 4-4M4 16v5h16v-5"/></g>
|
||||
<g id="Coffee" transform="translate(24 96)"><path d="M4 6h12v5a5 5 0 0 1-5 5H9a5 5 0 0 1-5-5zm12 1h2a2 2 0 1 1 0 4h-2M3 20h17"/></g>
|
||||
<g id="Help" transform="translate(48 96)"><circle cx="12" cy="12" r="9"/><path d="M9 9a3 3 0 1 1 4 2.8c-1 .4-1 1.2-1 2.2m0 3h.01"/></g>
|
||||
<g id="Exit" transform="translate(72 96)"><path d="M11 4H4v16h7m-1-8h11m-4-4 4 4-4 4"/></g>
|
||||
<g id="Search" transform="translate(96 96)"><circle cx="10.5" cy="10.5" r="5.5"/><path d="m15 15 4 4"/></g>
|
||||
<g id="Play" transform="translate(120 96)"><path d="M7 4l13 8-13 8z"/></g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
@@ -0,0 +1,38 @@
|
||||
NAVIGATION_ICON(Gear, 700, "icons/navigation/gear.ico")
|
||||
NAVIGATION_ICON(Check, 701, "icons/navigation/check.ico")
|
||||
NAVIGATION_ICON(Book, 702, "icons/navigation/book.ico")
|
||||
NAVIGATION_ICON(Ban, 703, "icons/navigation/ban.ico")
|
||||
NAVIGATION_ICON(Personal, 704, "icons/navigation/personal.ico")
|
||||
NAVIGATION_ICON(Bounds, 705, "icons/navigation/bounds.ico")
|
||||
NAVIGATION_ICON(Replace, 706, "icons/navigation/replace.ico")
|
||||
NAVIGATION_ICON(Globe, 707, "icons/navigation/globe.ico")
|
||||
NAVIGATION_ICON(Chat, 708, "icons/navigation/chat.ico")
|
||||
NAVIGATION_ICON(Keyboard, 709, "icons/navigation/keyboard.ico")
|
||||
NAVIGATION_ICON(Command, 710, "icons/navigation/command.ico")
|
||||
NAVIGATION_ICON(Clip, 711, "icons/navigation/clip.ico")
|
||||
NAVIGATION_ICON(Scan, 712, "icons/navigation/scan.ico")
|
||||
NAVIGATION_ICON(Snippet, 713, "icons/navigation/snippet.ico")
|
||||
NAVIGATION_ICON(Mouse, 714, "icons/navigation/mouse.ico")
|
||||
NAVIGATION_ICON(Sync, 715, "icons/navigation/sync.ico")
|
||||
NAVIGATION_ICON(Vault, 716, "icons/navigation/vault.ico")
|
||||
NAVIGATION_ICON(Drive, 717, "icons/navigation/drive.ico")
|
||||
NAVIGATION_ICON(Computers, 718, "icons/navigation/computers.ico")
|
||||
NAVIGATION_ICON(Manage, 719, "icons/navigation/manage.ico")
|
||||
NAVIGATION_ICON(Pulse, 720, "icons/navigation/pulse.ico")
|
||||
NAVIGATION_ICON(Connect, 721, "icons/navigation/connect.ico")
|
||||
NAVIGATION_ICON(Pause, 722, "icons/navigation/pause.ico")
|
||||
NAVIGATION_ICON(Reset, 723, "icons/navigation/reset.ico")
|
||||
NAVIGATION_ICON(History, 724, "icons/navigation/history.ico")
|
||||
NAVIGATION_ICON(Capture, 725, "icons/navigation/capture.ico")
|
||||
NAVIGATION_ICON(Folder, 726, "icons/navigation/folder.ico")
|
||||
NAVIGATION_ICON(Tools, 727, "icons/navigation/tools.ico")
|
||||
NAVIGATION_ICON(Sun, 728, "icons/navigation/sun.ico")
|
||||
NAVIGATION_ICON(ClipPause, 729, "icons/navigation/clippause.ico")
|
||||
NAVIGATION_ICON(FolderOpen, 730, "icons/navigation/folderopen.ico")
|
||||
NAVIGATION_ICON(Log, 731, "icons/navigation/log.ico")
|
||||
NAVIGATION_ICON(Update, 732, "icons/navigation/update.ico")
|
||||
NAVIGATION_ICON(Coffee, 733, "icons/navigation/coffee.ico")
|
||||
NAVIGATION_ICON(Help, 734, "icons/navigation/help.ico")
|
||||
NAVIGATION_ICON(Exit, 735, "icons/navigation/exit.ico")
|
||||
NAVIGATION_ICON(Search, 736, "icons/navigation/search.ico")
|
||||
NAVIGATION_ICON(Play, 737, "icons/navigation/play.ico")
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "paste_probe.h"
|
||||
#include "utilities.h"
|
||||
#include "screenshot_notifications.h"
|
||||
#include "navigation_icons.h"
|
||||
#include <algorithm>
|
||||
#include <commctrl.h>
|
||||
#include <set>
|
||||
@@ -1051,39 +1052,11 @@ constexpr UINT TrayInputPulseMs = 450;
|
||||
|
||||
namespace
|
||||
{
|
||||
HBITMAP trayIconBitmap(HICON base, int width, int height, void **data = nullptr)
|
||||
{
|
||||
if (!base || width < 1 || height < 1) return nullptr;
|
||||
BITMAPINFO bitmapInfo{};
|
||||
bitmapInfo.bmiHeader = {sizeof(BITMAPINFOHEADER), width, -height, 1, 32, BI_RGB};
|
||||
void *bits{};
|
||||
HBITMAP bitmap = CreateDIBSection(nullptr, &bitmapInfo, DIB_RGB_COLORS, &bits, nullptr, 0);
|
||||
if (!bitmap) return nullptr;
|
||||
HDC dc = CreateCompatibleDC(nullptr);
|
||||
BOOL drawn = FALSE;
|
||||
if (dc)
|
||||
{
|
||||
auto previous = SelectObject(dc, bitmap);
|
||||
std::fill_n(static_cast<uint32_t *>(bits), size_t(width) * height, 0);
|
||||
drawn = DrawIconEx(dc, 0, 0, base, width, height, 0, nullptr, DI_NORMAL);
|
||||
GdiFlush();
|
||||
SelectObject(dc, previous);
|
||||
DeleteDC(dc);
|
||||
}
|
||||
if (drawn)
|
||||
{
|
||||
if (data) *data = bits;
|
||||
return bitmap;
|
||||
}
|
||||
DeleteObject(bitmap);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
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);
|
||||
const auto bitmap = iconBitmap(base, width, height, &bits);
|
||||
if (!bitmap) return nullptr;
|
||||
auto pixels = static_cast<uint32_t *>(bits);
|
||||
const int minimumRadius = blocked ? 4 : 3;
|
||||
@@ -1319,9 +1292,13 @@ void App::updateLanInputTimer()
|
||||
}
|
||||
void App::pollLanInput()
|
||||
{
|
||||
// Temporary text transactions only block new handoffs. A tray pause removes
|
||||
// the router entirely, including for already queued network notifications.
|
||||
if (lanService && lanService->tickInput(!busy && !suspended && !hotkeyCapture)) resetLanInput();
|
||||
// Keep new handoffs and remote resets out of text transactions and shortcut capture.
|
||||
// Pausing in the tray also removes the input router.
|
||||
const bool allowInputRequest = !busy && !suspended && !hotkeyCapture;
|
||||
if (lanService && lanService->tickInput(allowInputRequest, [this] {
|
||||
if (!busy && !suspended && !hotkeyCapture && !installingUpdate && !resetHeldInput())
|
||||
log(L"LAN input: could not reset held input on this PC");
|
||||
})) resetLanInput();
|
||||
refreshTrayInputBlock();
|
||||
}
|
||||
void App::applySettings(const Settings &requested, const Bytes &supplement)
|
||||
@@ -3424,6 +3401,14 @@ void App::clearMousePresses()
|
||||
PostMessageW(window, MouseVolumeReleasedMessage, 0, 0);
|
||||
}
|
||||
|
||||
bool App::resetHeldInput()
|
||||
{
|
||||
if (!lan::resetWindowsHeldInput()) return false;
|
||||
if (lanService) lanService->forgetHeldInput();
|
||||
clearMousePresses();
|
||||
return true;
|
||||
}
|
||||
|
||||
void App::toggleInputProcessing()
|
||||
{
|
||||
if (inputState == InputState::Pausing) return;
|
||||
@@ -3487,66 +3472,77 @@ void App::trayMenu()
|
||||
auto utilities = discoverUtilities(std::filesystem::path(executable()).parent_path() / L"tools", utilitiesError);
|
||||
if (utilities.size() > 50000) utilities.resize(50000);
|
||||
HMENU menu = CreatePopupMenu();
|
||||
AppendMenuW(menu, MF_STRING | (inputState == InputState::Pausing ? MF_GRAYED : 0), ToggleInputProcessing,
|
||||
POINT pt{};
|
||||
GetCursorPos(&pt);
|
||||
const int iconSize = MulDiv(16, GetDpiForWindow(window), USER_DEFAULT_SCREEN_DPI);
|
||||
HIGHCONTRASTW contrast{sizeof(contrast)};
|
||||
const bool highContrast = SystemParametersInfoW(SPI_GETHIGHCONTRAST, sizeof(contrast), &contrast, 0) &&
|
||||
(contrast.dwFlags & HCF_HIGHCONTRASTON);
|
||||
std::vector<HBITMAP> bitmaps;
|
||||
bitmaps.reserve(17);
|
||||
const auto append = [&](NavigationIcon icon, UINT flags, UINT_PTR command, const wchar_t *label)
|
||||
{
|
||||
if (!AppendMenuW(menu, flags, command, label)) return;
|
||||
const COLORREF color = flags & MF_GRAYED ? GetSysColor(COLOR_GRAYTEXT) :
|
||||
highContrast ? GetSysColor(COLOR_MENUTEXT) :
|
||||
icon == NavigationIcon::Gear || icon == NavigationIcon::Coffee ? NavigationIconAccent : NavigationIconColor;
|
||||
if (const auto bitmap = navigationIconBitmap(instance, icon, iconSize, color))
|
||||
{
|
||||
bitmaps.push_back(bitmap);
|
||||
MENUITEMINFOW item{sizeof(item), MIIM_BITMAP};
|
||||
item.hbmpItem = bitmap;
|
||||
SetMenuItemInfoW(menu, GetMenuItemCount(menu) - 1, TRUE, &item);
|
||||
}
|
||||
};
|
||||
const auto inputIcon = inputState == InputState::Paused ? NavigationIcon::Play : NavigationIcon::Pause;
|
||||
append(inputIcon, MF_STRING | (inputState == InputState::Pausing ? MF_GRAYED : 0), ToggleInputProcessing,
|
||||
inputState == InputState::Active ? L"Pause &input processing" :
|
||||
inputState == InputState::Paused ? L"Resume &input processing" : L"Pausing input processing…");
|
||||
AppendMenuW(menu, MF_STRING, ResetHeldInput, PRIMARYLANGID(GetThreadUILanguage()) == LANG_UKRAINIAN ?
|
||||
append(NavigationIcon::Reset, MF_STRING, ResetHeldInput, PRIMARYLANGID(GetThreadUILanguage()) == LANG_UKRAINIAN ?
|
||||
L"Скинути затиснуті клавіші й кнопки миші" : L"Reset held keys and mouse buttons");
|
||||
AppendMenuW(menu, MF_SEPARATOR, 0, nullptr);
|
||||
AppendMenuW(menu, MF_STRING, 10, L"Clipboard &history");
|
||||
AppendMenuW(menu, MF_STRING, 24, L"&Capture screen region…");
|
||||
AppendMenuW(menu, MF_STRING, 11, L"&Settings…");
|
||||
AppendMenuW(menu, MF_STRING, OpenFiles, L"&Files…");
|
||||
append(NavigationIcon::History, MF_STRING, 10, L"Clipboard &history");
|
||||
append(NavigationIcon::Capture, MF_STRING, 24, L"&Capture screen region…");
|
||||
append(NavigationIcon::Gear, MF_STRING, 11, L"&Settings…");
|
||||
append(NavigationIcon::Folder, MF_STRING, OpenFiles, L"&Files…");
|
||||
SetMenuDefaultItem(menu, 11, FALSE);
|
||||
AppendMenuW(menu, MF_STRING, 12, L"S&nippets…");
|
||||
AppendMenuW(menu, MF_STRING, 13, L"&Keyboard shortcuts…");
|
||||
append(NavigationIcon::Snippet, MF_STRING, 12, L"S&nippets…");
|
||||
append(NavigationIcon::Keyboard, MF_STRING, 13, L"&Keyboard shortcuts…");
|
||||
HMENU utilityMenu = CreatePopupMenu();
|
||||
for (size_t i = 0; i < utilities.size(); ++i)
|
||||
AppendMenuW(utilityMenu, MF_STRING, utilityCommandBase + i, utilityMenuLabel(utilities[i]).c_str());
|
||||
if (utilities.empty())
|
||||
AppendMenuW(utilityMenu, MF_STRING | MF_GRAYED, 0,
|
||||
utilitiesError ? L"Cannot read tools folder" : L"No utilities in tools folder");
|
||||
AppendMenuW(menu, MF_POPUP, (UINT_PTR)utilityMenu, L"&Tools");
|
||||
append(NavigationIcon::Tools, MF_POPUP, (UINT_PTR)utilityMenu, L"&Tools");
|
||||
AppendMenuW(menu, MF_SEPARATOR, 0, nullptr);
|
||||
AppendMenuW(menu, MF_STRING | (settings.awake ? MF_CHECKED : 0), 14, L"Keep screen a&wake");
|
||||
append(NavigationIcon::Sun, MF_STRING | (settings.awake ? MF_CHECKED : 0), 14, L"Keep screen a&wake");
|
||||
HMENU pause = CreatePopupMenu();
|
||||
AppendMenuW(pause, MF_STRING, 20, L"&Resume");
|
||||
AppendMenuW(pause, MF_STRING, 21, L"&10 minutes");
|
||||
AppendMenuW(pause, MF_STRING, 22, L"1 &hour");
|
||||
AppendMenuW(pause, MF_STRING, 23, L"&Until restart");
|
||||
AppendMenuW(menu, MF_POPUP, (UINT_PTR)pause, L"&Pause clipboard history");
|
||||
AppendMenuW(menu, MF_STRING, 15, L"&Open data folder");
|
||||
AppendMenuW(menu, MF_STRING, 18, L"View &log…");
|
||||
AppendMenuW(menu, MF_STRING | (updateRunning ? MF_GRAYED : 0), 19,
|
||||
append(NavigationIcon::ClipPause, MF_POPUP, (UINT_PTR)pause, L"&Pause clipboard history");
|
||||
append(NavigationIcon::FolderOpen, MF_STRING, 15, L"&Open data folder");
|
||||
append(NavigationIcon::Log, MF_STRING, 18, L"View &log…");
|
||||
append(NavigationIcon::Update, MF_STRING | (updateRunning ? MF_GRAYED : 0), 19,
|
||||
updateRunning ? L"&Update (checking / preparing…)" :
|
||||
availableUpdate.empty() ? L"&Update" : L"&Update (new version available)");
|
||||
AppendMenuW(menu, MF_SEPARATOR, 0, nullptr);
|
||||
AppendMenuW(menu, MF_STRING, DonateViaMonobank, L"&Donate via Monobank");
|
||||
const int iconSize = MulDiv(16, GetDpiForWindow(window), 96);
|
||||
const auto donateIcon = static_cast<HICON>(LoadImageW(instance, MAKEINTRESOURCEW(IDI_KSWITCHER_DONATE),
|
||||
IMAGE_ICON, iconSize, iconSize, LR_SHARED));
|
||||
const auto donateBitmap = trayIconBitmap(donateIcon, iconSize, iconSize);
|
||||
if (donateBitmap)
|
||||
{
|
||||
MENUITEMINFOW item{sizeof(item), MIIM_BITMAP};
|
||||
item.hbmpItem = donateBitmap;
|
||||
SetMenuItemInfoW(menu, DonateViaMonobank, FALSE, &item);
|
||||
}
|
||||
append(NavigationIcon::Coffee, MF_STRING, DonateViaMonobank, L"&Donate via Monobank");
|
||||
AppendMenuW(menu, MF_SEPARATOR, 0, nullptr);
|
||||
HMENU help = CreatePopupMenu();
|
||||
AppendMenuW(help, MF_STRING, OpenHelp, L"&User guide");
|
||||
AppendMenuW(help, MF_STRING, OpenWhatsNew, whatsNewTitle(GetThreadUILanguage()));
|
||||
AppendMenuW(help, MF_STRING, OpenAbout, L"&About KSwitcher");
|
||||
AppendMenuW(menu, MF_POPUP, reinterpret_cast<UINT_PTR>(help), L"H&elp");
|
||||
AppendMenuW(menu, MF_STRING, 17, L"E&xit");
|
||||
POINT pt{};
|
||||
GetCursorPos(&pt);
|
||||
append(NavigationIcon::Help, MF_POPUP, reinterpret_cast<UINT_PTR>(help), L"H&elp");
|
||||
append(NavigationIcon::Exit, MF_STRING, 17, L"E&xit");
|
||||
pasteTarget = GetForegroundWindow();
|
||||
SetForegroundWindow(window);
|
||||
showMenuAccessKeys(menu);
|
||||
int cmd = TrackPopupMenu(menu, TPM_RETURNCMD | TPM_RIGHTBUTTON, pt.x, pt.y, 0, window, nullptr);
|
||||
DestroyMenu(menu);
|
||||
if (donateBitmap) DeleteObject(donateBitmap);
|
||||
for (const auto bitmap : bitmaps) DeleteObject(bitmap);
|
||||
PostMessageW(window, WM_NULL, 0, 0);
|
||||
try
|
||||
{
|
||||
@@ -3570,12 +3566,8 @@ void App::trayMenu()
|
||||
toggleInputProcessing();
|
||||
break;
|
||||
case ResetHeldInput:
|
||||
if (lan::resetWindowsHeldInput())
|
||||
{
|
||||
if (lanService) lanService->forgetHeldInput();
|
||||
clearMousePresses();
|
||||
}
|
||||
else report(L"Windows could not release all held keys or mouse buttons.");
|
||||
if (!resetHeldInput()) report(L"Windows could not release all held keys or mouse buttons on this PC.");
|
||||
if (lanService) lanService->requestHeldInputReset();
|
||||
break;
|
||||
case OpenFiles:
|
||||
dispatch(OpenFiles);
|
||||
|
||||
@@ -190,6 +190,7 @@ class App
|
||||
void refreshTrayInput();
|
||||
void refreshTrayInputBlock();
|
||||
void clearMousePresses();
|
||||
bool resetHeldInput();
|
||||
uint64_t transformAttempt{}, previousAttemptVersion{};
|
||||
std::atomic<uint64_t> activeTransformAttempt{};
|
||||
ULONGLONG previousAttemptAt{};
|
||||
|
||||
@@ -271,7 +271,7 @@ struct LanService::Impl
|
||||
bool changed=revision!=observedRevision||configuration!=observedConfiguration;
|
||||
observedRevision=revision;observedConfiguration=configuration;return changed;
|
||||
}
|
||||
bool tickInput(bool allowEnter)
|
||||
bool tickInput(bool allowEnter,const std::function<void()> &resetHeldInput)
|
||||
{
|
||||
inputNotification=false;
|
||||
if(layoutChanged.exchange(false)){std::lock_guard lock(mutex);configureRouter();}
|
||||
@@ -280,8 +280,17 @@ struct LanService::Impl
|
||||
std::vector<lan::RoutedInput> incoming;std::map<std::string,uint64_t> ready;
|
||||
{std::lock_guard lock(inputMutex);incoming.swap(inputIn);ready=inputReady;}
|
||||
router->tick(ready,GetTickCount64());
|
||||
for(auto &frame:incoming)if(ready.contains(frame.peer)&&ready.at(frame.peer)==frame.epoch)
|
||||
router->receive(frame.peer,frame.frame,GetTickCount64(),allowEnter);
|
||||
for(auto &frame:incoming)
|
||||
{
|
||||
if(!ready.contains(frame.peer)||ready.at(frame.peer)!=frame.epoch)continue;
|
||||
if(frame.frame==lan::ResetHeldInputRequest)
|
||||
{
|
||||
// A peer may have been forgotten since the transport queued its request.
|
||||
std::lock_guard lock(mutex);
|
||||
if(!trusted.contains(frame.peer))continue;
|
||||
}
|
||||
router->receive(frame.peer,frame.frame,GetTickCount64(),allowEnter,resetHeldInput);
|
||||
}
|
||||
return takeChange();
|
||||
}
|
||||
std::wstring inputBlockText(const lan::HandoffBlock &block) const
|
||||
@@ -911,7 +920,8 @@ LanInputConnections LanService::inputConnections()const
|
||||
const auto paired=impl->trusted.size();
|
||||
return {std::min(impl->inputConnectedPeers,paired),std::min(impl->inputOnlinePeers,paired),paired,impl->inputWorkerStopped};
|
||||
}
|
||||
bool LanService::tickInput(bool allowEnter){return impl->tickInput(allowEnter);}
|
||||
bool LanService::tickInput(bool allowEnter,const std::function<void()> &resetHeldInput)
|
||||
{return impl->tickInput(allowEnter,resetHeldInput);}
|
||||
std::wstring LanService::inputBlockText()const
|
||||
{
|
||||
const auto block=impl->router?impl->router->handoffBlock():lan::HandoffBlock{};
|
||||
@@ -919,7 +929,17 @@ std::wstring LanService::inputBlockText()const
|
||||
std::lock_guard lock(impl->mutex);
|
||||
return impl->inputBlockText(block);
|
||||
}
|
||||
void LanService::forgetHeldInput(){if(impl->router)impl->router->forgetHeldKeys();}
|
||||
void LanService::forgetHeldInput()
|
||||
{
|
||||
if(!impl->router)return;
|
||||
if(impl->router->mode()!=lan::ControlMode::Local)impl->router->cancel(GetTickCount64());
|
||||
impl->router->forgetHeldKeys();
|
||||
}
|
||||
void LanService::requestHeldInputReset()
|
||||
{
|
||||
std::lock_guard lock(impl->mutex);
|
||||
if(impl->router)impl->router->requestHeldInputReset([this](const auto &peer){return impl->trusted.contains(peer);});
|
||||
}
|
||||
bool LanService::keyboard(const KBDLLHOOKSTRUCT &k,bool down){return impl->router&&impl->router->keyboard(k,down,GetTickCount64());}
|
||||
bool LanService::mouse(UINT message,const MSLLHOOKSTRUCT &m,bool allowEnter){return impl->router&&impl->router->mouse(message,m,GetTickCount64(),allowEnter);}
|
||||
bool LanService::takeInputChange(){return impl->takeChange();}
|
||||
|
||||
@@ -34,7 +34,8 @@ class LanService
|
||||
LanInputConnections inputConnections() const;
|
||||
std::wstring inputBlockText() const;
|
||||
void forgetHeldInput();
|
||||
bool tickInput(bool allowEnter = true);
|
||||
void requestHeldInputReset();
|
||||
bool tickInput(bool allowEnter = true, const std::function<void()> &resetHeldInput = {});
|
||||
bool keyboard(const KBDLLHOOKSTRUCT &, bool down);
|
||||
bool mouse(UINT, const MSLLHOOKSTRUCT &, bool allowEnter);
|
||||
bool takeInputChange();
|
||||
|
||||
@@ -13,6 +13,8 @@ struct InputFrame
|
||||
int32_t a{},b{},c{};
|
||||
bool operator==(const InputFrame &) const = default;
|
||||
};
|
||||
// A Return with no ownership token is ignored by older input routers.
|
||||
inline constexpr InputFrame ResetHeldInputRequest{InputType::Return,0,-2};
|
||||
// Collapse only contiguous, not-yet-delivered wheel events. A reversal replaces
|
||||
// stale queued motion; key/button boundaries must never be crossed.
|
||||
inline void enqueueInput(std::vector<InputFrame> &queue,const InputFrame &frame)
|
||||
|
||||
@@ -58,6 +58,11 @@ class InputMesh
|
||||
return {};
|
||||
}
|
||||
void forgetHeldKeys(){router.forgetHeldKeys();}
|
||||
void requestHeldInputReset(const std::function<bool(const std::string &)> &isPaired)
|
||||
{
|
||||
for(const auto &[peer,generation]:ready)
|
||||
if(isPaired(peer))send(peer,ResetHeldInputRequest);
|
||||
}
|
||||
void cancel(uint64_t now){router.cancel(now);}
|
||||
void tick(std::map<std::string,uint64_t> connections,uint64_t now)
|
||||
{
|
||||
@@ -83,9 +88,16 @@ class InputMesh
|
||||
else ++it;
|
||||
}
|
||||
}
|
||||
void receive(const std::string &peer,const InputFrame &f,uint64_t now,bool allowEnter=true)
|
||||
void receive(const std::string &peer,const InputFrame &f,uint64_t now,bool allowEnter=true,
|
||||
const std::function<void()> &resetHeldInput={})
|
||||
{
|
||||
if(!ready.contains(peer)||!positions.contains(peer))return;
|
||||
if(!ready.contains(peer))return;
|
||||
if(f==ResetHeldInputRequest)
|
||||
{
|
||||
if(allowEnter&&resetHeldInput)resetHeldInput();
|
||||
return;
|
||||
}
|
||||
if(!positions.contains(peer))return;
|
||||
if(f.type==InputType::Return)
|
||||
{
|
||||
const bool held=f.b>0&&f.b<=UnknownHeldInput;
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
|
||||
namespace ks
|
||||
{
|
||||
enum class NavigationIcon
|
||||
{
|
||||
#define NAVIGATION_ICON(name, id, file) name = id,
|
||||
#include "../resources/navigation_icons.inc"
|
||||
#undef NAVIGATION_ICON
|
||||
};
|
||||
|
||||
inline HBITMAP iconBitmap(HICON icon, int width, int height, void **data = nullptr)
|
||||
{
|
||||
if (!icon || width < 1 || height < 1) return nullptr;
|
||||
BITMAPINFO info{};
|
||||
info.bmiHeader = {sizeof(BITMAPINFOHEADER), width, -height, 1, 32, BI_RGB};
|
||||
void *bits{};
|
||||
const HBITMAP bitmap = CreateDIBSection(nullptr, &info, DIB_RGB_COLORS, &bits, nullptr, 0);
|
||||
if (!bitmap) return nullptr;
|
||||
BOOL drawn = FALSE;
|
||||
if (const HDC dc = CreateCompatibleDC(nullptr))
|
||||
{
|
||||
const auto previous = SelectObject(dc, bitmap);
|
||||
std::fill_n(static_cast<std::uint32_t *>(bits), static_cast<std::size_t>(width) * height, 0);
|
||||
drawn = DrawIconEx(dc, 0, 0, icon, width, height, 0, nullptr, DI_NORMAL);
|
||||
GdiFlush();
|
||||
SelectObject(dc, previous);
|
||||
DeleteDC(dc);
|
||||
}
|
||||
if (drawn)
|
||||
{
|
||||
if (data) *data = bits;
|
||||
return bitmap;
|
||||
}
|
||||
DeleteObject(bitmap);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline HBITMAP navigationIconBitmap(HINSTANCE instance, NavigationIcon icon, int size, COLORREF color)
|
||||
{
|
||||
const auto source = static_cast<HICON>(LoadImageW(instance, MAKEINTRESOURCEW(static_cast<int>(icon)),
|
||||
IMAGE_ICON, size, size, 0));
|
||||
void *bits{};
|
||||
const auto bitmap = iconBitmap(source, size, size, &bits);
|
||||
if (source) DestroyIcon(source);
|
||||
if (!bitmap) return nullptr;
|
||||
auto *pixels = static_cast<std::uint32_t *>(bits);
|
||||
for (int i = 0; i < size * size; ++i)
|
||||
{
|
||||
const auto alpha = pixels[i] >> 24;
|
||||
const auto channel = [alpha](unsigned value) { return (value * alpha + 127) / 255; };
|
||||
pixels[i] = alpha << 24 | channel(GetRValue(color)) << 16 |
|
||||
channel(GetGValue(color)) << 8 | channel(GetBValue(color));
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
inline constexpr COLORREF NavigationIconColor = RGB(69, 92, 126);
|
||||
inline constexpr COLORREF NavigationIconAccent = RGB(84, 66, 216);
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "diagnostics.h"
|
||||
#include "google_drive.h"
|
||||
#include "update.h"
|
||||
#include "navigation_icons.h"
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
@@ -1118,8 +1119,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();
|
||||
@@ -1281,7 +1286,7 @@ constexpr int OcrUseTesseract = 501, OcrExecutable = 502, OcrLanguages = 503, Oc
|
||||
OcrCheck = 505, OcrStatus = 506, OcrDownload = 507;
|
||||
constexpr int DriveAutomatic = 625;
|
||||
constexpr UINT CollapseSettingsGroupMessage = WM_APP + 188;
|
||||
constexpr int SettingsSidebarWidth = 214, SettingsHeaderHeight = 82, SettingsFooterHeight = 76;
|
||||
constexpr int SettingsSidebarWidth = 256, SettingsHeaderHeight = 82, SettingsFooterHeight = 76;
|
||||
constexpr int SettingsNavigationIndent = 16;
|
||||
constexpr int SettingsSplitter = 270, SettingsSplitterWidth = 8;
|
||||
constexpr int SettingsSidebarMin = 164, SettingsSidebarMax = 420, SettingsPaneMin = 320;
|
||||
@@ -1291,30 +1296,31 @@ constexpr struct SettingsSection
|
||||
{
|
||||
const char *key;
|
||||
const wchar_t *name, *description;
|
||||
NavigationIcon icon;
|
||||
int parent = -1;
|
||||
} settingsSections[] = {
|
||||
{"general", L"General", L"Configure text conversion and how KSwitcher runs on Windows."},
|
||||
{"languages", L"Languages", L"Order layouts from top to bottom and override the cycle for individual chats or apps."},
|
||||
{"shortcuts", L"Shortcuts", L"Click a shortcut field and press the desired keys. Backspace or Delete clears it."},
|
||||
{"clipboard", L"Clipboard", L"Configure clipboard history, storage limits and excluded applications."},
|
||||
{"snippets", L"Snippets", L"Create text expansions and choose which applications can use them."},
|
||||
{"mouse", L"Mouse", L"Manage profiles, assign actions and test your mouse buttons."},
|
||||
{"sync", L"Sync", L"Choose a provider to back up or synchronize your settings."},
|
||||
{"computers", L"Computers", L"Share mouse and keyboard with paired computers."},
|
||||
{"diagnostics", L"Diagnostics", L"Manage diagnostic logging and view recent operations."},
|
||||
{"mcp", L"MCP", L"Connect Codex to KSwitcher to read diagnostic logs."},
|
||||
{"manage-computers", L"Manage computers", L"Pair computers, arrange their screens and manage input sharing.", ComputersPage},
|
||||
{"correction", L"Correction options", L"Choose a subsection to configure automatic correction.", GeneralPage},
|
||||
{"offline-dictionaries", L"Offline dictionaries", L"Choose dictionary languages and set limits for automatic correction.", CorrectionPage},
|
||||
{"correction-exceptions", L"Exceptions", L"Exclude applications and words from automatic correction.", CorrectionPage},
|
||||
{"personal-dictionaries", L"Personal dictionaries", L"Separate words with commas or new lines. Internal hyphens are allowed.", CorrectionPage},
|
||||
{"word-boundaries", L"Word boundaries", L"Choose which punctuation KSwitcher keeps before and after a corrected word.", CorrectionPage},
|
||||
{"custom-replacements", L"Custom replacements", L"Define your own corrections, which take priority over dictionary suggestions.", CorrectionPage},
|
||||
{"openbao", L"OpenBao", L"Connect to OpenBao and synchronize your saved settings.", SyncPage},
|
||||
{"google-drive", L"Google Drive", L"Synchronize settings across PCs or manage manual backups.", SyncPage},
|
||||
{"ocr", L"Image text recognition", L"Choose Windows OCR or Tesseract. Recognition runs on this computer.", ClipboardPage},
|
||||
{"chat-languages", L"Languages for a chat", L"Choose which keyboard layouts to cycle through in a chat.", LanguagesPage},
|
||||
{"custom-shortcuts", L"Custom shortcuts", L"Assign global keyboard shortcuts to actions in other apps.", ShortcutsPage},
|
||||
{"general", L"General", L"Configure text conversion and how KSwitcher runs on Windows.", NavigationIcon::Gear},
|
||||
{"languages", L"Languages", L"Order layouts from top to bottom and override the cycle for individual chats or apps.", NavigationIcon::Globe},
|
||||
{"shortcuts", L"Shortcuts", L"Click a shortcut field and press the desired keys. Backspace or Delete clears it.", NavigationIcon::Keyboard},
|
||||
{"clipboard", L"Clipboard", L"Configure clipboard history, storage limits and excluded applications.", NavigationIcon::Clip},
|
||||
{"snippets", L"Snippets", L"Create text expansions and choose which applications can use them.", NavigationIcon::Snippet},
|
||||
{"mouse", L"Mouse", L"Manage profiles, assign actions and test your mouse buttons.", NavigationIcon::Mouse},
|
||||
{"sync", L"Sync", L"Choose a provider to back up or synchronize your settings.", NavigationIcon::Sync},
|
||||
{"computers", L"Computers", L"Share mouse and keyboard with paired computers.", NavigationIcon::Computers},
|
||||
{"diagnostics", L"Diagnostics", L"Manage diagnostic logging and view recent operations.", NavigationIcon::Pulse},
|
||||
{"mcp", L"MCP", L"Connect Codex to KSwitcher to read diagnostic logs.", NavigationIcon::Connect},
|
||||
{"manage-computers", L"Manage computers", L"Pair computers, arrange their screens and manage input sharing.", NavigationIcon::Manage, ComputersPage},
|
||||
{"correction", L"Correction options", L"Choose a subsection to configure automatic correction.", NavigationIcon::Check, GeneralPage},
|
||||
{"offline-dictionaries", L"Offline dictionaries", L"Choose dictionary languages and set limits for automatic correction.", NavigationIcon::Book, CorrectionPage},
|
||||
{"correction-exceptions", L"Exceptions", L"Exclude applications and words from automatic correction.", NavigationIcon::Ban, CorrectionPage},
|
||||
{"personal-dictionaries", L"Personal dictionaries", L"Separate words with commas or new lines. Internal hyphens are allowed.", NavigationIcon::Personal, CorrectionPage},
|
||||
{"word-boundaries", L"Word boundaries", L"Choose which punctuation KSwitcher keeps before and after a corrected word.", NavigationIcon::Bounds, CorrectionPage},
|
||||
{"custom-replacements", L"Custom replacements", L"Define your own corrections, which take priority over dictionary suggestions.", NavigationIcon::Replace, CorrectionPage},
|
||||
{"openbao", L"OpenBao", L"Connect to OpenBao and synchronize your saved settings.", NavigationIcon::Vault, SyncPage},
|
||||
{"google-drive", L"Google Drive", L"Synchronize settings across PCs or manage manual backups.", NavigationIcon::Drive, SyncPage},
|
||||
{"ocr", L"Image text recognition", L"Choose Windows OCR or Tesseract. Recognition runs on this computer.", NavigationIcon::Scan, ClipboardPage},
|
||||
{"chat-languages", L"Languages for a chat", L"Choose which keyboard layouts to cycle through in a chat.", NavigationIcon::Chat, LanguagesPage},
|
||||
{"custom-shortcuts", L"Custom shortcuts", L"Assign global keyboard shortcuts to actions in other apps.", NavigationIcon::Command, ShortcutsPage},
|
||||
};
|
||||
constexpr wchar_t SettingsWindowFile[] = L"configurator-window.json";
|
||||
struct SettingsWindowState
|
||||
@@ -1401,6 +1407,7 @@ struct SettingsView
|
||||
std::optional<int> splitterDragOffset;
|
||||
bool splitterHovered{};
|
||||
std::array<HTREEITEM, std::size(settingsSections)> navigationItems{};
|
||||
HIMAGELIST navigationIcons{};
|
||||
struct SearchEntry { int page; HWND caption, target; std::wstring title, aliases; bool matched{}; };
|
||||
std::vector<SearchEntry> searchEntries;
|
||||
std::optional<size_t> activeSearchEntry;
|
||||
@@ -2066,11 +2073,40 @@ void selectSettingsPage(SettingsView &v, int selected)
|
||||
for (size_t i = page.first; i < page.end; ++i) ShowWindow(layout.controls[i].first, SW_SHOWNA);
|
||||
InvalidateRect(v.viewport, nullptr, TRUE);
|
||||
}
|
||||
void refreshSettingsNavigationIcons(SettingsView &v, UINT dpi)
|
||||
{
|
||||
constexpr int count = static_cast<int>(std::size(settingsSections));
|
||||
const int size = MulDiv(16, dpi, USER_DEFAULT_SCREEN_DPI);
|
||||
const auto images = ImageList_Create(size, size, ILC_COLOR32, 2 * (count + 1), 0);
|
||||
if (!images) return;
|
||||
for (bool selected : {false, true})
|
||||
{
|
||||
const COLORREF color = v.palette.highContrast ?
|
||||
GetSysColor(selected ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT) :
|
||||
selected ? NavigationIconAccent : NavigationIconColor;
|
||||
for (int page = 0; page <= count; ++page)
|
||||
{
|
||||
const auto icon = page == count ? NavigationIcon::Search : settingsSections[page].icon;
|
||||
const auto bitmap = navigationIconBitmap(v.app->instance, icon, size, color);
|
||||
const int index = bitmap ? ImageList_Add(images, bitmap, nullptr) : -1;
|
||||
if (bitmap) DeleteObject(bitmap);
|
||||
if (index < 0)
|
||||
{
|
||||
ImageList_Destroy(images);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
TreeView_SetImageList(v.navigation, images, TVSIL_NORMAL);
|
||||
if (v.navigationIcons) ImageList_Destroy(v.navigationIcons);
|
||||
v.navigationIcons = images;
|
||||
}
|
||||
void refreshSettingsColors(HWND w, SettingsView &v, std::optional<DWORD> colorization = std::nullopt)
|
||||
{
|
||||
v.palette.refresh(colorization);
|
||||
TreeView_SetBkColor(v.navigation, v.palette.color());
|
||||
TreeView_SetTextColor(v.navigation, GetSysColor(COLOR_WINDOWTEXT));
|
||||
refreshSettingsNavigationIcons(v, GetDpiForWindow(w));
|
||||
RedrawWindow(w, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN);
|
||||
}
|
||||
void paintSettings(HWND w, const SettingsView &v)
|
||||
@@ -2100,7 +2136,11 @@ HTREEITEM addSettingsNode(HWND tree, HTREEITEM parent, const wchar_t *title, LPA
|
||||
TVINSERTSTRUCTW node{};
|
||||
node.hParent = parent;
|
||||
node.hInsertAfter = TVI_LAST;
|
||||
node.item.mask = TVIF_TEXT | TVIF_PARAM;
|
||||
node.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
||||
constexpr int count = static_cast<int>(std::size(settingsSections));
|
||||
const int image = data >= 0 && data < count ? static_cast<int>(data) : count;
|
||||
node.item.iImage = image;
|
||||
node.item.iSelectedImage = image + count + 1;
|
||||
node.item.pszText = const_cast<wchar_t *>(title);
|
||||
node.item.lParam = data;
|
||||
return TreeView_InsertItem(tree, &node);
|
||||
@@ -2499,6 +2539,7 @@ void resizeSettingsForDpi(HWND w, int previousDpi, int nextDpi)
|
||||
auto &v = *reinterpret_cast<SettingsView *>(GetWindowLongPtrW(w, GWLP_USERDATA));
|
||||
if (!v.ready) return;
|
||||
setSettingsFonts(w, v, nextDpi);
|
||||
refreshSettingsNavigationIcons(v, nextDpi);
|
||||
auto &layout = *windowLayoutState(v.viewport);
|
||||
layout.x = MulDiv(layout.x, nextDpi, previousDpi);
|
||||
layout.y = MulDiv(layout.y, nextDpi, previousDpi);
|
||||
@@ -3300,6 +3341,7 @@ LRESULT CALLBACK settingsProc(HWND w, UINT msg, WPARAM wp, LPARAM lp)
|
||||
saveSettingsWindowState(w, *v);
|
||||
break;
|
||||
case WM_NCDESTROY:
|
||||
if (v->navigationIcons) ImageList_Destroy(v->navigationIcons);
|
||||
if (v->rawMouseRegistered) registerMouseTestInput(nullptr);
|
||||
for (HICON icon : v->mouseProfileChecks)
|
||||
if (icon) DestroyIcon(icon);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "platform.h"
|
||||
namespace ks
|
||||
{
|
||||
inline constexpr wchar_t AppVersion[] = L"0.8.13";
|
||||
inline constexpr wchar_t AppVersion[] = L"0.8.15";
|
||||
inline constexpr UINT UpdateMessage = WM_APP + 7;
|
||||
inline constexpr UINT UpdateCheckIntervalMs = 6 * 60 * 60 * 1000;
|
||||
inline constexpr UINT UpdateNotificationRetryMs = 5 * 60 * 1000;
|
||||
|
||||
@@ -336,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);
|
||||
@@ -350,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; };
|
||||
@@ -385,6 +401,36 @@ static void historyLayoutChecks(ks::App &app, const std::filesystem::path &temp,
|
||||
}
|
||||
DestroyWindow(history);
|
||||
}
|
||||
struct NavigationIconProbe
|
||||
{
|
||||
int commands{}, visibleIcons{}, submenus{};
|
||||
};
|
||||
|
||||
LRESULT CALLBACK inspectTrayMenu(HWND window, UINT message, WPARAM wp, LPARAM lp, UINT_PTR, DWORD_PTR data)
|
||||
{
|
||||
auto &probe = *reinterpret_cast<NavigationIconProbe *>(data);
|
||||
if (message == WM_INITMENUPOPUP && !probe.commands)
|
||||
{
|
||||
const auto menu = reinterpret_cast<HMENU>(wp);
|
||||
for (int i = 0; i < GetMenuItemCount(menu); ++i)
|
||||
{
|
||||
MENUITEMINFOW item{sizeof(item), MIIM_FTYPE | MIIM_BITMAP | MIIM_SUBMENU};
|
||||
if (!GetMenuItemInfoW(menu, i, TRUE, &item) || (item.fType & MFT_SEPARATOR)) continue;
|
||||
++probe.commands;
|
||||
if (item.hSubMenu) ++probe.submenus;
|
||||
DIBSECTION bitmap{};
|
||||
if (!item.hbmpItem || GetObjectW(item.hbmpItem, sizeof(bitmap), &bitmap) != sizeof(bitmap))
|
||||
continue;
|
||||
const auto *pixels = static_cast<const std::uint32_t *>(bitmap.dsBm.bmBits);
|
||||
if (pixels && std::any_of(pixels, pixels + bitmap.dsBm.bmWidth * bitmap.dsBm.bmHeight,
|
||||
[](std::uint32_t pixel) { return (pixel >> 24) != 0; }))
|
||||
++probe.visibleIcons;
|
||||
}
|
||||
}
|
||||
if (message == WM_ENTERIDLE && wp == MSGF_MENU) EndMenu();
|
||||
return DefSubclassProc(window, message, wp, lp);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc == 2 && std::string(argv[1]) == "--input-pause") return testInputPause();
|
||||
if (argc == 2 && std::string(argv[1]) == "--input-pause-resident") {
|
||||
@@ -414,6 +460,71 @@ int main(int argc, char **argv) {
|
||||
try {
|
||||
INITCOMMONCONTROLSEX controls{sizeof(controls),ICC_STANDARD_CLASSES|ICC_LISTVIEW_CLASSES};
|
||||
InitCommonControlsEx(&controls);
|
||||
if ((argc == 2 || argc == 3) && std::string_view(argv[1]) == "--navigation-icons")
|
||||
{
|
||||
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
|
||||
{
|
||||
ks::App app(GetModuleHandleW(nullptr), true, temp);
|
||||
ks::showSettings(app, false);
|
||||
const auto settings = app.settingsWindow;
|
||||
const auto tree = settingsNavigation(settings);
|
||||
const int pages = TreeView_GetCount(tree);
|
||||
require(pages == 22, "all Settings sections are listed");
|
||||
const auto images = TreeView_GetImageList(tree, TVSIL_NORMAL);
|
||||
require(images && ImageList_GetImageCount(images) >= 2 * pages, "normal and selected icons are loaded");
|
||||
for (int page = 0; page < pages; ++page)
|
||||
{
|
||||
TVITEMW item{};
|
||||
item.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
||||
item.hItem = settingsSection(tree, page);
|
||||
require(item.hItem && TreeView_GetItem(tree, &item) && item.iImage >= 0 &&
|
||||
item.iImage < pages && item.iSelectedImage >= pages,
|
||||
"each Settings section has both icon states");
|
||||
}
|
||||
NavigationIconProbe probe;
|
||||
if (argc == 3)
|
||||
{
|
||||
const std::filesystem::path previewDirectory(ks::wide(argv[2]));
|
||||
std::filesystem::create_directories(previewDirectory);
|
||||
RECT frame{};
|
||||
GetWindowRect(settings, &frame);
|
||||
MONITORINFO monitor{sizeof(monitor)};
|
||||
if (GetMonitorInfoW(MonitorFromWindow(settings, MONITOR_DEFAULTTONEAREST), &monitor))
|
||||
{
|
||||
const int height = std::min<int>(monitor.rcWork.bottom - monitor.rcWork.top,
|
||||
MulDiv(900, GetDpiForWindow(settings), USER_DEFAULT_SCREEN_DPI));
|
||||
SetWindowPos(settings, nullptr, frame.left, std::min<int>(frame.top, monitor.rcWork.bottom - height),
|
||||
frame.right - frame.left, height, SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
}
|
||||
selectSettingsPage(settings, 12);
|
||||
ShowWindow(settings, SW_SHOWNOACTIVATE);
|
||||
RedrawWindow(settings, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
|
||||
RECT client{};
|
||||
GetClientRect(settings, &client);
|
||||
if (const auto dc = GetDC(settings))
|
||||
{
|
||||
const auto capture = ks::screenshotClip(dc, client.right, client.bottom, {});
|
||||
ReleaseDC(settings, dc);
|
||||
ks::atomicWrite(previewDirectory / L"settings-navigation.png",
|
||||
ks::encodePng(ks::decodeImage(capture)));
|
||||
}
|
||||
}
|
||||
app.window = CreateWindowExW(WS_EX_TOOLWINDOW, L"STATIC", L"", WS_POPUP,
|
||||
0, 0, 1, 1, nullptr, nullptr, app.instance, nullptr);
|
||||
require(app.window && SetWindowSubclass(app.window, inspectTrayMenu, 1,
|
||||
reinterpret_cast<DWORD_PTR>(&probe)), "can inspect native tray popup");
|
||||
app.trayMenu();
|
||||
require(probe.commands == 17 && probe.visibleIcons == probe.commands && probe.submenus == 3,
|
||||
"all tray commands and submenu parents have visible icon pixels");
|
||||
DestroyWindow(app.window);
|
||||
app.window = nullptr;
|
||||
DestroyWindow(settings);
|
||||
}
|
||||
CoUninitialize();
|
||||
std::filesystem::remove_all(temp);
|
||||
std::cout << "Passed " << checks << " navigation icon checks\n";
|
||||
return 0;
|
||||
}
|
||||
if (argc == 3 && std::string_view(argv[1]) == "--custom-shortcut-layout")
|
||||
{
|
||||
{
|
||||
|
||||
@@ -250,6 +250,7 @@ struct MeshFixture
|
||||
struct Message{std::string from,to;InputFrame frame;};
|
||||
std::deque<Message> messages;Desktop desktops[3];std::unique_ptr<InputMesh> meshes[3];uint64_t now=1000;
|
||||
std::map<std::string,uint64_t> connections[3];
|
||||
std::array<int,3> resets{};
|
||||
MeshFixture(bool vertical=false){
|
||||
POINT cells[3]={{0,0},{1,0},vertical?POINT{1,-1}:POINT{2,0}};
|
||||
for(int i=0;i<3;++i){
|
||||
@@ -260,7 +261,13 @@ struct MeshFixture
|
||||
}
|
||||
~MeshFixture(){for(auto &m:meshes)m.reset();}
|
||||
void pump(){for(int rounds=0;rounds<10;++rounds){
|
||||
while(!messages.empty()){auto m=messages.front();messages.pop_front();meshes[std::stoi(m.to)]->receive(m.from,m.frame,now);}
|
||||
while(!messages.empty()){
|
||||
auto m=messages.front();messages.pop_front();
|
||||
const int to=std::stoi(m.to);
|
||||
meshes[to]->receive(m.from,m.frame,now,true,[&,to]{
|
||||
++resets[to];desktops[to].heldKey=0;meshes[to]->forgetHeldKeys();
|
||||
});
|
||||
}
|
||||
for(int i=0;i<3;++i)meshes[i]->tick(connections[i],now);
|
||||
}}
|
||||
void move(int x,int y){++now;auto &d=desktops[0];auto old=d.point;MSLLHOOKSTRUCT m{};m.pt={old.x+x,old.y+y};d.point=m.pt;
|
||||
@@ -368,6 +375,49 @@ void heldInputReleaseChecks()
|
||||
"known blockers have readable names and unknown ones use the general message");
|
||||
check(heldInputReleases([](int){return false;}).empty(),"reset with no down inputs is a no-op");
|
||||
}
|
||||
void pairedInputResetChecks()
|
||||
{
|
||||
Desktop desktop;
|
||||
std::vector<std::pair<std::string,InputFrame>> sent;
|
||||
InputMesh mesh("local",desktop.environment(),{},[&](const auto &peer,auto frame){
|
||||
sent.emplace_back(peer,frame);return true;
|
||||
});
|
||||
mesh.tick({{"first",1},{"second",2},{"forgotten",3}},1000);
|
||||
mesh.requestHeldInputReset([](const auto &peer){return peer!="forgotten";});
|
||||
check(sent==std::vector<std::pair<std::string,InputFrame>>{
|
||||
{"first",ResetHeldInputRequest},{"second",ResetHeldInputRequest}},
|
||||
"one reset goes to every connected pair, including computers outside the monitor layout");
|
||||
|
||||
int resets=0;
|
||||
const auto reset=[&]{++resets;};
|
||||
mesh.receive("offline",ResetHeldInputRequest,1001,true,reset);
|
||||
mesh.receive("first",ResetHeldInputRequest,1002,false,reset);
|
||||
auto wrong=ResetHeldInputRequest;
|
||||
wrong.b=VK_TAB;
|
||||
mesh.receive("first",wrong,1003,true,reset);
|
||||
check(!resets,"offline, blocked, and malformed messages cannot reset this computer");
|
||||
mesh.receive("first",ResetHeldInputRequest,1004,true,reset);
|
||||
check(resets==1&&sent.size()==2,"an authenticated reset is applied locally without being forwarded");
|
||||
|
||||
Pair old(1);
|
||||
old.enter(1);
|
||||
old.right.receive(ResetHeldInputRequest,1200);
|
||||
check(old.right.mode()==ControlMode::Receiving&&old.ba.empty(),
|
||||
"legacy input routers ignore the zero-token reset even during remote control");
|
||||
|
||||
MeshFixture three;
|
||||
three.desktops[1].heldKey=VK_TAB;
|
||||
three.desktops[2].heldKey=VK_LBUTTON;
|
||||
three.desktops[0].point={798,300};
|
||||
three.move(1,0);
|
||||
check(three.meshes[0]->handoffBlock().peer=="1","the source sees the first destination block the handoff");
|
||||
three.meshes[0]->requestHeldInputReset([](const auto &){return true;});
|
||||
three.pump();
|
||||
check(three.resets==std::array{0,1,1}&&!three.meshes[0]->handoffBlock().key&&!three.desktops[2].heldKey,
|
||||
"one request clears the block and resets the other idle paired PC without another action");
|
||||
three.now+=650;
|
||||
three.enter();
|
||||
}
|
||||
uint16_t freePort()
|
||||
{
|
||||
SOCKET s=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);if(s==INVALID_SOCKET)throw std::runtime_error("test socket");
|
||||
@@ -562,6 +612,7 @@ void channelChecks()
|
||||
auto next=tx.encrypt({InputType::Move,37,-12,400});auto tampered=next;tampered[4]^=1;
|
||||
rejects([&]{rx.decrypt(tampered);},"ciphertext modification rejected");
|
||||
check(rx.decrypt(next)==InputFrame{InputType::Move,37,-12,400},"failed authentication does not expose or advance data");
|
||||
check(rx.decrypt(tx.encrypt(ResetHeldInputRequest))==ResetHeldInputRequest,"the reset request uses the authenticated input frame format");
|
||||
InputCipher wrong(inputSessionKey(secret,b,a,nb,na));rejects([&]{wrong.decrypt(packet);},"reflection across directions rejected");
|
||||
InputCipher otherSession(inputSessionKey(secret,a,b,randomHex(16),nb));rejects([&]{otherSession.decrypt(packet);},"old-session input rejected");
|
||||
WSADATA data{};if(WSAStartup(MAKEWORD(2,2),&data))throw std::runtime_error("WSAStartup");
|
||||
@@ -637,6 +688,6 @@ void channelChecks()
|
||||
}
|
||||
int main()
|
||||
{
|
||||
try{channelChecks();hubChecks();offlineDiscoveryChecks();fallbackChecks();datagramChecks();routerChecks();meshChecks();handoffBlockChecks();heldInputReleaseChecks();std::cout<<"Passed "<<passed<<" LAN input checks\n";}
|
||||
try{channelChecks();hubChecks();offlineDiscoveryChecks();fallbackChecks();datagramChecks();routerChecks();meshChecks();handoffBlockChecks();heldInputReleaseChecks();pairedInputResetChecks();std::cout<<"Passed "<<passed<<" LAN input checks\n";}
|
||||
catch(const std::exception &e){std::cerr<<"FAIL: "<<e.what()<<'\n';return 1;}
|
||||
}
|
||||