XSDL: use /proc/self/cwd as data dir for libX11

This commit is contained in:
Sergii Pylypenko
2014-12-18 21:14:47 +02:00
parent a839733973
commit d7aa0239be
11 changed files with 23 additions and 17 deletions

View File

@@ -7,10 +7,10 @@ AppName="XServer XSDL"
AppFullName=x.org.server
# Application version code (integer)
AppVersionCode=11118
AppVersionCode=11119
# Application user-visible version name (string)
AppVersionName="1.11.18"
AppVersionName="1.11.19"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu

View File

@@ -26,11 +26,12 @@ cd android
} || exit 1
cd $1
[ -e libfontenc-*/Makefile ] && {
grep "/data/data/$PACKAGE_NAME" libfontenc-*/Makefile || \
grep "/proc/self/cwd" libfontenc-*/Makefile || \
git clean -f -d -x .
}
env TARGET_DIR=/data/data/$PACKAGE_NAME/files \
# Megahack: set /proc/self/cwd as the X.org data dir, and chdir() to the correct directory when runngin X.org
env TARGET_DIR=/proc/self/cwd \
./build.sh || exit 1
env CURDIR=$CURDIR \

View File

@@ -699,6 +699,7 @@ void showErrorMessage(const char *msg)
void XSDL_initSDL()
{
char fontpath[PATH_MAX];
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK);
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Current video mode: %d %d", SDL_ListModes(NULL, 0)[0]->w, SDL_ListModes(NULL, 0)[0]->h);
@@ -708,7 +709,9 @@ void XSDL_initSDL()
else
SDL_SetVideoMode(VID_Y, VID_X, 0, SDL_SWSURFACE);
TTF_Init();
sFont = TTF_OpenFont("DroidSansMono.ttf", 14);
strcpy( fontpath, getenv("UNSECURE_STORAGE_DIR") );
strcat( fontpath, "/DroidSansMono.ttf" );
sFont = TTF_OpenFont(fontpath, 14);
if (!sFont)
{
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Error: cannot open font file, please reinstall the app");

View File

@@ -146,7 +146,7 @@ int main( int argc, char* argv[] )
getenv("SECURE_STORAGE_DIR"),
getenv("SECURE_STORAGE_DIR") );
XSDL_generateBackground(port, printHelp, resolutionW, resolutionH);
XSDL_generateBackground( port, printHelp, resolutionW, resolutionH );
XSDL_deinitSDL();
@@ -155,14 +155,14 @@ int main( int argc, char* argv[] )
if( printHelp )
{
sprintf( clientcmd, "%s/usr/bin/xhost + ; %s/usr/bin/xli -onroot -center background.bmp",
getenv("SECURE_STORAGE_DIR"), getenv("SECURE_STORAGE_DIR") );
sprintf( clientcmd, "%s/usr/bin/xhost + ; %s/usr/bin/xli -onroot -center %s/background.bmp",
getenv("SECURE_STORAGE_DIR"), getenv("SECURE_STORAGE_DIR"), getenv("UNSECURE_STORAGE_DIR") );
args[argnum] = "-exec";
args[argnum+1] = clientcmd;
argnum += 2;
}
SDL_ANDROID_SetScreenKeyboardShown(1);
SDL_ANDROID_SetScreenKeyboardShown( 1 );
if( screenButtons && !SDL_ANDROID_GetScreenKeyboardRedefinedByUser() )
{
@@ -193,7 +193,9 @@ int main( int argc, char* argv[] )
__android_log_print(ANDROID_LOG_INFO, "XSDL", "> %s", args[i]);
// We should never quit. If that happens, then the server did not start - show error.
atexit(&showError);
atexit( &showError );
__android_log_print(ANDROID_LOG_INFO, "XSDL", "XSDL chdir to: %s", getenv("SECURE_STORAGE_DIR"));
chdir( getenv("SECURE_STORAGE_DIR") ); // Megahack: change /proc/self/cwd to the X.org data dir, and use /proc/self/cwd path in libX11
return android_main( argnum, args, envp );
}