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

Use nativeSetenv() provided by SDL2 and cleanups #1690

Merged
merged 1 commit into from
Feb 7, 2019

Conversation

j-devel
Copy link
Contributor

@j-devel j-devel commented Feb 7, 2019

Since 16b07ed (bumping SDL2 version from 2.0.4 to 2.0.9), pythonforandroid/recipes/sdl2/add_nativeSetEnv.patch that provides nativeSetEnv() is obsolete (in terms of patching location). Furthermore, we don't even need this patch now because SDL2-2.0.9 itself provides the same functionality called nativeSetenv() (NOT nativeSetEnv(), beware the character's case!!) as follows:

$ ack nativeSetenv SDL2-2.0.9
SDL2-2.0.9/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
724:    public static native void nativeSetenv(String name, String value);
947:                    nativeSetenv(name, value);

SDL2-2.0.9/src/core/android/SDL_android.c
135:JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)(
884:JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)(

This PR is to

  • remove the obsolete patch file, and
  • replace the usages of the old nativeSetEnv() with nativeSetenv() of SDL2-2.0.9.

Note: the occurrences of nativeSetEnv() in bootstraps/pygame/build/src/org/renpy/android/SDLSurfaceView.java are intact since this is code is based on SDL1.2 which is now a legacy (and so is pygame...).

@AndreMiras AndreMiras requested review from a user and opacam February 7, 2019 10:07
@AndreMiras
Copy link
Member

Thanks for the PR! I can't remember if it was @Jonast or @opacam who did some huge effort updating SDL2. It would be great if one of the two could take a look at that PR 🙏

@opacam
Copy link
Member

opacam commented Feb 7, 2019

Ok, I took a look and it seems fine to me (also I have tested it for python2 and python3...and all goes well). Still I prefer that @Jonast or @inclement approve this changes (they made the latest sdl2 related changes in python-for-android and kivy...his knowledge of this is better than mine 😉)

@@ -404,7 +404,7 @@ public static void stop_service() {
}


public static native void nativeSetEnv(String j_name, String j_value);
public static native void nativeSetenv(String name, String value);
Copy link

Choose a reason for hiding this comment

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

Is this required given this is already defined in the parent class SDLActivity? I'm not 100% brushed up on my java knowledge but this looks like it might be redundant to me

Copy link

@ghost ghost Feb 7, 2019

Choose a reason for hiding this comment

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

oh right nevermind this is in a non-SDL2 bootstrap, I missed that for a second. all fine 👍

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Looks very reasonable to me! I like that you renamed it for the other bootstraps as well so it's still unified. I can't see anything obviously wrong with it, so if this builds & runs fine then it looks good as far as I'm concerned 👍

@inclement inclement merged commit 282e43d into kivy:master Feb 7, 2019
@inclement
Copy link
Member

Great, thanks, especially unifying the other bootstraps :)

@j-devel j-devel deleted the use-sdl2-nativeSetenv branch February 8, 2019 02:50
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.

4 participants