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

[FindMyMouse] Add setting to activate by shaking mouse #16244

Merged

Conversation

jaimecbernardo
Copy link
Collaborator

Summary of the Pull Request

What is this about:
Adds a setting to activate Find My Mouse by shaking the mouse pointer.

What is included in the PR:
Adds the activation method of shaking the mouse. The algorithm is more or less like this: "If in the last second the distance travelled by the mouse pointer is 4 times greater than the diagonal of the rectangle containing that movement, it's a mouse shake.
Adds a setting to control activation method as well.

image

How does someone test / validate:
Go to settings and change the activation method to "shake mouse". Then try shaking your mouse.

Quality Checklist

  • Linked issue: Shake mouse to activate Find my mouse #14638
  • Communication: I've discussed this with core contributors in the issue.
  • Tests: Added/updated and all pass
  • Installer: Added/updated and all pass
  • Localization: All end user facing strings can be localized
  • Docs: Added/ updated
  • Binaries: Any new files are added to WXS / YML

@github-actions

This comment was marked as resolved.

@github-actions

This comment was marked as resolved.

@htcfreek
Copy link
Collaborator

lets move the new setting between the enable switch and the appearance section as we have it on the other utilities

@niels9001 niels9001 changed the title [FindMyMouse]add setting to activate by shaking mouse [FindMyMouse] Add setting to activate by shaking mouse Feb 11, 2022
Copy link
Collaborator

@stefansjfw stefansjfw left a comment

Choose a reason for hiding this comment

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

I see that moving pointer in circles not that fast also triggers the FindMyMouse.. Not sure if that's going to be expected by users

@jaimecbernardo
Copy link
Collaborator Author

@htcfreek , Thank you.
Looks like this now:
image

@jaimecbernardo
Copy link
Collaborator Author

I see that moving pointer in circles not that fast also triggers the FindMyMouse.. Not sure if that's going to be expected by users

@stefansjfw
Thank you. It's hard to avoid false positives here, though. It's one of the reasons it's sort of annoying on macOS as well, it can get triggered without intending. Moving in circles is kinda similar to shaking and not quite a natural movement unless intentional :)

@stefansjfw
Copy link
Collaborator

I see that moving pointer in circles not that fast also triggers the FindMyMouse.. Not sure if that's going to be expected by users

@stefansjfw Thank you. It's hard to avoid false positives here, though. It's one of the reasons it's sort of annoying on macOS as well, it can get triggered without intending. Moving in circles is kinda similar to shaking and not quite a natural movement unless intentional :)

Yeah, I fully agree.. I don't have anything to suggest to make the algorithm better :) This is not a blocker at all, just a note.. :)

Copy link
Collaborator

@stefansjfw stefansjfw left a comment

Choose a reason for hiding this comment

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

Looks good & works good

else
{
relativeX = input.data.mouse.lLastX;
relativeY = input.data.mouse.lLastY;
Copy link
Collaborator

Choose a reason for hiding this comment

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

should m_seenAnAbsoluteMousePosition be reset to false here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wonder. I don't know if we can receive absolute then relative then absolute. Trying to avoid cases where we might get absolute positions with small relative in between, then another absolute.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't know if we can receive absolute then relative then absolute

No idea tbh :) But, if I get this right, the if block should only make sense if you get 2 absolute in a row? If you don't reset this, then you can get absolute after some time on different side of the screen and relativeX & relativeY does not represent valid cases? This probably never happen though :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I'm not sure. I think even if we receive absolute + relative in a duplicated way it shouldn't be much of an issue 🤷 . It'll just trigger more? :P

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah. We are probably overthinking this :D

Copy link
Collaborator

@SeraphimaZykova SeraphimaZykova left a comment

Choose a reason for hiding this comment

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

Works well! I also noticed false positives by moving mouse in circles, but don't think that it's a blocker.

Copy link
Contributor

@niels9001 niels9001 left a comment

Choose a reason for hiding this comment

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

Just a minor change on the verbage. Should we update the module description as well?

x:Uid="MouseUtils_FindMyMouse" should be come something like:
"Find My Mouse highlights the position of the cursor when shaking the mouse or by pressing the left Ctrl key twice."

x:Uid="Oobe_MouseUtils_FindMyMouse_Description" should become something like:
"Shake the mouse or press the left Ctrl key twice to focus the mouse pointer"

src/settings-ui/Settings.UI/Strings/en-us/Resources.resw Outdated Show resolved Hide resolved
@jaimecbernardo jaimecbernardo merged commit f6a292d into microsoft:main Feb 11, 2022
@JamoCA
Copy link

JamoCA commented May 21, 2023

Shake Mouse? For highlighting the mouse point on the screen, Windows already has an existing visibility option to Show Location of pointer when I press the CTRL key.

I was going to request a shake feature for the "Always On Top" toy . I recently migrated from a paid version of AquaSnap and their product makes any window stay on top (and optionally toggle transparency) when the mouse is shaken. Is it possible to add a shake feature to the "Always On Top" toy? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants