-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
FancyZones: improve windows and apps filtering #673
Conversation
@bzoz PowerToys/src/modules/fancyzones/dll/dllmain.cpp Lines 277 to 289 in c4fc673
and it's quite common that it is called multiple times in a row for the same HWND. So what about caching the last HWND result? |
@enricogior I was thinking the same thing, but from a quick test, it looks like the performance impact is minimal. That said, I think we do need some caching. My idea is to keep a cache of about 64 last HWNDs queries, but also check (using GetWindowThreadProcessId) if the HWND still belongs to the same process as when it was added to the cachce. |
@bzoz are you planning to add the caching in this PR or do you prefer to merge this one and add the caching later on? |
@bzoz |
{ | ||
for (const auto& excluded : m_settings->GetSettings().excludedAppsArray) | ||
{ | ||
if (windowAndPath.process_path.find(excluded) != std::wstring::npos) |
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.
This is a partial match, for example if the excluded app is notepad
and the target app is notepad++.exe
, it will disable fancyzones for notepad++.exe
, this may generate confusion to the users.
We either force the users to add the application extension, like in notepad.exe
, or handle it in the code.
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.
Requiring an exact match would also be confusing, the app binary file name does not really have match exactly the app name. The best solution would probably be if a user can click on a window to disable it, maybe by using the system menu hook from #677?
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.
At least we need to document how it works, so a user may try to use the extension in order to avoid partial matching.
The FancyZones readme is outdated anyway and requires to be updated.
So let's open an issue for the Readme update after this PR is merged.
Fixed the label size and added caching of the HWNDs, PTAL |
Updated, PTAL |
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.
Great work!
Unifies the way windows are considered "interesting" by FancyZone. Berfore the change WinKey + arrows would use different method than dragging. This PR makes both use the WinKey + arrows method. Cleans up FancyZones Settings.cpp by removing m_configStrings variable. Contrary to its name it was used to create color picker control. Adds a multiline option to the text input to settings. Uses this to provide the user with a way to exclude certain apps from snapping to zones.
7487780
to
e42dc1a
Compare
Summary of the Pull Request
Unifies the way windows are considered "interesting" by FancyZone. Before the change, WinKey + arrows would use a different method than dragging. This PR makes both use the WinKey + arrows method.
Cleans up FancyZones Settings.cpp by removing m_configStrings variable. Contrary to its name it was used to create color picker control.
Adds a multiline option to the text input to settings. Uses this to provide the user with a way to exclude certain apps from snapping to zones.
PR Checklist
Validation Steps Performed
Manual