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

implement wakelock for sdl2 #1066

Merged
merged 1 commit into from
Jul 2, 2017
Merged

Conversation

brentpicasso
Copy link
Contributor

resolves #1061.

Not sure if this is the best implementation, but seems to work based on my limited testing.

@brentpicasso
Copy link
Contributor Author

brentpicasso commented Jun 5, 2017

Note, I tried to implement the approach in the pygame implementation, but I didn't get the initial onResume() when the app first fired up. So, I acquired the lock immediately if the flag was set; seemed like there was no reason for it to not work that way.

The pygame implementation seemed cleaner with only one acquire and one release present, however.

Feedback appreciated; interested in getting this merged ASAP as my app needs wakelock. :)

@inclement
Copy link
Member

inclement commented Jun 8, 2017

Thanks for the PR, it looks okay but I haven't had time to test it yet.

There's actually an alternative way to do this with SDL2, which in Kivy you can access with from kivy.core.window import Window and Window.allow_screensaver = False. I think this uses FLAG_KEEP_SCREEN_ON rather than a wakelock.

@brentpicasso
Copy link
Contributor Author

thanks for checking it out. Happy to continue using the official mechanism if it's not being deprecated.

@inclement
Copy link
Member

Seems good, thanks.

@inclement inclement merged commit 1a4a2c3 into kivy:master Jul 2, 2017
@Override
protected void onPause() {
// fooabc
if ( this.mWakeLock != null && mWakeLock.isHeld()){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not this.mWakeLock.isHeld()?

@brentpicasso brentpicasso deleted the sdl2_wakelock branch March 27, 2022 20:16
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

Successfully merging this pull request may close these issues.

wakelock == 1 not preventing screen from locking on sdl2
2 participants