iheckman / allsnap

Windows program that makes all windows snap when moving
MIT License
18 stars 2 forks source link

Snapping to screen edges is quirky in Windows 10 #1

Open ParticleMon opened 5 years ago

ParticleMon commented 5 years ago

I want to place app windows in and resize app windows to screen corners and to other app windows, which worked consistently in Windows 7 but does not in Windows 10.

I'm using the 32-bit and 64-bit versions of 1.50 Beta concurrently in Windows 10 with dual monitors.

Behavior in some apps is better than in others. Although some app windows snap to the top, it's nearly impossible to snap to the left and right screen edges. Some apps work better on the right monitor than on the left.

Experimenting with the grid settings and top crop setting has not helped much. Although window cropping may not be the ultimate answer, perhaps if crop settings were also provided for the bottom, left, and right, then those might help work around these issues?

joefallon commented 5 years ago

I fiddled with the code a bit and got it to compile in the latest version of Visual Studio. Then I altered the way snapping works and it now snaps closer to the edge of the screen in the vertical directions. However, my win32 API and C++ skills are not so hot. Basically, amateur hour for me. I am going to create a pull request from my fork. If you are able to fix, please feel free to create a PR too.

RamonUnch commented 2 years ago

There are two problems on Windows 10 if you want to implement snapping: 1) Your program needs to br DPI aware, you need to edit the .manifest file for this, you can see an example here: https://github.com/RamonUnch/AltSnap/blob/main/AltSnap.exe.manifest 2) you need to take into account the invisible borders, for this you need to use the DwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &rect, sizeof(RECT)); function, that is available in dwmapi.dll. I am the maintener of AltSnap, I discovered allSnap just today, looking for binaries that I can trust to see the features, I could transpose to AltSnap.