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
1 change: 1 addition & 0 deletions mac/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ How the macOS zoom behaves and why: `docs/architecture.md`. Keep it in step with
- `python3 scripts/tooltip_truth.py`: AppKit tooltips while zoomed (takes the screen with an active probe window); run it after touching how Wind hides the real cursor.
- `python3 scripts/hitch_truth.py`: view stalls as apps open, quit and alerts show, from Wind's `slow tick` lines (`Stall`); run it after touching anything on the main thread's tick path.
- `python3 scripts/backdrop_truth.py`: the Backdrop engine (no capture); `WIND_ENGINE=backdrop` runs a suite on it. ScreenCaptureKit cannot see it (`tools/cursorchurn/dispcap` can).
- `python3 scripts/backdrop_sharp.py`: Backdrop stays Nearest (sharp) with either `renderScaling`, scored on a 1 px checker.
- `python3 scripts/edge_truth.py`: the pinned view at screen edges on the zoomed screen (edge shake).
- `python3 scripts/wobble_from_log.py [HH:MM:SS]`: cursor wobble from a real session in the log (logLevel 2).
- `python3 scripts/e2e_screenshot.py`: screenshot mode (area, window, Cmd+Shift+5) and the colour sampler while
Expand Down
5 changes: 4 additions & 1 deletion mac/Sources/Wind/DrawZoom.swift
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ final class DrawZoom: NSObject, SCStreamOutput, SCStreamDelegate, @unchecked Sen
let at = CGPoint(x: px, y: H - py)
if abs(at.x - b.position.x) > 0.01 || abs(at.y - b.position.y) > 0.01 { backdropMovedAt = CACurrentMediaTime() }
b.position = at
b.magnificationFilter = scaling == .nearest ? .nearest : CALayerContentsFilter(rawValue: "cubic")
// Always nearest: every other filter WindowServer takes here (cubic, linear, trilinear; lanczos and box
// read as linear) greys a 1 px checker to 72-89% at 3x and 4.37x, nearest to 2% (backdrop_sharp.py,
// owner 2026-11-08: "smoothness which makes things blurry", after xBR on Render had picked cubic here).
b.magnificationFilter = .nearest
}

