PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

Ready for Review - [MouseJump] move "common" classes into separate project

Open mikeclayton opened this issue 6 months ago • 11 comments

Summary of the Pull Request

This is an attempt to break PR #33486 ([Mouse Jump] - Customisable appearance - borders, margins, colours) down into smaller chunks because it's gotten unmanageable due to its age and number of commits (currently 37 commits / 205 files changed and 25 merge conflicts).

This PR just moves the files in the "MouseJumpUI\Common" folder into a separate *.csproj project so that it can eventually be referenced by the SettingsUI project to draw a sample preview image when style settings are changed. There's no functionality changes in the code, just a move of the existing classes into a separate project (and updating the namespaces), so it'll hopefully be a lot easier to review than #33486, which can eventually be cancelled.

A separate follow-up PR will re-implement the Settings UI changes to close PR #33486 and Issue #27511.

PR Checklist

  • [X] Partial implementation of : #27511
  • [X] Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
    • This is a step toward #27511 - [Mouse Jump] Customisable appearance - borders, margins, colours
  • [X] Tests: Added/updated and all pass
    • no changes required, apart from MouseJumpUI.UnitTests moved to MouseJump.Common.UnitTests
  • [X] Localization: All end user facing strings can be localized
    • no changes required
  • [X] Dev docs: Added/updated
    • no changes required
  • [ ] New binaries: Added on the required places
  • [X] Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx
    • no changes required

Detailed Description of the Pull Request / Additional comments

This PR moves all of the code currently held in the MouseJumpUI project under "src\modules\MouseUtils\MouseJumpUI\Common" into a new project "MouseJump.Common". This will allow the project to be referenced from the SettingsUI project in a follow-up PR as part of the work to implement customisable style settings.

Validation Steps Performed

  • Workflow tests
    • [x] Automated tests passing locally
    • [x] Minimal actions workflow (spelling check) passing for PR
    • [x] Full actions workflow (msbuild) passing for PR
  • UI tests
    • [x] 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
      • [x] pressing escape 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
    • [x] Number and key shortcuts (1-9, Home / End, Left / Right Arrow) jump to the appropriate monitor
    • [x] Number-pad shortcuts (1-9 jump to the appropriate monitor
  • Lifecycle tests
    • [x] Starting PowerToys Runner launches MouseJumpUI.exe when enabled, and not when disabled
    • [x] Enabling / disabling Mouse Jump in settings starts / stops MouseJumpUI.exe
    • [x] Exiting PowerToys Runner stops MouseJumpUI.exe
    • [x] Killing runner exe via Task Manager stops MouseJumpUI.exe
    • [x] Stopping Visual Studio local debug run stops MouseJumpUI.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
    • [x] Enable Mouse Jump. Then:
    • [x] Press the activation shortcut and verify the screens preview appears.
    • [x] Change activation shortcut and verify that new shortcut triggers Mouse Jump.
    • [x] Click around the screen preview and ensure that mouse cursor jumped to clicked location.
    • [x] Reorder screens in Display settings and confirm that Mouse Jump reflects the change and still works correctly.
    • [x] Change scaling of screens and confirm that Mouse Jump still works correctly.
    • [x] Unplug additional monitors and confirm that Mouse Jump still works correctly.
    • [x] Disable Mouse Jump and verify that the module is not activated when you press the activation shortcut.

mikeclayton avatar Aug 17 '24 19:08 mikeclayton