On Fri Jun 28 16:59:24 2024 +0000, Brendan Shanks wrote:
I tested this out by commenting out most of `grabDockIconSnapshotFromWindow:force:` and just setting `window = self`, so minimizing always results in a screenshot of the window being used for the dock tile. With the ScreenCaptureKit code path (on 14.5), when minimizing I only saw the `getCurrentProcessShareableContentWithCompletionHandler:` completion handler run (and its dispatch to the main thread). The `captureImageWithFilter:` completion handler then doesn't run until I un-minimize the window, which is very weird. This means that the first minimize of a window doesn't set the dock tile, every subsequent minimize then shows the dock tile image that should have been used for the previous minimize. I'm not sure why this is, maybe the async-ness means that the window is minimized by the time `captureImageWithFilter:` is called, and it just won't capture an image until the window is restored? Maybe the `getCurrentProcessShareableContentWithCompletionHandler:` completion handler could do everything there instead of dispatching back to the main thread (which seems to cause a 0.5-1 sec delay on my heavily loaded machine)? Also, it seems like !5798 is causing issues with minimize thumbnails, I had to revert that to get correct minimize thumbnails (with screenshot or non-screenshot methods).
Yikes! Thanks for reviewing. I wasn't seeing any of those issues on Sonoma or Sequoia, with the same sort of testing procedure. I was hoping the async-ness wouldn't be an problem, but I guess it is.
I originally had the `getCurrentProcessShareableContentWithCompletionHandler:` do everything without the dispatch, but since it wasn't making a difference for me I just did everything on the main thread. I'll try to reproduce locally and see what helps.