-
Notifications
You must be signed in to change notification settings - Fork 7.1k
feat(MouseWithoutBorders): Prevent Easy Mouse from moving to another machine when an application is running in fullscreen mode. #39854
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
base: main
Are you sure you want to change the base?
Conversation
…dow is fullscreen: MouseWithoutBorders/App/Core/Event.cs: - Renamed switchByMouseEnabled to isEasySwitchAllowed as it will now take into account if the foreground window is fullscreen when trying to switch. MouseWithoutBorders/App/Class/Common.cs: - New IsForegroundWindowFullscreen function to check if the current foreground window of the controller machine is in fullscreen.
- Moved Easy Mouse settings to a new setting group. - Added an option to disable easy mouse when an app is running in fullscreen mode. - Added textbox to add processes that will not disable easy mouse when they are in fullscreen.
- Changed easy mouse fullscreen ignored app to a list of string using the GenericProperty<List<string>> Type. - Removed spell checking from the ignored app text box.
- Changed default value hack for the EasyMouseFullscreenSwitchBlockExcludedApps and removed the JsonPropertyName.
- Renamed IsForegroundWindowFullscreen to IsEasyMouseBlockedByFullscreenWindow, function is now checking if the fullscreen process is in the exclusion list. - Easy Mouse will check if we need to move machine before checking for fullscreen app. - Changed EasyMouseFullscreenSwitchBlockExcludedApps property to HashSet. - Added EasyMouseFullscreenSwitchBlockExcludedApps to MouseWithoutBorders Settings.cs - Added QueryFullProcessImageName in NativeMethods.cs
…-borders/stop-easy-mouse-when-foreground-fullscreen
- Fixed a bug that wouldn't let the mouse return to the controller machine when a fullscreen app was running on it.
- Moved functions out of the Event.cs. - Added info card to warn that this feature will only work on the host machine.
@microsoft-github-policy-service agree |
- Fixed a bug that would prevent moving away from a remote machine if we were moving to another remote machine.
- Rephrasing some confusing text
- Fixed some typos
- Check that the setting is enabled before checking if we are on the host machine
- Fixed comparing the windowsShellHandle to itself instead of the desktop handle. - If both the height and width of the foreground window are bigger than the screen, consider it full screen.
This comment has been minimized.
This comment has been minimized.
- Changed DWFLAGS to FLAGS in NativeMethods dwFlags enums.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
- Fixed allowing machine switch when fullscreen app were not the exact size of the screen. - Moved away from testing screen boundaries to detect full screen app, now checking user notification state.
0a8de95
to
046f157
Compare
- Added checks and debug logs for failure in some WinAPI native functions.
- Fixed a check where the wrong operator was used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a toggle and exclusion list to prevent Easy Mouse from switching machines when a fullscreen application is active.
- Introduces two new settings: disabling Easy Mouse on fullscreen and a per-app exclusion list.
- Updates ViewModel, UI (XAML), and settings properties to surface the new controls.
- Implements native WinAPI calls to detect fullscreen apps and block switches accordingly.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs | Adds properties to bind fullscreen‐block toggle and exclusion list. |
src/settings-ui/Settings.UI/Strings/en-us/Resources.resw | Adds new resource strings for the fullscreen toggle and expander. |
src/settings-ui/Settings.UI/SettingsXAML/Views/MouseWithoutBordersPage.xaml | Inserts UI controls (ToggleSwitch, InfoBar, Expander) for the new feature. |
src/settings-ui/Settings.UI.Library/MouseWithoutBordersProperties.cs | Defines new properties and default values for the fullscreen settings. |
src/modules/MouseWithoutBorders/App/Core/Event.cs | Integrates fullscreen-check logic into mouse‐move event handler. |
src/modules/MouseWithoutBorders/App/Class/Setting.cs | Exposes internal getters/setters for the new settings. |
src/modules/MouseWithoutBorders/App/Class/NativeMethods.cs | Adds P/Invoke declarations and enums for fullscreen detection. |
src/modules/MouseWithoutBorders/App/Class/Common.cs | Implements logic to detect blocked fullscreen apps and overall switch allowance. |
Comments suppressed due to low confidence (4)
src/modules/MouseWithoutBorders/App/Core/Common.cs:1620
- This new fullscreen‐blocking logic lacks unit or integration tests. Consider adding tests for various window states and exclusion list behavior.
internal static bool IsEasyMouseSwitchAllowed()
src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs:1016
- [nitpick] Property name 'EasyMouseEnabledAndDisableOnFullscreen' is confusing. Consider renaming to something like 'IsEasyMouseBlockingOnFullscreenEnabled' for clarity.
public bool EasyMouseEnabledAndDisableOnFullscreen =>
src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs:908
- Assigning an array literal to a HashSet property will not compile. Consider converting the split values into a HashSet, e.g., new HashSet(value.Split('\r')).
Settings.Properties.EasyMouseFullscreenSwitchBlockExcludedApps.Value = value == string.Empty ? [] : [..value.Split('\r')];
src/settings-ui/Settings.UI.Library/MouseWithoutBordersProperties.cs:185
- Initializing a GenericProperty<HashSet> with [] produces a string[] rather than a HashSet. Use new GenericProperty<HashSet>(new HashSet()) instead.
EasyMouseFullscreenSwitchBlockExcludedApps = new GenericProperty<HashSet<string>>([]);
src/settings-ui/Settings.UI/SettingsXAML/Views/MouseWithoutBordersPage.xaml
Outdated
Show resolved
Hide resolved
…dersPage.xaml Removed typo suggested by Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Fixed typo suggested by Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Removed unused import. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
- Renamed ui binded variable EasyMouseEnabledAndDisableOnFullscreen to IsEasyMouseBlockingOnFullscreenEnabled as suggested by copilot.
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, or 📝 job summary for details.Unrecognized words (1)GC'd These words are not needed and should be removedDEFT iextn localappdata msvsmon OTHERUNZOOM OTHERZOOM PARENTCLOSING PARENTOPENING pswd SCROLLCHILDREN SHELLEXTENSION SHELLNEWVALUE SHGFIICON SHGFILARGEICON TGM VARENUMSome files were automatically ignored 🙈These sample patterns would exclude them:
You should consider adding them to:
File matching is via Perl regular expressions. To check these files, more of their words need to be in the dictionary than not. You can use To accept these unrecognized words as correct, update file exclusions, and remove the previously acknowledged and now absent words, you could run the following commands... in a clone of the git@github.com:dot-tb/PowerToys.git repository curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/15557211513/attempts/1' &&
git commit -m 'Update check-spelling metadata' Warnings
|
Count | |
---|---|
1 | |
2 | |
2 | |
1 |
See
If the flagged items are 🤯 false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txt
file matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^
refers to the file's path from the root of the repository, so^README\.md$
would exclude README.md (on whichever branch you're using). -
well-formed pattern.
If you can write a pattern that would match it,
try adding it to thepatterns.txt
file.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
This wasn't added by my PR. |
Thanks for this, Let's target this pr into 93 release ❤️ |
Should I keep this PR up to date with the main branch ? |
I don't think you have to, let's do once before check in 🙂 |
Summary of the Pull Request
This PR adds a new feature to Easy Mouse, it is now possible to toggle a setting that will prevent Easy Mouse to switch away from the host machine when the foreground application is running in full screen mode, requiring the user to first alt tab out of the application before performing the switch, this also comes with a way to allow the switch on specific apps.
PR Checklist
Detailed Description of the Pull Request / Additional comments
This PR changes the way Easy Mouse checks wherever it should move to another machine, after checking that the corresponding setting is enabled and that we are trying to move away from the host machine, it will run a test using native WinAPI methods to get the foreground window and check if it is running in full screen.
If it is, it will then check the name of the executable against a list of ignored app configured by the user, if the executable is found in that list, the switch will be allowed despite the application running in full screen.
These new settings were moved along with the original Easy Mouse toggle to a new "Easy Mouse" setting group to avoid cluttering the Keyboard shortcuts group.
This feature will only work when used from the controller machine, as I didn't find a way to easily check for running application on a remote machine that didn't involved touching the sockets, I felt like such a change would be out of scope for this issue.
Validation Steps Performed
I had a hard time writing tests and didn't achieve anything meaningful enough to be included, I may require some guidance on how to properly write tests for this project.
I tested my changes by running my modified version of MouseWithoutBorders on my machines, which I did for a few days now, It allowed me to catch a few bugs, but it has been running smoothly otherwise.
My changes didn't seemed to have caused any automated tests to fail.
It may require some additional testing for setups including more than two machines.