Enabled horizontal mouse wheel in SDL, updated XServer to support X86 and MIPS
This commit is contained in:
@@ -958,7 +958,7 @@ public class MainActivity extends Activity
|
||||
}
|
||||
|
||||
// ----- VCMI hack -----
|
||||
String [] binaryZipNames = { "binaries-" + android.os.Build.CPU_ABI + ".zip", "binaries.zip" };
|
||||
String [] binaryZipNames = { "binaries-" + android.os.Build.CPU_ABI + ".zip", "binaries-" + android.os.Build.CPU_ABI2 + ".zip", "binaries.zip" };
|
||||
for(String binaryZip: binaryZipNames)
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -127,7 +127,7 @@ AppUsesAccelerometer=n
|
||||
AppUsesGyroscope=n
|
||||
|
||||
# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0
|
||||
AppUsesMultitouch=y
|
||||
AppUsesMultitouch=n
|
||||
|
||||
# Application records audio (it will use any available source, such a s microphone)
|
||||
# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void);
|
||||
|
||||
@@ -7,10 +7,10 @@ AppName="XServer XSDL"
|
||||
AppFullName=x.org.server
|
||||
|
||||
# Application version code (integer)
|
||||
AppVersionCode=11109
|
||||
AppVersionCode=11110
|
||||
|
||||
# Application user-visible version name (string)
|
||||
AppVersionName="1.11.09"
|
||||
AppVersionName="1.11.10"
|
||||
|
||||
# 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
|
||||
@@ -18,7 +18,7 @@ AppVersionName="1.11.09"
|
||||
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
|
||||
# these files are put inside .apk package by build system
|
||||
# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS
|
||||
AppDataDownloadUrl="!!Data files|:data.tar.gz:data-1.tgz^!!Data files|:busybox:busybox^!!Data files|:DroidSansMono.ttf:DroidSansMono.ttf"
|
||||
AppDataDownloadUrl="!!Data files|:data.tar.gz:data-1.tgz^!!Data files|:DroidSansMono.ttf:DroidSansMono.ttf"
|
||||
|
||||
# Reset SDL config when updating application to the new version (y) / (n)
|
||||
ResetSdlConfigForThisVersion=y
|
||||
@@ -103,7 +103,7 @@ AppNeedsTwoButtonMouse=y
|
||||
ShowMouseCursor=n
|
||||
|
||||
# Generate more touch events, by default SDL generates one event per one video frame, this is useful for drawing apps (y) or (n)
|
||||
GenerateSubframeTouchEvents=y
|
||||
GenerateSubframeTouchEvents=n
|
||||
|
||||
# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n)
|
||||
ForceRelativeMouseMode=y
|
||||
@@ -127,7 +127,7 @@ AppUsesAccelerometer=n
|
||||
AppUsesGyroscope=n
|
||||
|
||||
# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0
|
||||
AppUsesMultitouch=y
|
||||
AppUsesMultitouch=n
|
||||
|
||||
# Application records audio (it will use any available source, such a s microphone)
|
||||
# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void);
|
||||
@@ -191,7 +191,7 @@ FirstStartMenuOptions='SettingsMenu.DummyMenu'
|
||||
|
||||
# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices,
|
||||
# but .apk size is 2x bigger (y) / (n) / (x86) / (all)
|
||||
MultiABI=armeabi-v7a
|
||||
MultiABI='armeabi-v7a x86 mips'
|
||||
|
||||
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
|
||||
AppMinimumRAM=0
|
||||
|
||||
@@ -4,8 +4,10 @@ CURDIR=`pwd`
|
||||
|
||||
PACKAGE_NAME=`grep AppFullName AndroidAppSettings.cfg | sed 's/.*=//'`
|
||||
|
||||
../setEnvironment-armeabi-v7a.sh sh -c '\
|
||||
$CC $CFLAGS -c main.c gfx.c' || exit 1
|
||||
../setEnvironment-$1.sh sh -c '\
|
||||
$CC $CFLAGS -c main.c -o main-'"$1.o" || exit 1
|
||||
../setEnvironment-$1.sh sh -c '\
|
||||
$CC $CFLAGS -c gfx.c -o gfx-'"$1.o" || exit 1
|
||||
|
||||
[ -e xserver/android ] || {
|
||||
CURDIR=`pwd`
|
||||
@@ -22,6 +24,7 @@ cd android
|
||||
git submodule update --init libancillary || exit 1
|
||||
cd ..
|
||||
} || exit 1
|
||||
cd $1
|
||||
[ -e libfontenc-*/Makefile ] && {
|
||||
grep "/data/data/$PACKAGE_NAME" libfontenc-*/Makefile || \
|
||||
git clean -f -d -x .
|
||||
@@ -31,10 +34,10 @@ env TARGET_DIR=/data/data/$PACKAGE_NAME/files \
|
||||
./build.sh || exit 1
|
||||
|
||||
env CURDIR=$CURDIR \
|
||||
../../../setEnvironment-armeabi-v7a.sh sh -c '\
|
||||
$CC $CFLAGS $LDFLAGS -o $CURDIR/libapplication-armeabi-v7a.so -L. \
|
||||
$CURDIR/main.o \
|
||||
$CURDIR/gfx.o \
|
||||
../../../../setEnvironment-$1.sh sh -c '\
|
||||
$CC $CFLAGS $LDFLAGS -o $CURDIR/libapplication-'"$1.so"' -L. \
|
||||
$CURDIR/main-'"$1.o"' \
|
||||
$CURDIR/gfx-'"$1.o"' \
|
||||
hw/kdrive/sdl/sdl.o \
|
||||
dix/.libs/libmain.a \
|
||||
dix/.libs/libdix.a \
|
||||
@@ -61,6 +64,13 @@ hw/kdrive/linux/.libs/liblinux.a \
|
||||
-lpixman-1 -lXfont -lXau -lXdmcp -lfontenc -lts -lfreetype -landroid-shmem' \
|
||||
|| exit 1
|
||||
|
||||
#-lfreetype is inside -lsdl_ttf
|
||||
rm -rf $CURDIR/tmp-$1
|
||||
mkdir -p $CURDIR/tmp-$1
|
||||
cd $CURDIR/tmp-$1
|
||||
cp $CURDIR/xserver/data/busybox-$1 ./busybox
|
||||
mkdir -p usr/bin
|
||||
for f in xhost xkbcomp xli ; do cp $CURDIR/xserver/android/$1/$f ./usr/bin/ ; done
|
||||
rm -f ../AndroidData/binaries-$1.zip
|
||||
zip -r ../AndroidData/binaries-$1.zip .
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../xserver/data/busybox
|
||||
@@ -32,7 +32,7 @@ void * unpackFilesThread(void * unused)
|
||||
{
|
||||
char fname[PATH_MAX*2];
|
||||
strcpy( fname, getenv("SECURE_STORAGE_DIR") );
|
||||
strcat( fname, "/usr/bin/xkbcomp" );
|
||||
strcat( fname, "/usr/lib/xorg/protocol.txt" );
|
||||
struct stat st;
|
||||
if( stat( fname, &st ) == 0 )
|
||||
{
|
||||
@@ -42,42 +42,6 @@ void * unpackFilesThread(void * unused)
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Unpacking data");
|
||||
|
||||
strcpy( fname, getenv("SECURE_STORAGE_DIR") );
|
||||
strcat( fname, "/busybox" );
|
||||
FILE * ff = fopen("busybox", "rb");
|
||||
FILE * fo = fopen(fname, "wb");
|
||||
if( !ff || !fo )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Cannot copy busybox");
|
||||
unpackFinished = 1;
|
||||
return (void *)0;
|
||||
}
|
||||
|
||||
for(;;)
|
||||
{
|
||||
char buf[2048];
|
||||
int cnt = fread( buf, 1, sizeof(buf), ff );
|
||||
if( cnt < 0 )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Cannot copy busybox");
|
||||
unpackFinished = 1;
|
||||
return (void *)1;
|
||||
}
|
||||
fwrite( buf, 1, cnt, fo );
|
||||
if( cnt < sizeof(buf) )
|
||||
break;
|
||||
}
|
||||
|
||||
fclose(ff);
|
||||
fclose(fo);
|
||||
|
||||
if( chmod(fname, 0755) != 0 )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Cannot chmod busybox");
|
||||
unpackFinished = 1;
|
||||
return (void *)0;
|
||||
}
|
||||
|
||||
if( stat( "data.tar.gz", &st ) == 0 )
|
||||
unpackProgressMbTotal = st.st_size / 1024 / 1024;
|
||||
else
|
||||
@@ -85,10 +49,12 @@ void * unpackFilesThread(void * unused)
|
||||
|
||||
unpackProgressMb = 0;
|
||||
|
||||
ff = fopen("data.tar.gz", "rb");
|
||||
strcat(fname, " tar xz -C ");
|
||||
strcat(fname, getenv("SECURE_STORAGE_DIR"));
|
||||
fo = popen(fname, "w");
|
||||
FILE * ff = fopen("data.tar.gz", "rb");
|
||||
strcpy( fname, getenv("SECURE_STORAGE_DIR") );
|
||||
strcat( fname, "/busybox" );
|
||||
strcat( fname, " tar xz -C " );
|
||||
strcat( fname, getenv("SECURE_STORAGE_DIR") );
|
||||
FILE * fo = popen(fname, "w");
|
||||
if( !ff || !fo )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Error extracting data");
|
||||
@@ -173,7 +139,7 @@ void XSDL_unpackFiles()
|
||||
SDL_Delay(400);
|
||||
SDL_FillRect(SDL_GetVideoSurface(), NULL, 0);
|
||||
char s[128];
|
||||
sprintf(s, "Unpacking data: %d/%d Mb, %d%%", unpackProgressMb, unpackProgressMbTotal, unpackProgressMb * 100 / unpackProgressMbTotal);
|
||||
sprintf(s, "Unpacking data: %d/%d Mb, %d%%", unpackProgressMb, unpackProgressMbTotal, unpackProgressMb * 100 / (unpackProgressMbTotal > 0 ? unpackProgressMbTotal : 1));
|
||||
renderString(s, VID_X/2, VID_Y/3);
|
||||
renderString("You may put this app to background while it's unpacking", VID_X/2, VID_Y*2/3);
|
||||
SDL_Flip(SDL_GetVideoSurface());
|
||||
@@ -407,15 +373,18 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
|
||||
}
|
||||
}
|
||||
|
||||
void XSDL_generateBackground(const char * port, int showHelp)
|
||||
void XSDL_generateBackground(const char * port, int showHelp, int resolutionW, int resolutionH)
|
||||
{
|
||||
int sd, addr, ifc_num, i;
|
||||
struct ifconf ifc;
|
||||
struct ifreq ifr[20];
|
||||
SDL_Surface * surf;
|
||||
int y = VID_Y * 2 / 5;
|
||||
int y = resolutionH * 1 / 3;
|
||||
char msg[128];
|
||||
|
||||
if (resolutionH > resolutionW)
|
||||
resolutionH = resolutionW;
|
||||
|
||||
if( !showHelp )
|
||||
{
|
||||
surf = SDL_CreateRGBSurface(SDL_SWSURFACE, 16, 16, 24, 0x0000ff, 0x00ff00, 0xff0000, 0);
|
||||
@@ -425,11 +394,11 @@ void XSDL_generateBackground(const char * port, int showHelp)
|
||||
return;
|
||||
}
|
||||
|
||||
surf = SDL_CreateRGBSurface(SDL_SWSURFACE, VID_X, VID_X, 24, 0x0000ff, 0x00ff00, 0xff0000, 0);
|
||||
surf = SDL_CreateRGBSurface(SDL_SWSURFACE, resolutionW, resolutionH, 24, 0x0000ff, 0x00ff00, 0xff0000, 0);
|
||||
SDL_FillRect(surf, NULL, 0x00002f);
|
||||
|
||||
renderStringColor("Launch these commands on your Linux PC:", VID_X/2, y, 255, 255, 255, surf);
|
||||
y += 30;
|
||||
renderStringScaled("Launch these commands on your Linux PC:", 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
|
||||
y += resolutionH * 30 / VID_Y;
|
||||
|
||||
sd = socket(PF_INET, SOCK_DGRAM, 0);
|
||||
if (sd > 0)
|
||||
@@ -458,23 +427,23 @@ void XSDL_generateBackground(const char * port, int showHelp)
|
||||
if (strcmp(saddr, "127.0.0.1") == 0)
|
||||
continue;
|
||||
sprintf (msg, "env DISPLAY=%s%s metacity &", saddr, port);
|
||||
renderStringColor(msg, VID_X/2, y, 255, 255, 255, surf);
|
||||
y += 15;
|
||||
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
|
||||
y += resolutionH * 15 / VID_Y;
|
||||
sprintf (msg, "env DISPLAY=%s%s gimp", saddr, port);
|
||||
renderStringColor(msg, VID_X/2, y, 255, 255, 255, surf);
|
||||
y += 20;
|
||||
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
|
||||
y += resolutionH * 20 / VID_Y;
|
||||
}
|
||||
}
|
||||
|
||||
close(sd);
|
||||
}
|
||||
|
||||
y += 10;
|
||||
y += resolutionH * 10 / VID_Y;
|
||||
sprintf (msg, "To tunnel X over SSH, forward port %d", atoi(port+1) + 6000);
|
||||
renderStringColor(msg, VID_X/2, y, 255, 255, 255, surf);
|
||||
y += 15;
|
||||
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
|
||||
y += resolutionH * 15 / VID_Y;
|
||||
sprintf (msg, "in your SSH client");
|
||||
renderStringColor(msg, VID_X/2, y, 255, 255, 255, surf);
|
||||
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
|
||||
|
||||
SDL_SaveBMP(surf, "background.bmp");
|
||||
SDL_FreeSurface(surf);
|
||||
@@ -531,7 +500,7 @@ void XSDL_initSDL()
|
||||
else
|
||||
SDL_SetVideoMode(VID_Y, VID_X, 0, SDL_SWSURFACE);
|
||||
TTF_Init();
|
||||
sFont = TTF_OpenFont("DroidSansMono.ttf", 12);
|
||||
sFont = TTF_OpenFont("DroidSansMono.ttf", 14);
|
||||
if (!sFont)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Error: cannot open font file, please reinstall the app");
|
||||
|
||||
@@ -7,7 +7,7 @@ void XSDL_initSDL();
|
||||
void XSDL_deinitSDL();
|
||||
void XSDL_unpackFiles();
|
||||
void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, int * displayH);
|
||||
void XSDL_generateBackground(const char * port, int showHelp);
|
||||
void XSDL_generateBackground(const char * port, int showHelp, int resolutionW, int resolutionH);
|
||||
void XSDL_showServerLaunchErrorMessage();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -120,7 +120,7 @@ int main( int argc, char* argv[] )
|
||||
argv++;
|
||||
}
|
||||
|
||||
XSDL_generateBackground(port, printHelp);
|
||||
XSDL_generateBackground(port, printHelp, resolutionW, resolutionH);
|
||||
|
||||
XSDL_deinitSDL();
|
||||
|
||||
@@ -128,7 +128,7 @@ int main( int argc, char* argv[] )
|
||||
|
||||
if( printHelp )
|
||||
{
|
||||
sprintf( clientcmd, "%s/usr/bin/xhost + ; %s/usr/bin/xli -onroot -fillscreen background.bmp",
|
||||
sprintf( clientcmd, "%s/usr/bin/xhost + ; %s/usr/bin/xli -onroot -center background.bmp",
|
||||
getenv("SECURE_STORAGE_DIR"), getenv("SECURE_STORAGE_DIR") );
|
||||
args[argnum] = "-exec";
|
||||
args[argnum+1] = clientcmd;
|
||||
|
||||
Submodule project/jni/application/xserver/xserver updated: 086b01dd17...7be4caffce
@@ -960,17 +960,33 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouseWheel) (JNIEnv* env, jobject thiz,
|
||||
// TODO: direction might get inverted
|
||||
for( ; scrollX > 0; scrollX-- )
|
||||
{
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(KEYCODE_DPAD_RIGHT) );
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_RIGHT) );
|
||||
if( !SDL_ANDROID_isMouseUsed )
|
||||
{
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(KEYCODE_DPAD_RIGHT) );
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_RIGHT) );
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ANDROID_MainThreadPushMouseButton( SDL_PRESSED, SDL_BUTTON_X2 );
|
||||
SDL_ANDROID_MainThreadPushMouseButton( SDL_RELEASED, SDL_BUTTON_X2 );
|
||||
}
|
||||
}
|
||||
for( ; scrollX < 0; scrollX++ )
|
||||
{
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(KEYCODE_DPAD_LEFT) );
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_LEFT) );
|
||||
if( !SDL_ANDROID_isMouseUsed )
|
||||
{
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(KEYCODE_DPAD_LEFT) );
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_LEFT) );
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ANDROID_MainThreadPushMouseButton( SDL_PRESSED, SDL_BUTTON_X1 );
|
||||
SDL_ANDROID_MainThreadPushMouseButton( SDL_RELEASED, SDL_BUTTON_X1 );
|
||||
}
|
||||
}
|
||||
for( ; scrollY > 0; scrollY-- )
|
||||
{
|
||||
if(!SDL_ANDROID_isMouseUsed)
|
||||
if( !SDL_ANDROID_isMouseUsed )
|
||||
{
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(KEYCODE_DPAD_UP) );
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_UP) );
|
||||
@@ -983,7 +999,7 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouseWheel) (JNIEnv* env, jobject thiz,
|
||||
}
|
||||
for( ; scrollY < 0; scrollY++ )
|
||||
{
|
||||
if(!SDL_ANDROID_isMouseUsed)
|
||||
if( !SDL_ANDROID_isMouseUsed )
|
||||
{
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(KEYCODE_DPAD_DOWN) );
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_DOWN) );
|
||||
|
||||
Reference in New Issue
Block a user