doc/devdocs/modules/mouseutils/mousejump.md
Mouse Jump is a utility that allows users to quickly move their cursor to any location on screen using a grid-based overlay interface.
Unlike the other Mouse Utilities that run within the PowerToys Runner process, Mouse Jump operates as a separate process that communicates with the Runner via events.
src/modules/MouseUtils/MouseJump - Contains the Runner interface for Mouse Jumpsrc/modules/MouseUtils/MouseJumpUI - Contains the UI implementationsrc/modules/MouseUtils/MouseJumpUI/MainForm.cs - Main UI form implementationsrc/modules/MouseUtils/MouseJump.Common - Shared code between the Runner and UI componentsWhen the utility is enabled:
A separate UI process is launched for Mouse Jump:
void launch_process()
{
Logger::trace(L"Starting MouseJump process");
unsigned long powertoys_pid = GetCurrentProcessId();
std::wstring executable_args = L"";
executable_args.append(std::to_wstring(powertoys_pid));
SHELLEXECUTEINFOW sei{ sizeof(sei) };
sei.fMask = { SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI };
sei.lpFile = L"PowerToys.MouseJumpUI.exe";
sei.nShow = SW_SHOWNORMAL;
sei.lpParameters = executable_args.data();
if (ShellExecuteExW(&sei))
{
Logger::trace("Successfully started the Mouse Jump process");
}
else
{
Logger::error(L"Mouse Jump failed to start. {}", get_last_error_or_default(GetLastError()));
}
m_hProcess = sei.hProcess;
}
The Runner creates shared events for communication with the UI process:
m_hInvokeEvent = CreateDefaultEvent(CommonSharedConstants::MOUSE_JUMP_SHOW_PREVIEW_EVENT);
m_hTerminateEvent = CreateDefaultEvent(CommonSharedConstants::TERMINATE_MOUSE_JUMP_SHARED_EVENT);
The activation process works as follows:
Shortcut Detection
MOUSE_JUMP_SHOW_PREVIEW_EVENTUI Display
Mouse Movement
Termination
TERMINATE_MOUSE_JUMP_SHARED_EVENTThe Mouse Jump UI is implemented in C# using Windows Forms:
To debug Mouse Jump:
Mouse Jump was initially contributed by Michael Clayton (@mikeclayton) and is based on his FancyMouse utility.