Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(compositor): cover-crop and mirror the Linux webcam, drop the dead bounce slider
Etienne Lescot8aec0e15406f
diff --git a/crates/compositor/src/compositor_linux.rs b/crates/compositor/src/compositor_linux.rsindex 24f3efdf0..566b39a3e 100644--- a/crates/compositor/src/compositor_linux.rs+++ b/crates/compositor/src/compositor_linux.rs@@ -686,7 +686,8 @@ impl Compositor {cursor: cursor_ref.as_ref(),timeline_t_override: *self.timeline_time.borrow(),});- let _ = (wtw, wth); // webcam PiP : calque a venir.+ // (`wtw`/`wth` sont les dims de la TEXTURE webcam, consommees par le+ // cover-crop du calque PiP plus bas.)// Fond : Color -> clear a la couleur ; Gradient -> mode 5 ; Image ->// mode 6 wallpaper cover-fit (via load_image_texture). Le blur (si@@ -791,17 +792,37 @@ impl Compositor {// Webcam PiP (mode 0) -- placee par plan_frame (`g.w_dst`, coins// `g.w_radius`), gardee par `g.shape_fade > 0` (webcam visible).- // cover-crop UV + miroir + ombre + forme cercle = incremental (src plein- // cadre ici). `webcam_planes` garde les vues en vie pendant le pass.+ // `webcam_planes` garde les vues en vie pendant le pass.let webcam_planes = if g.shape_fade > 0.0 && !webcam.is_null() {self.nv12_srvs(webcam).ok()} else {None};let webcam_draw = webcam_planes.as_ref().map(|(wy, wuv)| {+ // COVER-CROP. `src` etait cable a [0,0,1,1], donc la texture entiere+ // etait etiree sur la boite quelle que soit sa forme : le facteur de+ // deformation valait exactement `box_ar / cam_ar`. Invisible en PiP+ // rectangulaire (`compositeLayout.ts` y preserve deja le ratio),+ // spectaculaire des que le masque est un cercle ou un carre, ou la+ // boite est forcee carree et une camera 16:9 s'ecrase de 1,78x.+ //+ // `cover_crop_uv` est la primitive partagee que macOS et Windows+ // utilisent ; elle rend le rect inchange quand il a deja le bon+ // ratio, donc aucun placement correct ne bouge.+ let (cu0, cv0, cu1, cv1) = crate::frame_geometry::cover_crop_uv(+ [wcw, wch],+ [wtw as f32, wth as f32],+ g.w_px[0] / g.w_px[1].max(0.0001),+ );+ // MIROIR : on inverse l'intervalle u. Le VS interpole `src`+ // lineairement et `fs_main` ne re-clampe pas `i.uv`, donc un+ // intervalle a l'envers suffit -- aucune retouche du WGSL. Apres le+ // cover-crop les deux bornes sont strictement a l'interieur de la+ // texture, donc le sampler ClampToEdge ne bave pas sur les bords.+ let (u0, u1) = if lp.webcam_mirror { (cu1, cu0) } else { (cu0, cu1) };let cb = LayerCB {dst: g.w_dst,- src: [0.0, 0.0, 1.0, 1.0],+ src: [u0, cv0, u1, cv1],quad_px: g.w_px,radius_px: g.w_radius,mode: 0.0,diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsxindex c26cf1662..8a5ccae27 100644--- a/src/components/ai-edition/RightPanes.tsx+++ b/src/components/ai-edition/RightPanes.tsx@@ -55,6 +55,7 @@ import { formatMs } from "@/lib/ai-edition/timeline/format";import { locateVirtualPosition } from "@/lib/ai-edition/timeline/virtual-preview";import { getAssetPath } from "@/lib/assetPath";import { supportsWebcamReactiveZoom } from "@/lib/compositeLayout";+import { supportsCursorClickEffects } from "@/lib/cursor/cursorCapabilities";import { CURSOR_THEMES, DEFAULT_CURSOR_THEME_ID } from "@/lib/cursor/cursorThemes";import { buildGradientFromEditor } from "@/lib/gradientBuilder";import { resolveImageWallpaperUrl, WALLPAPER_PATHS, WALLPAPER_THUMB_PATHS } from "@/lib/wallpaper";@@ -1728,22 +1729,29 @@ export function CursorPane() {}}onCommit={() => void commit()}/>- <SliderCell- label={ts("cursor.clickBounce")}- value={settings.cursor.clickBounce * 10}- min={0}- max={50}- step={0.1}- decimals={1}- disabled={!hasDocument}- onChange={(v) => {- setLive({ cursor: { clickBounce: v / 10 } });- if (isNativeCompositorActive()) {- setNativeParam("cursorClickBounce", v / 10);- }- }}- onCommit={() => void commit()}- />+ {/* Wayland gives an unprivileged process no way to observe mouse+ buttons, so on Linux this slider provably cannot change a pixel+ at any value — see `supportsCursorClickEffects`. Dropped rather+ than shown as a control that does nothing, exactly as+ "Shrink on zoom" is above. */}+ {supportsCursorClickEffects() ? (+ <SliderCell+ label={ts("cursor.clickBounce")}+ value={settings.cursor.clickBounce * 10}+ min={0}+ max={50}+ step={0.1}+ decimals={1}+ disabled={!hasDocument}+ onChange={(v) => {+ setLive({ cursor: { clickBounce: v / 10 } });+ if (isNativeCompositorActive()) {+ setNativeParam("cursorClickBounce", v / 10);+ }+ }}+ onCommit={() => void commit()}+ />+ ) : null}</div></Pane>);diff --git a/src/lib/cursor/cursorCapabilities.ts b/src/lib/cursor/cursorCapabilities.tsnew file mode 100644index 000000000..271372b04--- /dev/null+++ b/src/lib/cursor/cursorCapabilities.ts@@ -0,0 +1,26 @@+import { getPlatform } from "@/utils/platformUtils";++/**+ * Can this platform tell us when a mouse button was pressed?+ *+ * Not a preference and not a feature flag — a hard limit of the display server.+ * On Wayland an unprivileged process cannot observe mouse buttons at all: the+ * ScreenCast portal reports pointer POSITION as frame metadata and nothing else,+ * there is no portal for input events, and `/dev/input/event*` is `root:input`.+ * So the Linux capture helper stamps every sample `interactionType: "move"`+ * (see `pipeWireCursorAccumulator.ts`), the compositor's `CursorTrack.clicks`+ * vector is always empty, and `CursorTrack::bounce()` returns exactly 1.0 —+ * which `frame_geometry.rs` multiplies the cursor size by, leaving it unchanged+ * for every possible slider value.+ *+ * macOS and Windows both read real button state in their native cursor helpers+ * (`macNativeCursorRecordingSession.ts`, `windowsNativeRecordingSession.ts`), so+ * the effect works there.+ *+ * Same shape and same intent as `supportsWebcamReactiveZoom` in+ * `compositeLayout.ts`: a control that provably cannot change a pixel is+ * dropped rather than shown doing nothing.+ */+export function supportsCursorClickEffects(): boolean {+ return getPlatform() !== "linux";+}