Todd1561 / TANWindowMgr

Reposition windows at the click of the mouse
87 stars 6 forks source link

Applications that are snapped does not restore properly #9

Open Cra7y opened 4 years ago

Cra7y commented 4 years ago

I tried to save 4 applications which were snapped the corners of the screen using the windows snapping feature. When restored this left the windows jumbled. However when the applications are manually resized and placed in the same fashion and saved, restoring works as expected.

Otherwise, thanks for the great software. Easy to use and does the job!

sum5l commented 3 years ago

I just noticed the same behaviour, but discovered, that loading the profile twice does the trick for me. Some of the snapped windows do have the correct upper left coordinates but not the right size. Loading the profile again finishes the job in my case.

Todd1561 commented 3 years ago

Interesting, I tried the double profile load you suggested and it didn't work for me. But no matter I think I have this problem fixed for real. After some more research I found by using the GetWindowRect API function I can reliably get the position/size of snapped windows. I'm continuing to use GetWindowPlacement to get the maximized/minimized state. The GetWindowPlacement function only reports the most recent restored size and has no awareness of snapping. In my testing this seems to work perfectly, let me know if this works for you. The latest 1.4 release has these changes https://github.com/Todd1561/TANWindowMgr/releases/tag/1.4

Todd

sum5l commented 3 years ago

Oh I see. I assumed the cmd line and the gui profile load would call the same function or at least work in the same way.

With the 1.4:

Messenger,3840,5,650,5040,1,Messengers Discord,3840,650,1254,5040,1,Messengers Telegram,3840,1254,1885,5040,1,Messengers

Thats my .ini file for this profile; the resolution for this display is 1200x1920, but I can't make too much sense of the coordinates. Should I save the window positions again with the 1.4?

Todd1561 commented 3 years ago

Yes the cmd line and GUI use the same function to save/restore windows, there should be no difference. And yes, you need to reposition your windows and re-save the profile for these fixes the take effect, sorry I should have made that clear. The issue was on the saving side, not the reposition side, so your original file was not made correctly if it had snapped windows.

I'm not sure why you'd be seeing different behavior between cmd line and GUI. But start by regenerating your file and try both methods and let me know if it's consistent.

sum5l commented 3 years ago

Re-saving the positions in the same or another profile doesn't help. I also discovered, that

this applies both to GUID and CMD usage. So the difference isnt the GUI/CMD but the state of the window? Probably?

Todd1561 commented 3 years ago

Hmm I'm not sure what to suggest, I've tried everything you've described and can't reproduce that behavior with the 1.4 release with either the cmd usage or GUI. I have 4 monitors with 3 different screen resolutions and have snapped windows to the sides of different screens and they all restore properly. Only thing I can think of is there being something odd with the programs you're trying to use with this, I don't have any of those 3 listed to test with. The only instance of an app-specific issue did ironically involve Discord, but that was fixed some time ago in this issue https://github.com/Todd1561/TANWindowMgr/issues/1

Maybe try snapping a couple generic apps like Notepad or Chrome and test?

janmagnusdev commented 2 years ago

This also does not work for me, but rather than default snapped windows I am using the Windows PowerToys layout feature. When restoring, the windows get back slightly below the position they have been at before. Also, it would be great if closed windows would be reopened automatically, so that you do not have to open them yourself manually.