-
Notifications
You must be signed in to change notification settings - Fork 81
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
Fix incorrect screen resolution when dpi is set #131
base: master
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.
A few comments, mostly for consistency and uniformity with info_disk
function.
Can you also use/extend the WinAPI
namespace as is done in the info_disk
function?
I'm not well-versed with C#, so I'll ping @AwesomeCronk (who wrote the |
Maybe you could try merging those two C# code segments into one, so it compiles in one pass. On my machine I didn't see any significant difference after merging them tho. The C# code itself cannot be significantly improved from what I know, the Win32 APIs are the only solution to this and it's as fast as it can get through PInvoke. |
I don't think merging is the solution for this. In the above screenshot I disabled all segments and only tested the resolution segment. Moreover people would need to disable disk and resolution segments independently, so merging their codes would not be very efficient. What happens if we move the string processing part out of the C# segment? (Note that the info_disk function manipulates strings in PowerShell itself, the C# part is only for the API calls). |
Umm yeah, I agree not merging them. I comment out the returning of strings in |
👍 fixed |
- Gets the current resolution scale by getting DisplayTransferCharacteristic from WmiMonitorBasicDisplayParams - Divides by 96 to get the scale from the given PPI - ~2x Slower than the current (but broken) implementation w/o PowerShell bottleneck - 34 ms -> 84 ms - ~2.7x Faster than lptstr#131 w/o PowerShell bottleneck - 230 ms
- Added two methods of getting screen resolution - First one runs if running as admin, and gets the screen information from HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration\ - Location contains refresh rate, so I added that in too - Second method uses implementation in lptstr#131 which is about 4x slower for me, but seems to be the only way to get it working that I can find
Continuation of #126
Close #76