This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Display-Lock is a lightweight Windows application that locks the cursor to a selected window. Written primarily in C using the Win32 API, it's designed for gamers and multi-monitor users who need to keep their cursor confined to a specific window.
# Configure and build (Release)
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
# Configure and build (Debug)
cmake -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build --config Debug
# Run tests
ctest --test-dir build -C ReleaseThe build requires Visual Studio 2022 (MSVC) on Windows.
Component Library (src/components/): Core functionality as a static library (display_lock_components)
win.c- Cursor locking logic and window manipulationsettings.c- Binary config file persistence (.DLOCKformat in%APPDATA%/DisplayLock/)applications.c- Application whitelist management and monitoring threadnotify.c- System tray icon and notificationsupdate.c- Version checking via HTTPmenu.c- Menu UI handling
Main Application (src/): Win32 dialog-based UI
main.c- Entry point, window class registration, message loopui.c- Tab view rendering (Window Select, Settings, Applications)procedures/- Dialog procedure handlers
Key Data Structures (include/common.h):
SETTINGS- User preferences (minimize on start, fullscreen, borderless, etc.)WINDOWLIST- Array of up to 35 windows for selectionAPPLICATION_LIST- Whitelisted applications for automatic cursor locking
Threading Model: Cursor locking and application monitoring run in dedicated threads, synchronized via mutex (DLockApplicationMutex).
Tests use Google Test (fetched via CMake FetchContent). Test files are in tests/ with test resources copied to the build directory.
# Run a single test
ctest --test-dir build -C Release -R SettingsTest- Work on
developbranch for features,masterfor hotfixes - Avoid external dependencies (keep it lightweight)
- Do not manually change version numbers or build scripts
- Update CHANGELOG.md with changes
- All builds and tests must pass before merge