Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ Chapter numbers refer to `docs/architecture/NN-*.md`.
`cursorConstantSize=1` is the render-only opt-in. Test defaults on a wiped `%LOCALAPPDATA%\Wind`:
the dev ini differs from a clean install.
- The view must keep moving when a game locks the cursor: locked sessions pan from Raw Input deltas,
not `GetCursorPos`. Forced locks go through `t.detector.seedLock()`.
not `GetCursorPos`. Forced locks go through `t.detector.seedLock()`. The one exception is
Anchor to centre (`t.fixedEff`, #512): a detached view at the monitor centre; keep the detector running.
- The oracle baseline is measured, never assumed (`parkedLastFrame`/`weldedLastFrame`), and never a
post-present read. Never weld while a mouse button is held (`ShouldDragFollow`).
- Click point, drawn cursor and view all come from the smoothed centre; do not move clicks to the
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ The first launch walks you through choosing zoom keys: mouse side buttons, keybo
- **Keyboard panning:** optional arrow-key binds move the view while zoomed.
- **Quick zoom:** Ctrl plus a zoom key toggles between 1x and your last level.
- **Inspect mode:** an optional key freezes the pointer and lets you look around with a crosshair.
- **Anchor to centre:** an optional key keeps the zoomed view on the middle of the screen, like a
scope in a shooter. Press it again to follow the pointer.
- **Win+Esc** quits Wind from anywhere (Ctrl+Alt+Q if another program holds Win+Esc).

Bound keys are not passed on to the app you are using. Wind refuses binds that would break normal
Expand Down
3 changes: 2 additions & 1 deletion docs/architecture/02-tick-loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ when one engine failed to init). The restart-only keys need a restart, see
(`seedLock()`). Free ticks teach `GainLearner` the OS's real input-to-output pointer ratio per
speed, and the locked pan replays it, so a locked game pans at desktop-cursor speed.
- **Tracking** overrides the result afterwards: caret, focus or mouse-edge mode can detach the view
from the pointer (`t.viewDetached`), see [07](07-cursor.md).
from the pointer (`t.viewDetached`), see [07](07-cursor.md). Anchor to centre (`t.fixedEff`) does
the same with a fixed centre and drops the delta of every regime.
- `ShouldDragFollow` (`src/cursor/drag_follow.h`) suspends the render engine's weld while a mouse button is
held and follows the pointer 1:1.
- In a free transform session (not Inspect, not locked) the mapper is reset to the real cursor each
Expand Down
4 changes: 3 additions & 1 deletion docs/architecture/05-transform-engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ gives it back. Rules (`src/transform/native_cursor.h`, tested):

