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

[Mouse Without Borders] - refactoring "Common" classes #35155

Open
mikeclayton opened this issue Sep 30, 2024 · 6 comments
Open

[Mouse Without Borders] - refactoring "Common" classes #35155

mikeclayton opened this issue Sep 30, 2024 · 6 comments
Labels
Idea-Enhancement New feature or request on an existing product Product-Mouse Without Borders Refers to the Mouse Without Borders module Status-In progress This issue or work-item is under development

Comments

@mikeclayton
Copy link
Contributor

Description of the new feature / enhancement

As a precursor to #34126 (Integrate Mouse Jump with Mouse Without Borders) I've spoken with @crutkas and @ethanfangg about doing some mechanical refactoring to break the large "Common" class into multiple smaller classes as general maintenance / housekeeping work.

Each "Common.*.cs" partial file will be turned into a separate static class so as to reduce the scope of the private members inside them and make it easier / safer to perform other changes (e.g. integration with Mouse Jump) at a later date.

Changes to each "Common.*.cs" file will be submitted as a separate PR.

Scenario when this would be used?

No change in functionality - this is a refactoring / maintenance change designed to make some future work easier / safer to implement.

Supporting information

No response

@mikeclayton mikeclayton added the Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams label Sep 30, 2024
@crutkas crutkas added Idea-Enhancement New feature or request on an existing product Product-Mouse Without Borders Refers to the Mouse Without Borders module and removed Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Oct 1, 2024
@crutkas
Copy link
Member

crutkas commented Oct 1, 2024

Make it so

mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Oct 20, 2024
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Oct 20, 2024
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Oct 20, 2024
@crutkas
Copy link
Member

crutkas commented Oct 30, 2024

@mikeclayton isn't this #35156 or is there more

@crutkas crutkas added the Status-In progress This issue or work-item is under development label Oct 30, 2024
@mikeclayton
Copy link
Contributor Author

mikeclayton commented Oct 30, 2024

@crutkas - There's more PRs to come - there's about a dozen "Common.*.cs" classes and we talked about moving cautiously and doing one file at a time so as not to break anything.

I've been trying to get the Mouse Jump style work over the line in #35521 - once that's done I can spend a bit more time on Mouse Without Borders (I've got a second refactor lined up but I've not had time to go through the regression tests yet)...

@fr1g
Copy link

fr1g commented Nov 11, 2024

What's now? is #35858 related to this?

@mikeclayton
Copy link
Contributor Author

What's now? is #35858 related to this?

This ticket is unrelated to your feature request in #35858.

mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Nov 16, 2024
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Dec 27, 2024
@mikeclayton
Copy link
Contributor Author

mikeclayton commented Jan 10, 2025

I've been trying to put together a visual for this work so the benefits can be seen more easily.

It's a long way from perfect, but here's what I've got so far...

Original Code

Image

In short, the large blue box represents the "Common" class in Mouse Without Borders which is defined across 15 partial class files (the yellow boxes) - the "Private" members in red are visible across the entire class even though they're really private implementation details for isolated functionality in each partial class file.

The work I'm doing is to move the code from each partial class file into a separate class (e.g. the partial class code in "Common.Receiver.cs" becomes a separate "Receiver" class in "Receiver.cs"). That way the Private members are truly private to the individual classes.

The changes so far have resulted in this:

Latest Code

Image

The blue boxes in the top right are the new Log, Thread and Receiver classes that have been extracted out of the Common partial classes. The "Private" members (red shapes) within each of these new class are now only visible within the individual classes, so it'll be easier to make changes to support the "Mouse Jump <-> Mouse Without Borders" integration work I've proposed.

Next Steps

mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 16, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 16, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 17, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 17, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 17, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 17, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 17, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 17, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 17, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 17, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 17, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 17, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 17, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 17, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 17, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 17, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 28, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 28, 2025
mikeclayton added a commit to mikeclayton/PowerToys that referenced this issue Jan 29, 2025
[MouseWithoutBorders] - merge main, fix conflicts - microsoft#35155

Merge branch 'main' into dev/mikeclayton/mwb-common-refactor-machine-stuff

# Conflicts:
#	src/modules/MouseWithoutBorders/App/Class/Common.DragDrop.cs
#	src/modules/MouseWithoutBorders/App/Class/Common.MachineStuff.cs
#	src/modules/MouseWithoutBorders/App/Core/Logger.cs
#	src/modules/MouseWithoutBorders/App/Core/Receiver.cs
#	src/modules/MouseWithoutBorders/MouseWithoutBorders.UnitTests/Core/Logger.PrivateDump.expected.txt
#	src/modules/MouseWithoutBorders/MouseWithoutBorders.UnitTests/Core/LoggerTests.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Idea-Enhancement New feature or request on an existing product Product-Mouse Without Borders Refers to the Mouse Without Borders module Status-In progress This issue or work-item is under development
Projects
None yet
Development

No branches or pull requests

3 participants