Skip to content

v1.4.0: rate-independent shake detection, overlay highlight, admin split - #5

Open
m7vn wants to merge 3 commits into
0cch:mainfrom
m7vn:arena/01a0aea1-shaketofindcursor
Open

m7vn wants to merge 3 commits into
0cch:mainfrom
m7vn:arena/01a0aea1-shaketofindcursor

Conversation

@m7vn

@m7vn m7vn commented Sep 17, 2026

Copy link
Copy Markdown

Detection was the weak point: the old algorithm counted direction changes in a fixed 40 ms bucket of mouse messages, so it fired on ordinary fast pointer motion, missed slow-but-large shakes, and its behaviour depended on how often the mouse happened to report. It also did its work inside the low-level mouse hook, where every microsecond is latency for every other application.

  • src/shake_detector.h: header-only detector driven by caller-supplied microsecond timestamps. Decimates to a fixed-rate ring buffer (so an 8 kHz gaming mouse costs the same as a 125 Hz one), then requires three reversals of >= 48 px within an amplitude window, a stroke-speed floor, a travel floor, and a recent last reversal. Cooldown, stall and teleport rejection are all in there. Sensitivity 1-100 maps to those thresholds; Gentle / Standard / Sharp presets sit at 20 / 55 / 85.
  • tests/shake_detector_test.cpp: 42 deterministic checks over synthetic pointer traces, runnable on any host (ctest or plain g++), including a copy of the v1.3 algorithm replayed on the same traces: v1.3 misses every shake at 250 Hz+ and reports 999 triggers for a mouse sitting still on a desk; the new detector fires 2x per shake and 0x on the jitter, dashes, curved sweeps, warps and wheel-only events.
  • Hook mode now only feeds samples; a recognised shake posts a message so SetSystemCursor and painting run on the message loop instead. Polling mode (--poll) remains the no-hook fallback, and the animation timer is killed while idle rather than spinning at 16 ms forever.
  • New click-through overlay (ripple rings or a dimming spotlight) rendered on its own thread with UpdateLayeredWindow. This is the part that works without administrator rights, so the app is now useful at asInvoker: pointer enlargement is the privilege-gated extra, not the whole app.
  • Pointer enlargement moved into src/pointer_zoomer.* with a pre-built size ladder, so a shake applies a cached cursor instead of rescaling 15 cursors mid-animation. Originals are snapshotted only while unmodified, a failed apply disables enlargement for the session rather than spinning, and a CursorsDirty marker in HKCU lets the next start heal cursors left behind by a crash or a forced end.
  • Settings live in HKCU\Software\ShakeToFindCursor and are editable from the tray menu: sensitivity, size, timings, highlight style, tracking mode, hotkey (Ctrl+Alt+F), fullscreen suppression, logging.
  • Auto-start is back: a highest-privilege scheduled task when elevated, an HKCU Run key otherwise (Task Scheduler needs admin to register). Raw COM via hardcoded GUIDs so no ATL or uuid.lib is involved.
  • DPI awareness now comes from an embedded manifest (PerMonitorV2 with a system-aware fallback) instead of a runtime GetProcAddress dance; res.rc is generated by CMake from res.rc.in so the manifest and icon paths are absolute, which keeps rc.exe and windres in agreement. The manifest defaults to asInvoker; -DSTFC_REQUIRE_ADMIN=ON picks the elevated one.
  • CMake: tests build on every platform, the app only on Windows. CI runs ctest on ubuntu-latest and on both Win32 and x64, checks that the DPI manifest actually landed in the binary, and no longer swallows failures with || true.

Detection was the weak point: the old algorithm counted direction changes in a
fixed 40 ms bucket of mouse messages, so it fired on ordinary fast pointer
motion, missed slow-but-large shakes, and its behaviour depended on how often
the mouse happened to report. It also did its work inside the low-level mouse
hook, where every microsecond is latency for every other application.

