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

Fix Outdated SDLActivity #1347

Closed
wants to merge 1 commit into from
Closed

Conversation

krinnewitz
Copy link
Contributor

@krinnewitz krinnewitz commented Aug 30, 2018

While updating the SDL2 recipe to version 2.0.4 in PR #713, the
SDLActivity was not updated accordingly.

For example, SDL 2.0.4 expects the Activity to have a method called
"openAPKExpansionInputStream" while this method was called
"openAPKExtensionInputStream" in older versions. SDL2 is not able to
read files when the method is missing.

This can result in multiple problems, e.g. segfaults. For example,
without this fix, you get NULL when loading a font using SDL2_ttf,
because SDL_RWFromFile needs openAPKExpansionInputStream.

Also, text input is partly broken as it is not possible to enter a
"space" character.

This PR replaces the SDLActivity with the one from SDL2-2.0.4 preserving the
adjustments that seem to be introduced by the python-for-android developers.

While updating the SDL2 recipe to version 2.0.4 in PR kivy#713, the
SDLActivity was not updated accordingly.

For example, SDL 2.0.4 expects the Activity to have a method called
"openAPKExpansionInputStream" while this method was called
"openAPKExtensionInputStream" in older versions. SDL2 is not able to
read files when the method is missing.

Also, text input is partly broken as it is not possible to enter a
"space" character.
@krinnewitz krinnewitz changed the title Fix SDL File Handling Fix Outdated SDLActivity Aug 30, 2018
@ghost
Copy link

ghost commented Sep 6, 2018

I am seeing spurious segfaults on app resume. I wonder if those are related? It would be interesting to see this merged and see if it makes those go away

@krinnewitz
Copy link
Contributor Author

Maybe. Until it is merged, you can test it using my fork:

pip install --user -U git+https://github.com/plapadoo/python-for-android.git

@@ -1063,7 +1111,43 @@ public void surfaceChanged(SurfaceHolder holder,
mWidth = width;
mHeight = height;
SDLActivity.onNativeResize(width, height, sdlFormat, mDisplay.getRefreshRate());
Log.v("SDL", "Window size:" + width + "x"+height);
Log.v("SDL", "Window size: " + width + "x" + height);
Copy link

Choose a reason for hiding this comment

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

You used Log.v(TAG, ...) in most places now, but not here. Is that an oversight maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What I did in this PR is just replacing the SDLActivity with the one that comes with SDL 2.0.4 and then merging some changes by the python-for-android team back in.

Here, the SDL guys dediced to not use the TAG constant and to just keep the raw "SDL" string. Don't ask me why :P

Copy link

Choose a reason for hiding this comment

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

Haha okay, that explains it. Well it's no biggie, it's not like the output prefix is vital. Just something that stumped me

@ghost
Copy link

ghost commented Dec 16, 2018

This is superseded by #1528 (which updates both SDL2 and the SDLActivity + related .java classes to the latest 2.0.9 version)

@ghost
Copy link

ghost commented Jan 15, 2019

@krinnewitz is it ok if I close this for now? I'm pretty sure the more comprehensive SDL 2.0.9 version bump covers this and gets us to an even more recent SDLActivity.java that matches the native library version

thanks again for your work! sorry it was delayed so long that we didn't get this in before actually coming up with something newer

@krinnewitz
Copy link
Contributor Author

Yes, perfectly fine. Having SDL 2.0.9 is even better!

@krinnewitz krinnewitz closed this Jan 15, 2019
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.

1 participant