On Fri Jun 28 16:59:24 2024 +0000, Tim Clem wrote:
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.
I'm seeing these issues now (though I didn't have to revert !5798). Not sure how I missed them earlier.
I tried doing everything in the background thread that `getCurrentProcessShareableContent` is called back on, but it didn't help - `captureImageWithFilter:` still doesn't call its block until the window is restored. Doing something heinous like blocking the main thread until the SCK calls complete actually does work and grab a snapshot in time, but I'd really rather not do that.
Not sure what our best option is. Maybe Apple can make SCK able to capture miniaturized windows, or perhaps they can make `CGWindowListCreateImageFromArray` not prompt for permissions if you're asking for images of windows from your own app. Any thoughts?