-
Notifications
You must be signed in to change notification settings - Fork 446
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
Android) add mechanics to resume application from background #660
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, this is about handling the case where GL context isn't lost and just the window surface is, right? So it's not like existing GL objects become invalid afterwards.
I'll have to think how to expose this in a way that makes sense with other apps. I can imagine that for example on desktop with SDL/GLFW one might want to attach to some focusEvent()
/ blurEvent()
as well, when the window gets active or inactive.
/* Pause the context current */ | ||
CORRADE_INTERNAL_ASSERT_OUTPUT(eglMakeCurrent(_display, nullptr, nullptr, nullptr)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this work if you kept the context current and just made it bound to no surface at all?
/* Pause the context current */ | |
CORRADE_INTERNAL_ASSERT_OUTPUT(eglMakeCurrent(_display, nullptr, nullptr, nullptr)); | |
/* Keep the GL context current but without any surface */ | |
CORRADE_INTERNAL_ASSERT_OUTPUT(eglMakeCurrent(_display, EGL_NO_SURFACE, EGL_NO_SURFACE, _glContext)); |
Because I'm wondering if it's guaranteed that no app code gets executed between APP_CMD_LOST_FOCUS
and APP_CMD_INIT_WINDOW
. And if it does, it'd be probably good to have the GL context current.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The suggested change, at least from my side, seems to work fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if it's guaranteed that no app code gets executed between APP_CMD_LOST_FOCUS and APP_CMD_INIT_WINDOW
I'm not sure about there being a guarantee, but it's one of the reasons I added _application_has_valid_surface
- such that the user has some info to branch on.
Currently, the application will crash if sent to the background and brought back to the foreground.
The following provides a mechanism to continue the application.