Skip to content

implement wakelock for sdl2#1066

Merged
inclement merged 1 commit intokivy:masterfrom
autosportlabs:sdl2_wakelock
Jul 2, 2017
Merged

implement wakelock for sdl2#1066
inclement merged 1 commit intokivy:masterfrom
autosportlabs:sdl2_wakelock

Conversation

@brentpicasso
Copy link
Copy Markdown
Contributor

resolves #1061.

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

@brentpicasso
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

@inclement
Copy link
Copy Markdown
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
Copy Markdown

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