doc/devdocs/modules/mouseutils/mousehighlighter.md
Mouse Highlighter is a utility that visualizes mouse clicks by displaying a highlight effect around the cursor when clicked.
Mouse Highlighter runs within the PowerToys Runner process and draws visual indicators (typically circles) around the mouse cursor when the user clicks.
src/modules/MouseUtils/MouseHighlighter/MouseHighlighter.cpp - Contains the main implementationWndProc - Handles window messages and mouse eventsWhen the utility is enabled:
A background thread is created to run the mouse highlighter logic asynchronously:
std::thread([=]() { MouseHighlighterMain(m_hModule, m_highlightSettings); }).detach();
The Highlighter instance is initialized and configured with user settings:
Highlighter highlighter;
Highlighter::instance = &highlighter;
highlighter.ApplySettings(settings);
highlighter.MyRegisterClass(hInstance);
A highlighter window is created:
instance->CreateHighlighter();
The utility:
WM_CREATE message to initialize the Windows Composition API (Compositor, visuals, and target)The activation process works as follows:
Shortcut Detection
RegisterHotKey or similar hook) detects the shortcutMessage Transmission
WM_SWITCH_ACTIVATION_MODE) is sent to the highlighter window via PostMessage() or SendMessage()Window Procedure Handling
WndProc of the highlighter window receives the message and toggles between start and stop drawing modes:
case WM_SWITCH_ACTIVATION_MODE:
if (instance->m_visible)
instance->StopDrawing();
else
instance->StartDrawing();
Drawing Activation
If turning ON, StartDrawing() is called, which:
If turning OFF, StopDrawing() is called, which:
When the mouse highlighter is active:
To debug Mouse Highlighter:
MouseHighlighter.cpp file