Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ready for Review - [Mouse Jump] Customisable appearance - borders, margins, colours, etc - final part #35521

Conversation

mikeclayton
Copy link
Contributor

@mikeclayton mikeclayton commented Oct 21, 2024

Summary of the Pull Request

This is the last part of the Mouse Jump styles work that finally enables the feature in Settings UI and in the Mouse Jump preview image.

See #27511 for the original feature suggestion.

Changes in this PR

  • Moved the Mouse Jump "settings ui" xaml and code into a separate "MouseJumpPanel.xaml" control to make it easier to make changes to the settings controls
  • Added a new "Appearance" expander in Mouse Jump settings with all the new border, colour, 3d effect, spacing, etc settings controls to allow the user to set custom properties
  • Also added some predefined style options:
    • "Compact" is the original Mouse Jump style with just a borders around the whole image and no other chrome
    • "Bezelled" is the new default with some simple spacing between screens and 3d bezels drawn around them

image

Reviewer Notes

  • Added a reference to CommunityToolkit.WinUI.Controls.Segmented in PowerToys.Settings to allow the "Compact | Bezelled | Custom" options for Preview Style

  • Added a reference to MouseJump.Common in PowerToys.Settings to allow rendering the preview image when settings are changed

  • I've made "Bezelled" the new default style as a precursor to the proposed Mouse Without Borders integration in Integrate Mouse Jump with Mouse Without Borders to allow jumping to remote computers when MWB is enabled #34126 - it'll be easier to make the bezel colours vary by host if they're already visible.

  • Code touches the internals of the Segmented control to force the preview image to be centered - see PreviewImage_Loaded method - might be brittle if the implementation changes?

  • Config upgrade seems a bit odd - the in-memory settings get upgraded fine with "version": "1.`" but it seems to get reverted and saved again as "version": "1.0" and then overwritten again as "version"": "1.1". I've worked around this by additionally checking if the new settings have values before upgrading, but it seems like that's what the version flag is supposed to be for. It works for now anyway, but not sure if this is the right way to do it...

  • Does the "Copy to Custom preview style" need an "Are you sure? Yes / No" before overwriting and / or a "Copied!" message after copying? I'm happy to leave it as is, but feedback welcome...

PR Checklist

Validation Steps Performed

  • Workflow tests
    • Automated tests passing locally
    • Minimal actions workflow (spelling check) passing for PR
    • Full actions workflow (msbuild) passing for PR
  • UI tests
  • Settings tests
    • Changing thumbnail size settings updates the size of the thumbnail
    • Changing preview type between Compact, Bezelled and Custom shows the correct preview type
    • 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
    • Starting PowerToys Runner launches MouseJumpUI.exe when enabled, and not when disabled
    • Enabling / disabling Mouse Jump in settings starts / stops MouseJumpUI.exe
    • Exiting PowerToys Runner stops MouseJumpUI.exe
    • Killing runner exe via Task Manager stops MouseJumpUI.exe
    • 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
    • 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.

@mikeclayton mikeclayton marked this pull request as draft October 21, 2024 20:38

This comment has been minimized.

This comment has been minimized.

@mikeclayton
Copy link
Contributor Author

I think this PR is ready for review now - I still need to do the full set of regression tests but the happy path works fine.

There's some notes for reviewers in the original post at the top.

@mikeclayton mikeclayton marked this pull request as ready for review October 23, 2024 17:54
@mikeclayton mikeclayton changed the title WIP - [Mouse Jump] Customisable appearance - borders, margins, colours, etc - final part Ready for Review - [Mouse Jump] Customisable appearance - borders, margins, colours, etc - final part Oct 23, 2024
@crutkas crutkas added the Needs-Review This Pull Request awaits the review of a maintainer. label Nov 1, 2024
@jaimecbernardo
Copy link
Collaborator

Hi, just merged main to check with .NET 9 :) I'll review this PR soon.

@@ -7,6 +7,9 @@
using System.Text.Json.Serialization;

using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
using MouseJump.Common.Helpers;
using MouseJump.Common.Models.Settings;
using Windows.UI.Xaml.Printing;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows.UI.Xaml.Printing doesn't seem to be used anywhere, but it's giving an analyzer error. Removing it.

Copy link
Collaborator

@jaimecbernardo jaimecbernardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Not sure about having Settings Lib now depend on MouseJump Common, but I think it should be pretty fine and not blocking on it.
Now the default has bezels, which I guess will be a fun way for users to find out this new feature :) But it's pretty easy to just go into Settings and switch it back to compact. Pretty OK with that too.
Tested it and tested upgrade, it's looking good.
Thank you for the contribution!

@jaimecbernardo jaimecbernardo merged commit 5321218 into microsoft:main Nov 26, 2024
11 checks passed
@mikeclayton
Copy link
Contributor Author

mikeclayton commented Nov 26, 2024

I guess there's an overhead in that any future changes to MouseJump.Common will require at least superficial testing of the Settings UI now, but it was the only way I could come up with to get the graphical preview working, and that felt like it was a useful addition to the settings controls (although I guess you could change a setting, activate mouse jump to see the effect, then rinse and repeat, and maybe that would have been enough :-)...)

