diff --git a/electron/windows.ts b/electron/windows.ts index f9a25aa1..55b0e6ce 100644 --- a/electron/windows.ts +++ b/electron/windows.ts @@ -184,7 +184,7 @@ function getHudOverlayBounds() { }); return getHudOverlayWindowBounds( workArea, - isHudOverlayMousePassthroughSupported() && !hudOverlayRecordingActive, + isHudOverlayMousePassthroughSupported(), fallbackExpanded, ); } @@ -457,6 +457,15 @@ export function createHudOverlayWindow(): BrowserWindow { backgroundThrottling: false, }, }); + // Keep the recording controls and webcam above normal and full-screen apps. + // Transparent regions remain click-through via setIgnoreMouseEvents(). + win.setAlwaysOnTop(true, "screen-saver"); + if (process.platform === "darwin") { + win.setVisibleOnAllWorkspaces(true, { + visibleOnFullScreen: true, + skipTransformProcessType: true, + }); + } const showHudWindow = () => { if (hasShownHudWindow || win.isDestroyed()) { diff --git a/src/components/launch/hooks/useWebcamPreviewOverlay.ts b/src/components/launch/hooks/useWebcamPreviewOverlay.ts index 50d5c60e..680e3dac 100644 --- a/src/components/launch/hooks/useWebcamPreviewOverlay.ts +++ b/src/components/launch/hooks/useWebcamPreviewOverlay.ts @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useRef, useState, type PointerEvent } from "react"; +import { type PointerEvent, useCallback, useEffect, useRef, useState } from "react"; import { canShowFloatingWebcamPreview } from "../floatingWebcamPreview"; const WEBCAM_PREVIEW_DRAG_THRESHOLD = 6; @@ -118,8 +118,10 @@ export function useWebcamPreviewOverlay({ const latestDeltaX = pointer.clientX - latestDragState.startX; const latestDeltaY = pointer.clientY - latestDragState.startY; - const viewportWidth = Math.max(window.innerWidth, window.screen?.width ?? 0); - const viewportHeight = Math.max(window.innerHeight, window.screen?.height ?? 0); + // Pointer coordinates and getBoundingClientRect() are relative to the HUD + // viewport. `screen.width` can use a different display/DPI coordinate space. + const viewportWidth = window.innerWidth; + const viewportHeight = window.innerHeight; const unclampedLeft = latestDragState.initialLeft + latestDeltaX; const unclampedTop = latestDragState.initialTop + latestDeltaY; const clampedLeft = Math.min(