mikeclayton's Description of Work
Summary of the Pull Request
This PR adds (quite a lot of) new library code from the upstream FancyMouse repo to support follow-up work to implement the following:
- improved performance (parallelized screen captures)
- idiomatic WinUI implementation (composite controls instead of a single rendered preview bitmap)
- better visualisations (rounded bezel corners, realistic highlight and shadow effects)
- cancellation support for activation sequence
- unblock opportunities for future features (e.g. Mouse Without Borders integration)
The new code isn't actually called from the existing codebase in this PR - it's simply being pre-staged so that follow-up work can wire it up to the main application. The motivation for doing it in two steps is to separate the review work for the library code from the review work for the main integration and split it into more manageable chunks.
Notes
The new code is all in additional files - there's a lot of new files, but a large amount of it is comments and boilerplate xmldocs (especially in Win32Gen), and none of the new code is called from the existing codebase as of yet.
It's all been taken from the latest version of the (MIT licensed) upstream project that Mouse Jump is based on (https://github.com/mikeclayton/FancyMouse) in order to unblock integrating the new performance and UI features already implemented in that repo in a follow up PR.
| Folder | Files | Total lines | Executable lines |
|---|---|---|---|
| Bezels | 9 | 1,648 | 644 |
| Blurring | 2 | 310 | 152 |
| Capture | 5 | 430 | 222 |
| Telemetry | 10 | 604 | 271 |
| Win32Gen | 42 | 1,903 | 518 |
| Total | 68 | 4,895 | 1,807 |
If this is too much new code to submit in one PR I can break it into smaller PRs to be merged over a series of releases, but I'm keen to prestage the core library code so I can start the actual integration work to deliver the new functionality :-).
Changes
Below is the code that's been added in this PR (but not integrated into the main application yet):
Prereqs for #50462 - improve screenshot bezel visuals
-
MouseJump.Common/Bezels - new code to generate 3d bezels with rounded corners and realistic-looking highlight and shadow effects
Prereqs for #50464 - performance, reliability, maintainability improvements
MouseJump.Common/Blurring - adds a blur effect pipeline and cache for screenshots so they can be used as "default placeholder" images for slow-loading screenshot captures at the next activation, which makes it feel like the preview image is loading faster even if it's not!
MouseJump.Common/Helpers/BlurHelper - the actual blur effect implementation, decoupled from the blur pipeline
MouseJump.Common/Capture - implements a parallel screenshot capture pipeline to improve the time to fully render the preview image
MouseJump.Common/Telemetry - a simple telemetry library that can be used to measure performance of sections of code and signal runtime events. Writes to a local text file - no remote shipping features
MouseJump.Common/Win32Gen - a snapshot of some generated wrappers around CsWin32 pinvoke calls. The wrappers implement tailored error handling on top of each CsWin32 call to reduce the amount of boilerplate error handling at each call site
MouseJump.Models/ViewModels -> Layout - renaming the existing
ViewModelsnamespace and classes to use "Layout" instead of "ViewModel". The rename ripples out to a small number of changes in existing code to reflect the renameMouseJump.Models/Style/BorderStyle" - added a 1-line helper to clone an instance with a specified 3D border depth
PR Checklist
- [x] Partially addresses:
- #50462
- #50464
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) -->
- [ ] Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
- [x] Tests: Added/updated and all pass
- [x] Localization: All end-user-facing strings can be localized
- [x] Dev docs: Added/updated
- [x] New binaries: Added on the required places
- [ ] JSON for signing for new binaries
- [ ] WXS for installer for new binaries and localization folder
- [ ] YML for CI pipeline for new test projects
- [ ] YML for signed pipeline
- [x] Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx
Detailed Description of the Pull Request / Additional comments
See Notes / Changes above
Validation Steps Performed
-
Workflow tests- [x] Automated tests passing locally
- [x] Minimal actions workflow (spelling check) passing for PR
- [ ] Full actions workflow (msbuild) passing for PR
-
UI tests- [ ] Happy path
- [x] preview image appears when activated
- [x] clicking the preview image moves the mouse cursor to the correct location
- [x] right-click dismisses the preview image without moving the mouse
- [ ] pressing escape dismisses the preview image without moving the mouse
-
FAILS - but this is a separate regression in v0.101 - see https://github.com/microsoft/PowerToys/issues/50533
-
- [x] left or right clicking another application / desktop dismisses the preview image without moving the mouse
- [x] Works on multiple monitors with different dpi scaling settings (e.g. 100% vs 150%)
- https://github.com/microsoft/PowerToys/pull/23566#issuecomment-1411869418
- https://github.com/microsoft/PowerToys/pull/23566#issuecomment-1412834413
- [x] Handling negative coordinates on non-primary monitors if higher or "lefter" than primary monitor
- https://github.com/microsoft/PowerToys/pull/23566#issuecomment-1404931694
- [x] Mouse crosshair moves when Mouse Jump moves the cursor (mouse clicks and keyboard shortcuts)
- #24523
- #24527
- [x] Activating when the preview window is already visible moves the form to the new mouse position
- [ ] Number and key shortcuts (1-9, Home / End, Left / Right Arrow) jump to the appropriate monitor
-
FAILS - but this is a separate regression in v0.101 - see https://github.com/microsoft/PowerToys/issues/50533
-
- [ ] Number-pad shortcuts (1-9 jump to the appropriate monitor
-
FAILS - but this is a separate regression in v0.101 - see https://github.com/microsoft/PowerToys/issues/50533
-
-
Settings tests- [x] Changing thumbnail size settings updates the size of the thumbnail
- [x] Changing preview type between Compact, Bezelled and Custom shows the correct preview type
- [x] Changing custom preview settings shows the correct settings
- [ ] Launching with settings version 1.0 upgrades settings to version 1.1, with "Bezelled" as the default style and the "Custom" settings preconfigured to match "Bezelled"
-
Lifecycle tests- [x] Starting PowerToys Runner launches MouseJump exe when enabled, and not when disabled
- [x] Enabling / disabling Mouse Jump in settings starts / stops MouseJump exe
- [x] Exiting PowerToys Runner stops MouseJump exe
- [x] Killing runner exe via Task Manager stops MouseJump exe
- [x] Stopping Visual Studio local debug run stops MouseJump exe
- note - runner needs to be in non-admin mode otherwise Visual Studio debugger disconnects at launch
- [x] Hotkey and size settings are automatically reloaded when config file is modified from Settings UI
- [ ] ~~Hotkey and size settings are automatically reloaded when config file is modified manually (e.g. in notepad) while runner and MouseJumpUI.exe are running~~
-
Internal Test Suite- [ ] Enable Mouse Jump. Then:
- [ ] Press the activation shortcut and verify the screens preview appears.
- [ ] Change activation shortcut and verify that new shortcut triggers Mouse Jump.
- [ ] Click around the screen preview and ensure that mouse cursor jumped to clicked location.
- [ ] Reorder screens in Display settings and confirm that Mouse Jump reflects the change and still works correctly.
- [ ] Change scaling of screens and confirm that Mouse Jump still works correctly.
- [ ] Unplug additional monitors and confirm that Mouse Jump still works correctly.
- [ ] Disable Mouse Jump and verify that the module is not activated when you press the activation shortcut.