Skip to content

Commit

Permalink
Update rawdraw_sf to current master
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlohr committed Oct 3, 2024
1 parent f7f8fcb commit 51b7ca2
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions rawdraw_sf.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//This file was automatically generated by Makefile at https://github.com/cntools/rawdraw
//Generated from files git hash a53ea30df86f5876197873975efee3dbc983a942 on Mon Jun 10 06:52:08 PM PDT 2024 (This is not the git hash of this file)
//Generated from files git hash f7f8fcb9537c65f2097cf1bfd87a7979d21e7c1c on Thu Oct 3 04:32:19 PM PDT 2024 (This is not the git hash of this file)
// Copyright 2010-2021 <>< CNLohr, et. al. (Several other authors, many but not all mentioned)
// Licensed under the MIT/x11 or NewBSD License you choose.
//
Expand Down Expand Up @@ -536,6 +536,7 @@ extern "C" {

extern struct android_app * gapp;
void AndroidMakeFullscreen();
const char* AndroidGetExternalFilesDir();
int AndroidHasPermissions(const char* perm_name);
void AndroidRequestAppPermissions(const char * perm);
void AndroidDisplayKeyboard(int pShow);
Expand Down Expand Up @@ -4520,6 +4521,7 @@ extern "C" {

extern struct android_app * gapp;
void AndroidMakeFullscreen();
const char* AndroidGetExternalFilesDir();
int AndroidHasPermissions(const char* perm_name);
void AndroidRequestAppPermissions(const char * perm);
void AndroidDisplayKeyboard(int pShow);
Expand Down Expand Up @@ -5332,6 +5334,30 @@ void AndroidMakeFullscreen()
JAVA_CALL_DETACH
}

const char* AndroidGetExternalFilesDir()
{
const struct JNINativeInterface * env = 0;
const struct JNINativeInterface ** envptr = &env;
const struct JNIInvokeInterface ** jniiptr = gapp->activity->vm;
const struct JNIInvokeInterface * jnii = *jniiptr;

jnii->AttachCurrentThread( jniiptr, &envptr, NULL);
env = (*envptr);
jclass activityClass = env->FindClass( envptr, "android/app/NativeActivity");
jobject lNativeActivity = gapp->activity->clazz;

jmethodID mid_getExtStorage = env->GetMethodID(envptr,activityClass,"getExternalFilesDir", "(Ljava/lang/String;)Ljava/io/File;");
jobject obj_File = env->CallObjectMethod(envptr,lNativeActivity, mid_getExtStorage, NULL);
jclass cls_File = env->FindClass(envptr,"java/io/File");
jmethodID mid_getPath = env->GetMethodID(envptr,cls_File, "getPath", "()Ljava/lang/String;");
jstring obj_Path = (jstring) env->CallObjectMethod(envptr,obj_File, mid_getPath);
const char* path = env->GetStringUTFChars(envptr,obj_Path, NULL);
//printf("EXTERNAL PATH = %s\n", path);
env->ReleaseStringUTFChars(envptr,obj_Path, path);
jnii->DetachCurrentThread( jniiptr );
return path;
}

void AndroidDisplayKeyboard(int pShow)
{
//Based on https://stackoverflow.com/questions/5864790/how-to-show-the-soft-keyboard-on-native-activity
Expand Down Expand Up @@ -6020,9 +6046,10 @@ int CNFGHandleInput()
void CNFGSetVSync( int vson )
{
void (*glfn)( int );
void (*glfnXE)( Display *, GLXDrawable, int );
glfn = (void (*)( int ))CNFGGetExtension( "glXSwapIntervalMESA" ); if( glfn ) glfn( vson );
glfn = (void (*)( int ))CNFGGetExtension( "glXSwapIntervalSGI" ); if( glfn ) glfn( vson );
glfn = (void (*)( int ))CNFGGetExtension( "glXSwapIntervalEXT" ); if( glfn ) glfn( vson );
glfnXE = (void (*)( Display *, GLXDrawable, int ))CNFGGetExtension( "glXSwapIntervalEXT" ); if( glfn ) glfnXE( CNFGDisplay, CNFGWindow, vson );
}

#ifdef CNFGRASTERIZER
Expand Down

0 comments on commit 51b7ca2

Please sign in to comment.