Window sizes are not correctly resized when crossing monitors with different DPI scalings
foriequal0 opened this issue · 28 comments
I use a laptop (14", 3840x2400, 225% DPI scaling) with an external monitor (27", 3840x2160, 150% DPI scaling)
Window sizes are not correctly resized when I drag a window using AltSnap over a different screen.
When I drag a window that looks like 'A' in the laptop screen to the external monitor using AltSnap, then it becomes like 'B'.
A:
B:
When I drag a window that looks like 'C' in the external monitor to the laptop screen using AltSnap, then it becomes like 'D'.
C:
D:
Their contents are correctly DPI scaled, but the pixel size of window sizes aren't.
They are restored back if I move the incorrectly sized window back to the original monitor.
It doesn't happen if I use the title bar to drag.
This is quite strange, AltSnap should handle this situation, do you have the problem with the original AltDrag when forcing the application dpi-awareness correctly?
stefansundin/altdrag#7 (comment)
Oh I thought the override fixed the issue, but it isn't. I deleted the comment.
With the override,
both AltSnap and AltDrag have same behavior for themselves:
The contents are now not scaled correctly, and the window size is not still resized correctly.
For other windows:
AltDrag: It resizes the window size correctly, but it's buggy.
AltSnap: It still doesn't resize the window size correctly.
- I've edited comment few times.
Something must have changed in Windows 11, because:
- The override should have no effect on AltSnap as it should already be part of its manifest file.
- The override with AltDrag, was fixing the issue on Windows 8/10 and early Windows 11 builds,
Could you try all other DPI override settings, and use a test window that is not from AltSnap itself because it does not help me much, I would rather see Notepad's Window. If you use AltSnap's Window the dpi override might have different meaning there because it is AltSnap moving itself, it is a mess.
I do not have access to multiple monitors nor to Windows 10/11
I've tested it on Notepad, Explorer.
AltSnap:
Application: it doesn't resize window correctly.
System/System(Advanced): it resizes window correctly, but the cursor position mapping seem to be wrong. It drags other window that isn't under the cursor.
AltDrag:
Application: It resizes the window correctly, but it's buggy.
System/System(Advanced): Unusably buggy. It mess up the window size and DPI on every cursor movement, but the cursor position mapping is correct. I can drag the window under the cursor.
Could you try older AltSnap versions?
Like Version 1.47 and 1.54?
I am sure that in the past moving a windows between monitors with different dpi settings worked fine. I was testing on Windows 10 though.
Also could you try with the FullWin=0 option in the [Performance] section of the ini file, it will drag a hollow rectangle
Also could you try after disabling the Simulate AeroSnap option.
1.60:
Always incorrect.
Disabling Mimic AeroSnap: no difference.
FullWin=0: Hollow rectangle size is incorrect, but the resulting window size is correct.
1.54:
Sometimes wrong, sometimes correct.
Disable Mimic AeroSnap: Works correctly.
FullWin is same as 1.60
1.47:
Sometimes wrong, sometimes correct.
Disable Mimic AeroSnap: Works correctly.
FullWin is same as 1.60, but hollow rectangle is laggy.
1.57 is the first version that is always incorrect and disabling Mimic AeroSnap doesn't work.
Ok, very cool I think I understand now, I will come up with a fix when I got time.
In the meantime, you can either use pre-1.57 or set FullWin=0.
I tried a quick fix, could you try with this version of AltySnap.exe + hooks.dll (replace the old files after quitting AltSnap)
Keep in mind that it is untested, it just should fix the problem in theory, and it will probably not work perfectly. Also the hollow rectangle will still be buggy (I will work on this later)
64 bit build:
AltSnap1.61test3.zip
It still has the same problem as 1.60 😢
This version will do some logging, could you try a small drag and check the ad.log file, then check when doing a drag acfcros monitors. You can delete the ad.log file anytime to start from a new log
This hook almost fixed the issue. It correctly resized the window 90% of the time.
Can you let me know where the log is located?
It should generate a file named ad.log
located in AltSanp directory.
The amount of logging will be huge if you use FullWin=1
Oh sorry. Both 1.61test3 and 1.61test4 is similar.
I thought 1.61test3 isn't working because it was flaky. Both version success rate seems similar.
I think the success rate has weird correlation with system load, and the target window's resize performance.
Notepad has higher success rate because it's resizing is inherently quick
Explorer has lower success rate because it's resizing is inherently slow.
Then it must be a race condition, should not be too hard to figure out. Try with the test 4 and the FullWin=0 option. The hollow rectange should also be mostly fixed.
I can't find the ad.log from the AltSnap directory with 1.61test4 hook.dll
I can't find the ad.log from the AltSnap directory with 1.61test4 hook.dll
Strange, but try anyway with this next build (that is not supposed to do any logging this time):
It might fix the not 100% working issue, or make it worse (anyway will be interesting):
hooks1.61test5_x64.zip
Wow. I can confirm that hollow rectangle size is fixed with FullWin=0. (cursor offset is wrong now, but it is okay)
With FullWin=2, some session that worked 100% for both Notepad and Explorer, but after some restarts, now it works 99% for Notepad, but 0% for Explorer.
test4 and test5 is not that different.
And when you disable the Mimic AeroSnap, I guess it should behave better?
It's hard to say better 😢
Interesting indeed, Try again with this one:
Hopefully we are getting somewhere.
Still some do work always, and the others don't regardless AeroSnap.
Work ~100%: Notepad, Terminnal, BandiZip (very laggy though), mspaint.exe, Edge browser
Work ~0%: Explorer, Firefox, 1password, mstsc.exe
They are consistently observable from test3.
Can you see any correlations between them?
Interestingly, there's no more some artifacts around mstsc.exe from test6
(black inconsistent artifacts around mstsc.exe window from test5 hook.dll, domain is removed)
-edit: Edge didn't work in test5, but works in test6
-edit2: sorry to edit so much. edge didn't work in test5 is not reproduced after some restarts. I think I should take a nap 🤨
-edit3: edge doesn't work again, and explorer is 100% work now. the others are fairly consistent.
Well I will take some time to review other options and will come back towards you.
However you seems to say there are no improvements from test 6 right?
The fact that some windows are 100% reliable is encouraging, but I do not see why it would not work for others.
I would say there's no big improvements around 5-6, but it's surely better than 1.60.
It seems to be very weirdly flaky for now, and I'm very confused.
I'm very sorry for giving you inconsistent information 😵
Please take your time, and thank you so much for taking your precious time to investigate this issue.
Again a new test version:
hooks1.61test8_x64.zip
Wow! It works very reliably with programs if I turn off AeroSnap!
With AeroSnap turned on, it is ~90% correct, but it's way much better than before!
Thank you!
For AeroSnap you could try to set a value to the Max snapping speed in the advanced tab. good values are in the range 10-100pixels/64µs. if the cursor goes beyind this speed, snapping will not occur.
Thank you!
I've tested 1, 10, 100, 65536(default), but it doesn't seem to make it any better.
I actually rarely utilize AeroSnap. I think it could be improved in later versions.