On Sun, Nov 21, 2021 at 02:09:53AM -0700, Jaimos Skriletz wrote: > On Sat, Nov 20, 2021 at 5:22 PM Dominik Vogt <dominik.v...@gmx.de> wrote: > > 2) Please break up the calculations in DoSnapGrid into multiple > > lines unsing temp variable. It's too hard to read = hard to > > maintain. The previous un-readability of the code shouldn't be > > the standard we aim at. ;-) > > I tried to clean this up a bit, was mostly just cutting/pasting code. > > > 3) Same for "smap_mon = ...". Ouch. > > Agreed, tried to simplify it a bit.
Thanks, looks good. > Returning a single score won't work, since vertical and horizontal are > treated separately. Yeah. There are many things I'd like to clean up in the snapattraction and the move code. The code duplication for x + y is one of them. The whole move_resize.c should use the types position, rectangle and size_rect. But that's not important at the moment. (P.S.: And the "xl" and "yt" named drive me crazy.) > > 5) Edge resistance is a kind of reverse snapping with a different > > snap distance: A window that has been moved past the screen > > edge "snaps" back until it has moved more than the edge > > resistance past the edge. This is exactly what snapattraction > > does, just with the snap distance from a different variable. > > > > Can that be merged with the new code? > > This ended up being a bit more complicated, since the resistance isn't > the same as snap attraction (since snap attraction snaps both > left/right but resistance is only one direction). But I was able to > update the monitor function to be able to now deal with both snapping > and resistance by passing it a few bools to control its behavior. I > also took advantage of the new info about if a monitor edge is an > outside or inside edge to distinguish resistance between monitors and > between pages. Though the code is a bit more complicated, I hope it is > readable. Looks much cleaner now! > > I.e. the top/left/right/bottom border of a window shouldn't snap > > to the bottom/right/left/top border of a windows if that latter is > > aligned with a screen edge. > > > > I have added a final check in DoSnapWindow that ignores snapping to > windows on the monitor edge. I think this fixes the issue. Great, that bug is gone. Overall, in a quick test of the situation that made me start this thread, all the annoyances are gone. It behaves totally predictable and glitch free now. The code is much cleaner, easier to read and the indentation is sane. I'm good with committig this patch to master. Ciao Dominik ^_^ ^_^ -- Dominik Vogt