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

Add higher-performance, image based hs.window:setSize() #923

Closed
eproxus opened this issue Jun 19, 2016 · 9 comments
Closed

Add higher-performance, image based hs.window:setSize() #923

eproxus opened this issue Jun 19, 2016 · 9 comments

Comments

@eproxus
Copy link

eproxus commented Jun 19, 2016

When using setFrame moving a window is buttery smooth, but when the window changes size it feels like the frame rate is 10 FPS or something. The animation duration is configurable via hs.window.animationDuration but can the frame rate for window resizing be made configurable or increased to something smoother?

@lowne
Copy link
Contributor

lowne commented Jun 22, 2016

HS (tries to) handle window animations at 60 fps internally iirc.
My guess is that window movement is fully handled by the OS (and hardware accelerated to boot), whereas resizing a window triggers a full repaint on the owning application, which inevitably is much slower.

@cmsj
Copy link
Member

cmsj commented Jun 22, 2016

yes, moving a window is just moving a texture around in GPU memory. resizing involves lots of round-trips to the application and all the UI frameworks, to redraw.

@szymonkaliski
Copy link
Contributor

Back when I was porting someone's pull request for mjolnir into https://github.com/szymonkaliski/mjolnir.sk.transform which later made it into HS (AFAIK), I had an idea to grab the contents of window as image, animate the image transformation (much faster), and in last few ticks of animation actually move the window to new place (triggering the actual window-resize only once). Never actually made it, and don't have time to play around it currently, but if some of you have — I'd love to see it! :)

@lowne
Copy link
Contributor

lowne commented Jun 22, 2016

I don't think drawings are fast enough to do that (or at least they didn't use to), a lower-level approach (or an FFI...) would probably be necessary.

@szymonkaliski
Copy link
Contributor

Yeah, I wasn't thinking about hs.drawing, it wasn't even around back then :)

@eproxus
Copy link
Author

eproxus commented Jun 23, 2016

Make sense that it is the OS/app redraw that's expensive. Should I close the ticket? 😄

@cmsj
Copy link
Member

cmsj commented Aug 26, 2016

@eproxus depends if we want to do the version of this that's resizing an image. I would think we'd either want to have it as its own feature in hs.window, or we'd teach hs.drawing to do animated resizes, which would be very fast if they used the system APIs rather than some kind of hs.timer driven madness.

I'll leave it open as a "help wanted" enhancement, and we can see if anyone picks it up :)

@cmsj cmsj changed the title Window resizing animation is laggy Add higher-performance, image based hs.window:setSize() Aug 26, 2016
@eproxus
Copy link
Author

eproxus commented Sep 11, 2016

Resizing windows with the mouse in OS X is quite responsive. Can't we just decrease the step size a bit, to find a sweet spot?

@cmsj
Copy link
Member

cmsj commented Sep 4, 2017

I'm going to close this out because it doesn't seem to be going anywhere. If someone would like to work on it, please feel free to re-open. Sorry!

@cmsj cmsj closed this as completed Sep 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants