-
Notifications
You must be signed in to change notification settings - Fork 81
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
Prevent display sleep while game is running on macOS #1602
base: master
Are you sure you want to change the base?
Conversation
Was NSProcessInfo beginActivityWithOptions:reason: considered as an alternative? Implementing beginActivityWithOptions:reason: has been on my list of things to do because I also feel like the app is less responsive when it's not in the foreground, which may reflect something like not passing a NSActivityUserInitiated or NSActivityBackground flag. |
I did not know that existed... all my investigation led to the IOKit API, which is also what's used internally by the One advantage of the IOKit code (besides it being C API and not ObjC 😛) is that it works back to OS X 10.5, whereas the NSProcessInfo code looks to be 10.7 and up only. Do you know if there's an actual difference in implementation between the two, or does NSProcessInfo just call out to IOKit? |
beginActivity: seems to require 10.9 - which would be even higher. But - beginActivity also controls our QoS level in the operating system, which the IOKit call does not do. The reason I've been suspicious we might need this call is that our login window will not appear until the app is brought to the foreground - which could imply our run loop is getting squashed. Application/backgrounding QoS was not introduced until later. Very possibly that release was 10.9. So the IOKit call would not cover that. It's a bit of a mess, but:
FWIW - I'd prefer if there was a compile path that did not include IOKit at all for later builds. It's not critical - but IOKit has bit by bit been getting deprecated or restricted. So it would be preferable if the modern builds didn't link IOKit just to reduce risk. Could just be that I'm overly cautious on IOKit use - but again, been seeing a lot of IOKit API getting deprecated. |
What's the status here? It would nice to get this resolved. |
I'd still like NSActivity to be used on newer SDKs. I'd prefer not to include IOKit as it's quickly becoming more and more deprecated, and NSActivity gives us more flexibility. |
I'm converting this to a draft because there is outstanding feedback and to clarify from the main PR page what the status is. |
Closes #1600