/// What is below reaches the screen only as far as the overlay's commit dirties the backdrop. With it idle
Expand Down
2 changes: 1 addition & 1 deletion mac/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.6
0.5.7
5 changes: 4 additions & 1 deletion mac/docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,10 @@ above the overlay, so it stays unmagnified on the zoomed view. It cannot be cove
unmagnified, and the lock screen shows unmagnified above the overlay: `DrawZoom.lockUp` gives the real cursor back meanwhile and restarts a capture it stopped.
loginwindow also owns the Restart and Shut Down prompts: only `CGSSessionScreenIsLocked`, or a window above the overlay, counts as the lock screen (owner
2026-11-04: the prompt brought the tiny cursor). Tests never open the real prompt, which restarts by itself after 60 s.
- No pixels reach Wind, so no xBR: `renderScaling` 0 is Nearest, 1 is `cubic` (the Scaling row is Render's only for now).
- No pixels reach Wind, so no xBR: Backdrop is always Nearest, whatever `renderScaling` holds (the Scaling row is Render's).
Until 0.5.7 it mapped xBR to `cubic`, which blurred the view with no row to change it (owner 2026-11-08). Every
`magnificationFilter` but nearest smooths here: a 1 px checker at 3x is 87% grey on linear (lanczos and box read as
linear) and on cubic, 2% on nearest. `scripts/backdrop_sharp.py` checks it with both `renderScaling` values.
- What is below reaches the screen only as far as a commit dirties the backdrop, so `keepAliveTick` nudges the backdrop layer itself 0.001 pt
on every refresh the view does not move it. A nudge of the cursor layer alone, or a tick with the view still, redrew part of the view: a
Terminal scrolled with the pointer still tore in half (owner 2026-11-04; `dispcap --tear`, whole-window flips: 666 of 828 frames torn, 2 of
Expand Down
40 changes: 40 additions & 0 deletions mac/scripts/backdrop_sharp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python3
# Copyright (c) 2026 Max Aubert. All rights reserved.
# Proprietary source-available software; see LICENSE. SPDX-License-Identifier: LicenseRef-Wind-Proprietary
"""Backdrop sharpness: a 1-pixel checker (tools/scalecard) magnified by Backdrop, grabbed at the backing resolution
(tools/cursorchurn/dispcap with DISPCAP_PIXELS) and scored by the share of grey pixels. Backdrop is always Nearest
(about none grey) with renderScaling 0 or 1 (owner 2026-11-08: xBR had picked macOS's cubic there, 87% grey).
usage: backdrop_sharp.py [--level 3]"""
import argparse, os, subprocess, sys, time
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import windtest as W
from PIL import Image
ap = argparse.ArgumentParser(); ap.add_argument("--level", type=float, default=3); a = ap.parse_args()
T = os.path.join(W.ROOT, "tools"); OUT = os.path.join(W.ROOT, "build/backdrop-sharp"); os.makedirs(OUT, exist_ok=True)
subprocess.run([T + "/cursorchurn/build.sh"], check=True, stdout=subprocess.DEVNULL)
subprocess.run([T + "/scalecard/build.sh"], check=True, stdout=subprocess.DEVNULL)
W.relaunch_with_channel(direct=True, extra={"engine": "backdrop", "cursor": "wind", "renderScaling": 0})
CX, CY, CW, CH = 400, 300, 600, 400
card = subprocess.Popen([T + "/scalecard/scalecard", "card", str(CX), str(CY), str(CW), str(CH), "120"], stdout=subprocess.PIPE, text=True)
card.stdout.readline(); time.sleep(0.5)
qx, qy = CX + CW / 2 + 10, CY + 6 # the checker's top-left (points): 48x24 cells of 0.5 pt
px, py = qx + 12, qy + 50 # the pointer below it, so the drawn cursor stays off it
W.ctl("level 1"); W.ctl(f"warp {px} {py}"); time.sleep(0.4); W.ctl(f"level {a.level}"); time.sleep(1.5)
c = W.ctl("state")["sky"]["center"]

def grey(tag):
png = os.path.join(OUT, tag + ".png")
subprocess.run([T + "/cursorchurn/dispcap", png, "0.6"], check=True, env=dict(os.environ, DISPCAP_PIXELS="1"))
im = Image.open(png).convert("L"); S = im.width / 1920; L = a.level
x0 = (960 + (qx - c[0]) * L) * S; y0 = (540 + (qy - c[1]) * L) * S
cr = im.crop((int(x0 + 3 * S * L), int(y0 + 3 * S * L), int(x0 + 21 * S * L), int(y0 + 9 * S * L)))
cr.save(os.path.join(OUT, tag + "-crop.png"))
v = list(cr.get_flattened_data())
return sum(1 for p in v if 50 < p < 205) / len(v)

for sc in (0, 1):
W.set_config(renderScaling=sc); time.sleep(1)
g = grey(f"scaling{sc}")
W.check(f"Backdrop sharp with renderScaling {sc}", g < 0.08, f"{g * 100:.1f}% grey pixels in the checker")
W.set_config(renderScaling=None)
W.ctl("level 1"); time.sleep(0.5); card.kill(); W.finish()
5 changes: 4 additions & 1 deletion mac/tools/cursorchurn/dispcap.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ int main(int argc, char **argv) {
if (!strcmp(argv[1], "--tear")) return tear(argc, argv, create, start);
NSDictionary *props = @{ @"kCGDisplayStreamShowCursor": @NO, @"kCGDisplayStreamMinimumFrameTime": @(1.0/240) };
double t0 = CFAbsoluteTimeGetCurrent();
void *s = create(CGMainDisplayID(), 1920, 1080, 'BGRA', (__bridge CFDictionaryRef)props, dispatch_queue_create("cap", 0),
// DISPCAP_PIXELS=1: at the display's backing resolution (sharpness checks), not 1920x1080 points.
size_t W = 1920, Hh = 1080;
if (getenv("DISPCAP_PIXELS")) { CGDisplayModeRef m = CGDisplayCopyDisplayMode(CGMainDisplayID()); W = CGDisplayModeGetPixelWidth(m); Hh = CGDisplayModeGetPixelHeight(m); CGDisplayModeRelease(m); }
void *s = create(CGMainDisplayID(), W, Hh, 'BGRA', (__bridge CFDictionaryRef)props, dispatch_queue_create("cap", 0),
^(int status, uint64_t dt, IOSurfaceRef surf, void *upd) {
if (status != 0 || !surf || CFAbsoluteTimeGetCurrent() - t0 < secs) return;
IOSurfaceLock(surf, kIOSurfaceLockReadOnly, NULL);
Expand Down
Loading