cgaarden added a commit to cgaarden/PowerToys that referenced this pull request Nov 29, 2024
commit a50eb4a
Author: Christian Gaarden Gaardmark <[email protected]>
Date:   Thu Nov 28 21:41:29 2024 -0800

    Remove a small change

commit 587320d
Author: Christian Gaarden Gaardmark <[email protected]>
Date:   Thu Nov 28 09:45:46 2024 -0800

    Fix for enter_rename mode

commit 911864e
Author: Christian Gaarden Gaardmark <[email protected]>
Date:   Thu Nov 28 07:53:01 2024 -0800

    Early version -- doesn't work

commit 3dc4913
Author: Shuai Yuan <[email protected]>
Date:   Thu Nov 28 05:57:20 2024 +0800

    Upgrade Windows App SDK to the latest version (microsoft#36093)

    Signed-off-by: Shawn Yuan <[email protected]>

commit 271d64b
Author: grzhan <[email protected]>
Date:   Thu Nov 28 03:44:56 2024 +0800

    [PTRun][Docs] Add HttpStatusCodes to Third-Party plugins (microsoft#36055)

    * [PTRun][Docs] Add HttpStatusCodes to Third-Party plugins

    * adding grzhan to names.txt

    ---------

    Co-authored-by: Clint Rutkas <[email protected]>

commit a90b646
Author: Andrea Bartolucci <[email protected]>
Date:   Wed Nov 27 18:30:25 2024 +0100

    [PTRun][WindowWalker]Added score to the results (microsoft#35691)

    Added Score to the results returned by WindowWalker

    Co-authored-by: Andrea Bartolucci <[email protected]>

commit 084402a
Author: Christian Gaarden Gaardmark <[email protected]>
Date:   Wed Nov 27 06:22:05 2024 -0800

    [New+]Windows 10 support (microsoft#35832)

commit 08fe808
Author: Ani <[email protected]>
Date:   Tue Nov 26 21:38:41 2024 +0100

    [Logs]Fixed name of logging method in managed logging (microsoft#35952)

    * Fixed name of method in managed logging

    * Added hardening

commit 5321218
Author: Michael Clayton <[email protected]>
Date:   Tue Nov 26 15:37:59 2024 +0000

    [Mouse Jump] Customisable appearance - borders, margins, colours, etc - final part (microsoft#35521)

    * [MouseJump] move Mouse Jump settings into separate control (microsoft#27511)

    * [MouseJump] added Mouse Jump style controls to Settings UI (microsoft#27511)

    * [MouseJump] added Mouse Jump style controls to Settings UI (microsoft#27511)

    * [MouseJump] removing unused MouseJumpUI code (microsoft#27511)

    * [MouseJump] whitespace (microsoft#27511)

    * [MouseJump] fix spellcheck (microsoft#27511)

    * [MouseJump] enabled "Copy to custom style" (microsoft#27511)

    * [MouseJump] fixing build (internal members -> public) (microsoft#27511)

    * [MouseJump] remove unused "using"s (microsoft#27511)

    * [MouseJump] use custom styles in preview image (microsoft#27511)

    * [MouseJump] fixing failing test (microsoft#27511)

    * [MouseJump] fixing failing test (microsoft#27511)

    * [MouseJump] fixing failing test (microsoft#27511)

    * [MouseJump] fixing failing test (microsoft#27511)

    * [MouseJump] delinting to trigger a build (microsoft#27511)

    * [MouseJump] updated settings preview image ("browser" header) (microsoft#27511)

    * [MouseJump] upgrade default "custom" style settings in config (microsoft#27511)

    * [MouseJump] fixed a glitch in settings upgrade (microsoft#27511)

    * [MouseJump] fixed spell checker (microsoft#27511)

    * [MouseJump] typo in resource strings (image -> images) (microsoft#27511)

    * Remove unused include

commit 7c98765
Author: Ishita Agarwal <[email protected]>
Date:   Tue Nov 26 10:43:44 2024 +0530

    Removed extra space from welcome page (microsoft#35778)

    * Removed extra space from welcome page

    * Added space between info bar and release notes

commit 6cece12
Author: Dave Rayment <[email protected]>
Date:   Fri Nov 22 16:25:01 2024 +0000

    [Peek]Add support for previewing .ahk files as plaintext (microsoft#35538)

commit 863f7aa
Author: Dave Rayment <[email protected]>
Date:   Fri Nov 22 16:24:15 2024 +0000

    [Peek] Fix Monaco assets folder discovery (microsoft#35925)

commit b81478e
Author: Dave Rayment <[email protected]>
Date:   Fri Nov 22 14:49:35 2024 +0000

    [Peek]Expand image format support for Image Previewer using local capabilities (microsoft#35622)

    * Use BitmapDecoder to query compatible file extensions.

    * Delete spellcheck exceptions for removed file types

    * Remove unused usings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Review This Pull Request awaits the review of a maintainer.
Projects
Development

Successfully merging this pull request may close these issues.

[Mouse Jump] Customisable appearance - borders, margins, colours, etc
3 participants