diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92f641e..23a01ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,6 @@ name: ci on: - push: - branches: [main] pull_request: # One run per ref; cancel superseded runs. diff --git a/cos.ico b/cos.ico new file mode 100644 index 0000000..a7bd9e4 Binary files /dev/null and b/cos.ico differ diff --git a/installer/CameraOnScreen.iss b/installer/CameraOnScreen.iss index fef1608..c9b3439 100644 --- a/installer/CameraOnScreen.iss +++ b/installer/CameraOnScreen.iss @@ -25,6 +25,7 @@ Compression=lzma2/ultra64 SolidCompression=yes OutputDir=..\dist OutputBaseFilename=CameraOnScreen-Setup-{#AppVersion}-x64 +SetupIconFile=..\cos.ico WizardStyle=modern ; Combined end-user license: the app's MIT terms PLUS the NVIDIA Maxine SDK license ; flow-down for the bundled runtime/models (Maxine SDK License §1.2(v) — end-user terms diff --git a/src/CameraOnScreen.App/CameraOnScreen.App.csproj b/src/CameraOnScreen.App/CameraOnScreen.App.csproj index 4aa3db9..50b2988 100644 --- a/src/CameraOnScreen.App/CameraOnScreen.App.csproj +++ b/src/CameraOnScreen.App/CameraOnScreen.App.csproj @@ -14,6 +14,11 @@ enable None true + ..\..\cos.ico + officialdad + Camera on Screen + Camera on Screen + AI-powered webcam overlay for screen recording diff --git a/src/CameraOnScreen.App/Overlay/Interop.cs b/src/CameraOnScreen.App/Overlay/Interop.cs index 7595908..ae5b9d5 100644 --- a/src/CameraOnScreen.App/Overlay/Interop.cs +++ b/src/CameraOnScreen.App/Overlay/Interop.cs @@ -61,7 +61,8 @@ public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, public const int SW_HIDE = 0; public const int SW_SHOWNOACTIVATE = 4; // SetWindowPos flags: keep current Z-order/activation, only change position+size. - public const uint SWP_NOZORDER = 0x0004; + public const uint SWP_NOMOVE = 0x0002; + public const uint SWP_NOZORDER = 0x0004; public const uint SWP_NOACTIVATE = 0x0010; [DllImport("kernel32.dll")] public static extern IntPtr GetModuleHandle(string? name); diff --git a/src/CameraOnScreen.App/Overlay/OverlayWindow.cs b/src/CameraOnScreen.App/Overlay/OverlayWindow.cs index eefe319..441087a 100644 --- a/src/CameraOnScreen.App/Overlay/OverlayWindow.cs +++ b/src/CameraOnScreen.App/Overlay/OverlayWindow.cs @@ -293,9 +293,14 @@ public void PresentFrame(byte[] bgra, int width, int height) { _swapChain.ResizeBuffers(0, (uint)width, (uint)height, Format.Unknown, SwapChainFlags.None); _bufW = width; _bufH = height; - // Re-establish the scale for the current window size against the new frame size. + // Snap the window width to preserve the camera's native aspect ratio at the current height. + // Prevents the video from appearing squished when the window's stored W/H doesn't match + // the camera's native W/H (e.g. saved 320×240 4:3 config vs a 16:9 camera). GetClientRect(_hwnd, out RECT rc); - UpdateScale(rc.right - rc.left, rc.bottom - rc.top); + int snapH = rc.bottom - rc.top; + int snapW = (int)Math.Round(snapH * (double)width / height); + SetWindowPos(_hwnd, IntPtr.Zero, 0, 0, snapW, snapH, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); + UpdateScale(snapW, snapH); } // (Re)create the CPU-writable upload texture when the frame size changes.