axe-windows icon indicating copy to clipboard operation
axe-windows copied to clipboard

[Feature Request] NativeMethods.SetProcessDPIAware() should be reset after scan

Open chabiss opened this issue 3 years ago • 4 comments
trafficstars

Describe the bug

The call to SetProcessDPIAware() https://github.com/microsoft/axe-windows/blob/4a09d8728ed72fa9d307052a52a1dd4d9cee1258/src/Automation/SnapshotCommand.cs

Will affect any host application integrating axe-window into their product and it's not undone once the scan is completed. Either remove the call or bring the host application state to where it was before.

chabiss avatar Aug 09 '22 23:08 chabiss

I think a good alternative to SetProcessDPIAware() is SetThreadDpiAwarenessContext(), which just changes the current thread and also allows you to switch the thread's awareness back to the way it was: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setthreaddpiawarenesscontext

What makes it a little more complicated is that SetThreadDpiAwarenessContext() would need to be called on any thread that could deal with coordinates. And a "using" statement can be used to force the thread back to the old state.

spadapet avatar Aug 10 '22 16:08 spadapet

This issue has been marked as ready for team triage; we will triage it in our weekly review and update the issue. Thank you for contributing to Accessibility Insights!

ghost avatar Aug 10 '22 16:08 ghost

This issue requires additional investigation by the Accessibility Insights team. When the issue is ready to be triaged again, we will update the issue with the investigation result and add "status: ready for triage". Thank you for contributing to Accessibility Insights!

ghost avatar Aug 15 '22 21:08 ghost

Thanks for the feature request, @chabiss, marking this as needs investigation to analyze on our side.

ferBonnin avatar Aug 15 '22 21:08 ferBonnin

This has been merged into main and will be included in an upcoming release of Axe.Windows. We'll close it out once we release the updated package to GitHub

DaveTryon avatar Oct 10 '22 17:10 DaveTryon

@chabiss, This is included in version 2.0.0. Release details are at https://github.com/microsoft/axe-windows/releases/tag/v2.0.0. Closing this issue

DaveTryon avatar Oct 21 '22 18:10 DaveTryon