- On only where the view is a pure function of the pointer and no armed MPO wall is within a tick
of the view (`NearWall`, a 64 source px margin: DWM's own pan is unclamped and could cross a wall
before Wind's next tick; above ~9.3x on a 3840 wide monitor, 15.8x on 2160 high).
before Wind's next tick; above ~9.3x on a 3840 wide monitor, 15.8x on 2160 high). A detached
view (tracking, keyboard pan, edge mode, Anchor to centre) is never a pure function of the
pointer, so centring is off there and Wind writes the view.
- While on, Wind still writes every changed tick (win32k's copy feeds pointer-framework
hit-testing) and each write is followed by a pixel-and-back nudge (`NudgeAfterWrite`); warm
pulses stop. DWM keeps the factor of the write that follows a TRUE call, so every switch forces
Expand Down
8 changes: 5 additions & 3 deletions docs/architecture/06-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ hooks. The code is `src/input/input_router.*`, the `WM_INPUT` handling in `src/c
| `WH_MOUSE_LL` (`MouseProc`) | Mouse button and click binds, wheel binds, Inspect click interception | The only user-mode way to swallow a mouse event |
| `WH_KEYBOARD_LL` (`KbProc`) | Keyboard binds: down-state and swallowing | Same for keys; also the authority for bound-key state, since a swallowed key never reaches `GetAsyncKeyState` |
| Raw Input (`RIDEV_INPUTSINK`, `WM_INPUT` in `WndProc`) | HID mouse deltas for locked and Inspect panning; UP-event safety nets | HID level: unaffected by `ClipCursor`, `SetCursorPos` and `ShowCursor`, and not subject to the hook timeout |
| `RegisterHotKey` | Hide pointer, hotkey-mode quick zoom, Win+Esc quit (Ctrl+Alt+Q when Win+Esc is taken) | The OS suppresses a registered hotkey from other apps; these are toggles, not held keys |
| `RegisterHotKey` | Hide pointer, Anchor to centre, hotkey-mode quick zoom, Win+Esc quit (Ctrl+Alt+Q when Win+Esc is taken) | The OS suppresses a registered hotkey from other apps; these are toggles, not held keys |

**The view must keep moving when a game locks the cursor.** A mouselook game clips or recentres
the pointer every frame, so `GetCursorPos` deltas read zero. HID mickeys keep arriving, so
Expand Down Expand Up @@ -64,7 +64,9 @@ Bound inputs are eaten so they never also fire in the focused app.
them (Inspect's injected click also carries `LLMHF_INJECTED`). The keyboard hook does not check
the tag, so the mask keystroke counts as a key event there. Other injectors (AutoHotkey) count
as real input.
- Hide pointer and hotkey-mode quick zoom are suppressed by `RegisterHotKey`, not the hook.
- Hide pointer, Anchor to centre and hotkey-mode quick zoom are suppressed by `RegisterHotKey`,
not the hook, so `noSwallowApps` does not free them. A combo another app (or another Wind key)
already owns fails to register; Wind logs a Warn instead of leaving a silently dead key.

## Bind rules

Expand All @@ -79,7 +81,7 @@ Bound inputs are eaten so they never also fire in the focused app.
- Button codes: 1/2 side buttons, 3/4/5 left/right/middle click. Clicks need modifiers, never Ctrl
or Shift alone.
- The most specific matching slot wins.
- `panKeysOn`, `hideCursorOn` and `cursorLockOn` (default 1, per profile) make `ParseConfig` read
- `panKeysOn`, `hideCursorOn`, `cursorLockOn` and `fixedViewOn` (default 1, per profile) make `ParseConfig` read
that bind as unbound when 0, while the ini keeps the binding.

## Wheel and pan binds
Expand Down
29 changes: 28 additions & 1 deletion docs/architecture/07-cursor.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ flowchart TD
D -- no --> OR[oracle delta * cursorSensitivity, weld]
```

Tracking (below) can then detach the view from all of these.
Tracking (below) can then detach the view from all of these, and Anchor to centre fixes it.

## Inspect mode

Expand Down Expand Up @@ -429,6 +429,33 @@ turns held pan keys into a view delta in screen space, so the feel does not chan
- While panning, KeyPan owns the view ahead of caret events. The delta is clamped to the monitor
and the MPO wall. The pointer does not move; the next mouse move places it in the view.

## Anchor to centre (#512)

A toggle (`fixedViewVk`/`fixedViewMods`, `fixedViewOn`; Settings "Anchor to centre") that keeps the
zoomed view on the centre of the session monitor, like a scope in a mouselook game.

- `WM_HOTKEY` flips the runtime-only `t.viewFixed` (never written to the ini). It survives zoom-out,
reloads and profile switches like Hide pointer. Device-lost clears it.
- `t.fixedEff = viewFixed && zoomed && !inspect`, set in `ResolveTickModes`. Inspect wins.
- `StepTracking` makes it one more detached view (`t.viewDetached`): the centre comes from
`FixedViewCentre` (`src/track/fixed_view.h`, the monitor centre clamped by the MPO wall when
armed), `DetachedMap` reports the real pointer. So no weld, no DWM centring, clicks native, and the
pointer stays free: it can leave the zoomed area and go out of view.
- **It deliberately overrides "the view must keep moving when a game locks the cursor"**: the locked
delta is integrated and then dropped. The lock detector and gain learner keep running, so a
mouselook pan resumes from the centre at the usual speed when the anchor ends.
- Gated off while anchored: caret, focus and Java tracking, the pan keys (they reach the app),
mouse edge mode, the recenter key, the pan glide and warm pulses. Like edge mode, edge-pinned
motion of the free pointer is hidden from the lock tell, or a pointer pushed into a corner reads
LOCKED.
- Off edge in a free session (judged on that tick's lock): the mapper is reset to the pointer, so
the view jumps back to it; without that the render engine's weld would pull the pointer to the
centre.
- When a reload leaves no registered key (switch off, unbound, or a new combo another app owns),
the anchor is released.
- Above ~17.7x on a 3840 wide monitor with the MPO wall armed (guard off or `tdrTest`), the wall
holds the view slightly up and left of true centre.

## Shell input panels and the keyboard layout menu

The emoji picker, clipboard history and touch keyboard are composed above every window band, so
Expand Down
1 change: 1 addition & 0 deletions docs/architecture/08-config-profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ Every key works in the ini whether or not Settings shows it. Keys hot-reload unl
| `panLeftVk`, `panRightVk`, `panUpVk`, `panDownVk` + `*Mods`, `panKeysOn` | Keyboard panning while zoomed |
| `hideCursorVk`/`hideCursorMods`, `hideCursorOn` | Hide or show the pointer, zoomed or at 1x |
| `cursorLockVk`/`cursorLockMods`, `cursorLockOn` | Inspect mode |
| `fixedViewVk`/`fixedViewMods`, `fixedViewOn` | Anchor to centre: toggle a zoomed view fixed on the screen centre (#512) |
| `recenterVk`/`recenterMods` | Recentre the view on the cursor |
| `quickZoomHotkeyMode`, `quickZoomModifier` (default Ctrl), `quickZoomVk`/`quickZoomMods`, `quickZoomDefault` (4.0) | Quick zoom: modifier + a zoom key (mode 0) or a dedicated hotkey (mode 1) toggles between 1x and the remembered level |
| `noSwallowApps` | Exes where the keyboard hook is dropped |
Expand Down
10 changes: 9 additions & 1 deletion src/config/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ static void SanitizeBinds(Config& c) {
sanitizeKey(c.panLeftVk, &c.panLeftMods); sanitizeKey(c.panRightVk, &c.panRightMods);
sanitizeKey(c.panUpVk, &c.panUpMods); sanitizeKey(c.panDownVk, &c.panDownMods);
sanitizeKey(c.hideCursorVk, &c.hideCursorMods);
sanitizeKey(c.fixedViewVk, &c.fixedViewMods);
sanitizeKey(c.quickZoomVk, &c.quickZoomMods);
auto sanitizeButton = [](int& b, int& mods) {
if (CheckClickBind(b, mods) != BindVerdict::Ok) { b = 0; mods = 0; }
Expand All @@ -158,6 +159,7 @@ static void SanitizeBinds(Config& c) {
c.panLeftMods = c.panRightMods = c.panUpMods = c.panDownMods = 0; }
if (!c.hideCursorOn) { c.hideCursorVk = 0; c.hideCursorMods = 0; }
if (!c.cursorLockOn) { c.cursorLockVk = 0; c.cursorLockMods = 0; }
if (!c.fixedViewOn) { c.fixedViewVk = 0; c.fixedViewMods = 0; }
}

// The plain ini keys, one row each (#6): the key, how its value parses, the Config field it sets
Expand Down Expand Up @@ -211,6 +213,8 @@ constexpr ValueRow kValueRows[] = {
IntRow("hitchLog", &Config::hitchLog),
IntRow("hideCursorVk", &Config::hideCursorVk),
IntRow("hideCursorMods", &Config::hideCursorMods),
IntRow("fixedViewVk", &Config::fixedViewVk),
IntRow("fixedViewMods", &Config::fixedViewMods),
IntRow("zoomInVk", &Config::zoomInVk),
IntRow("zoomOutVk", &Config::zoomOutVk),
IntRow("zoomInVk2", &Config::zoomInVk2),
Expand All @@ -227,6 +231,7 @@ constexpr ValueRow kValueRows[] = {
BoolRow("panKeysOn", &Config::panKeysOn),
BoolRow("hideCursorOn", &Config::hideCursorOn),
BoolRow("cursorLockOn", &Config::cursorLockOn),
BoolRow("fixedViewOn", &Config::fixedViewOn),
// 30x cap (#429): above it the smooth path's half-texel jumps reach 15-25 px and the pointer
// runs off the screen; must be >= the 1.0 min zoom level.
DblRange("maxLevel", &Config::maxLevel, 1.0, 30.0),
Expand Down Expand Up @@ -529,10 +534,13 @@ std::string DefaultIniText() {
"; zoomWheelMods: the OLD single wheel setting; moved into the button slots on load (#318).\n"
"zoomWheelMods=0\n"
"; Extra-key switches (1=on, 0=off): off frees the keys but keeps the binding below.\n"
"panKeysOn=1\nhideCursorOn=1\ncursorLockOn=1\n"
"panKeysOn=1\nhideCursorOn=1\ncursorLockOn=1\nfixedViewOn=1\n"
"; hideCursorVk/hideCursorMods: hotkey to hide or show the pointer, zoomed or at 1x\n"
"; (does not reset zoom). VK + mods, 0=unbound.\n"
"hideCursorVk=0\nhideCursorMods=0\n"
"; fixedViewVk/fixedViewMods: hotkey to anchor the zoomed view to the screen centre, or let\n"
"; it follow again (a scope for mouselook games; the pointer stays free). VK + mods, 0=unbound.\n"
"fixedViewVk=0\nfixedViewMods=0\n"
"; recenterVk/recenterMods: tap to recenter the lens on the cursor (VK code; 0=unbound)\n"
"recenterVk=0\nrecenterMods=0\n"
"; cursorLockVk: tap to toggle Inspect mode - freeze the cursor (keeps a hover/tooltip\n"
Expand Down
6 changes: 6 additions & 0 deletions src/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct Config {
int panKeysOn = 1; // the four keyboard pan binds
int hideCursorOn = 1; // hideCursorVk
int cursorLockOn = 1; // cursorLockVk (Inspect mode)
int fixedViewOn = 1; // fixedViewVk (Anchor to centre, #512)
int recenterVk = 0; // VK code; 0 = unbound. Tap to recenter the lens on the cursor.
int recenterMods = 0; // its modifiers (#307: every bind takes 0-4 modifiers + one key)
int cursorLockVk = 0; // VK code; 0 = unbound. Tap to toggle Inspect mode (cursor lock)
Expand All @@ -64,6 +65,11 @@ struct Config {
// uses the same bit layout as the zoom combos.
int hideCursorVk = 0;
int hideCursorMods = 0;
// Hotkey to anchor the zoomed view to the session monitor's centre (#512, "Anchor to centre"):
// toggles a runtime-only bool like hideCursorVk (never written to the ini). While anchored the
// view ignores the pointer, mouselook, tracking and pan keys; the pointer itself stays free.
int fixedViewVk = 0;
int fixedViewMods = 0;
double maxLevel = 30.0; // how FAR you can zoom (does not affect zoom SPEED)
// --- Zoom experience (see docs/specs/2026-05-26-configurable-zoom-design.md) ---
// Per-direction rate multipliers (1.0 = default speed); apply in BOTH linear and smooth modes.
Expand Down
Loading