- src/shake_detector.h: header-only detector driven by caller-supplied
  microsecond timestamps. Decimates to a fixed-rate ring buffer (so an 8 kHz
  gaming mouse costs the same as a 125 Hz one), then requires three
  reversals of >= 48 px within an amplitude window, a stroke-speed floor, a
  travel floor, and a recent last reversal. Cooldown, stall and teleport
  rejection are all in there. Sensitivity 1-100 maps to those thresholds;
  Gentle / Standard / Sharp presets sit at 20 / 55 / 85.
- tests/shake_detector_test.cpp: 42 deterministic checks over synthetic pointer
  traces, runnable on any host (ctest or plain g++), including a copy of the
  v1.3 algorithm replayed on the same traces: v1.3 misses every shake at
  250 Hz+ and reports 999 triggers for a mouse sitting still on a desk;
  the new detector fires 2x per shake and 0x on the jitter, dashes, curved
  sweeps, warps and wheel-only events.
- Hook mode now only feeds samples; a recognised shake posts a message so
  SetSystemCursor and painting run on the message loop instead. Polling mode
  (--poll) remains the no-hook fallback, and the animation timer is killed
  while idle rather than spinning at 16 ms forever.
- New click-through overlay (ripple rings or a dimming spotlight) rendered on
  its own thread with UpdateLayeredWindow. This is the part that works without
  administrator rights, so the app is now useful at asInvoker: pointer
  enlargement is the privilege-gated extra, not the whole app.
- Pointer enlargement moved into src/pointer_zoomer.* with a pre-built size
  ladder, so a shake applies a cached cursor instead of rescaling 15 cursors
  mid-animation. Originals are snapshotted only while unmodified, a failed
  apply disables enlargement for the session rather than spinning, and a
  CursorsDirty marker in HKCU lets the next start heal cursors left behind by
  a crash or a forced end.
- Settings live in HKCU\Software\ShakeToFindCursor and are editable from the
  tray menu: sensitivity, size, timings, highlight style, tracking mode,
  hotkey (Ctrl+Alt+F), fullscreen suppression, logging.
- Auto-start is back: a highest-privilege scheduled task when elevated, an
  HKCU Run key otherwise (Task Scheduler needs admin to register). Raw COM via
  hardcoded GUIDs so no ATL or uuid.lib is involved.
- DPI awareness now comes from an embedded manifest (PerMonitorV2 with a
  system-aware fallback) instead of a runtime GetProcAddress dance; res.rc is
  generated by CMake from res.rc.in so the manifest and icon paths are
  absolute, which keeps rc.exe and windres in agreement. The manifest defaults
  to asInvoker; -DSTFC_REQUIRE_ADMIN=ON picks the elevated one.
- CMake: tests build on every platform, the app only on Windows. CI runs ctest
  on ubuntu-latest and on both Win32 and x64, checks that the DPI manifest
  actually landed in the binary, and no longer swallows failures with || true.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@m7vn

m7vn commented Sep 17, 2026 •

Copy link
Copy Markdown
Author

Hi, ive used your application but ive found it to be too laggy , ive asked my agent to make some changes , take your time to go through the code, i know its vibecoded but if it helps then then it helps🤷‍♀️

Arena Agent and others added 2 commits September 17, 2026 15:58
Cross-building here surfaced two link-time facts worth recording:

- With CMake's default /MD, an MSVC build of this app needs VCRUNTIME140.dll
  next to it, which is a bad first experience for a bare download. Selecting
  the static MSVC runtime (and -static for MinGW) makes each output one file.
- The Task Scheduler API is reached through CoCreateInstance with hand-written
  GUIDs, so nothing is imported from taskschd.dll: no taskschd.lib (MSVC) and
  no taskschd import library (MinGW), which several toolchains do not ship.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Sandbox-only artifact, not part of the source tree. Built here with zig's clang
+ lld for x86_64-windows-gnu and x86-windows-gnu (-O2), with the resources
generated by hand because Linux has no rc.exe/windres, force-added past the
*.exe ignore rule so the branch can carry them.

Not the shipping product - CI's MSVC build is that. Never executed: no Windows
and no wine here, so the tray menu, the hook, SetSystemCursor and the overlay
are unverified at runtime. Drop this commit before merging:
  git reset --hard HEAD~1

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant