-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
[PTRun] - only show top window per process in WndWalker #31303
base: main
Are you sure you want to change the base?
Conversation
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.
Thank you for opening the PR.
Can you please sign the CLA?
I'm also checking the diff and many files seem to have lots of file ending changes, is this something you'd be able to fix to make it easier to review?
Thank you, in advance.
@microsoft-github-policy-service agree |
Sorry for late reply, I think I fixed the line endings. |
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.
Thank you for the contribution. I like how we avoid any performance impact by only running the code if the option is turned on.
However, there are some code quality issues I feel must be addressed. Can you please look into those? Thank you!
@@ -202,4 +202,7 @@ | |||
<data name="wox_plugin_windowwalker_SettingSubtitleDesktopName_Description" xml:space="preserve"> | |||
<value>This information is only shown in subtitle and tool tip, if you have at least two desktops.</value> | |||
</data> | |||
<data name="wox_plugin_windowwalker_SettingsTopWindowPerProcess" xml:space="preserve"> | |||
<value>Only show the top window of each processes.</value> |
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.
<value>Only show the top window of each processes.</value> | |
<value>Only show the top window of each process.</value> |
var z = 1; | ||
while (true) | ||
{ | ||
hNextWnd = NativeMethods.GetWindow(hNextWnd, GetWindowCmd.GW_HWNDNEXT); |
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 method seems to have many issues.
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getwindow#remarks
Also feel uneasy seeing a while(true)
in here.
Can you use the EnumChildWindows or EnumWindows as suggested instead?
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enumwindows#remarks
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.
The document call for use GetNextWindow, which is implemented as a call to the GetWindow
function.
I think EnumChildWindows
or EnumWindows
do not guarantee the function enumerate in the correct z-order.
Maybe we could add some checks to prevent the infinite loop; but still this could return incomplete results, and we don't need to handle that case.
In the case of incomplete results, I assume the application will use the first window in the result list, and usually be the top window of that process. The users should be able to retry as well, and then likely get the complete result next time.
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.
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.
Copilot reviewed 5 out of 7 changed files in this pull request and generated no comments.
Files not reviewed (2)
- src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Properties/Resources.Designer.cs: Language not supported
- src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Properties/Resources.resx: Language not supported
Comments suppressed due to low confidence (1)
src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/ResultHelper.cs:29
- Ensure that the new behavior introduced in ResultHelper.cs for grouping and selecting the top window per process is covered by tests.
if (WindowWalkerSettings.Instance.ResultsFromTopWindowPerProcess)
Summary of the Pull Request
Add a feature that allow to only show most top window (or "most recent window") for each process in Window Walker.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed