Skip to content
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

Possibly identified the cause of window moving/sizing issues (seems due to animation timing and using move/size independently) #3731

Open
MarqueIV opened this issue Dec 29, 2024 · 0 comments

Comments

@MarqueIV
Copy link

MarqueIV commented Dec 29, 2024

There seems to be an issue with setFrame, the grid-related functions and anything else related to window moving/sizing, and I think I've identified the issue as being related to the new os animations.

Specifically, it seems if you attempt to move/size a window while there's an existing animation, that action gets interrupted with the new call, thus the window isn't moved/sized correctly.

The hack I've come up with to get around this is rather than this....

window.setFrame(targetFrame)

I now do this...

window.setTopLeft({
    x=targetFrame.x,
    y=targetFrame.y
})

os.execute("sleep 0.25") -- Must be long enough to allow the move animation to complete.

window.setSize({
    w=targetFrame.w,
    h=targetFrame.h
})

where 0.25 seconds is usually enough to ensure the move animation happens completely before the resize operation. (You can reverse the order and you'll have the same effect.)

I've also seen cases where moves requiring longer distances equally require a longer time to animate, but the above seems to work for my particular use-case.

I'm somewhat confident this is the issue as when I reduce the delay, say down to 0.1 seconds (any value less than the needed animation), windows don't end up where they're supposed to be. It's also incredibly subtle if you're right at the limit of the animation as it can seem the sizing is only a few pixels off, when in reality, the correct values were set, it was just interrupted right before it was completely animated into place/size.

As I said, I have this workaround, but I'm not crazy about it as now there are essentially two animations that happen when moving/sizing windows, but at least they end up where they're supposed to be.

@MarqueIV MarqueIV changed the title Issue with window moving/sizing due to animation timing Possibly identified the issue with window moving/sizing (seems due to animation timing) Dec 29, 2024
@MarqueIV MarqueIV changed the title Possibly identified the issue with window moving/sizing (seems due to animation timing) Possibly identified the cause of window moving/sizing issues (seems due to animation timing and using move/size independently) Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant