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
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: ci

on:
push:
branches: [main]
pull_request:

# One run per ref; cancel superseded runs.
Expand Down
Binary file added cos.ico
Binary file not shown.
1 change: 1 addition & 0 deletions installer/CameraOnScreen.iss
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/CameraOnScreen.App/CameraOnScreen.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
<ImplicitUsings>enable</ImplicitUsings>
<WindowsPackageType>None</WindowsPackageType>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<ApplicationIcon>..\..\cos.ico</ApplicationIcon>
<Company>officialdad</Company>
<Product>Camera on Screen</Product>
<AssemblyTitle>Camera on Screen</AssemblyTitle>
<Description>AI-powered webcam overlay for screen recording</Description>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/CameraOnScreen.App/Overlay/Interop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
9 changes: 7 additions & 2 deletions src/CameraOnScreen.App/Overlay/OverlayWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading