XSDL: new icon and random stuff

This commit is contained in:
Sergii Pylypenko
2016-02-24 21:36:25 +02:00
parent 90f4f25051
commit 38855f0b7a
8 changed files with 84 additions and 14 deletions

View File

@@ -7,10 +7,10 @@ AppName="XServer XSDL"
AppFullName=x.org.server
# Application version code (integer)
AppVersionCode=11138
AppVersionCode=11139
# Application user-visible version name (string)
AppVersionName="1.11.38"
AppVersionName="1.11.39"
# 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

@@ -13,9 +13,9 @@ PACKAGE_NAME=`grep AppFullName AndroidAppSettings.cfg | sed 's/.*=//'`
} || exit 1
../setEnvironment-$1.sh sh -c '\
$CC $CFLAGS -c main.c -o main-'"$1.o" || exit 1
$CC $CFLAGS -Werror=format -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
$CC $CFLAGS -Werror=format -c gfx.c -o gfx-'"$1.o" || exit 1
[ -e ../../../lib ] || ln -s libs ../../../lib

View File

@@ -394,7 +394,7 @@ void XSDL_unpackFiles(int _freeSpaceRequiredMb)
SDL_JoystickClose(j0);
}
void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, int * displayH)
void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, int * displayH, int * builtinKeyboard, int * ctrlAltShiftKeys)
{
int x = 0, y = 0, i, ii;
SDL_Event event;
@@ -406,6 +406,7 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
int vertical = SDL_ListModes(NULL, 0)[0]->w < SDL_ListModes(NULL, 0)[0]->h;
char cfgpath[PATH_MAX];
FILE * cfgfile;
int okay = 0;
if( vertical )
{
@@ -459,7 +460,7 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
cfgfile = fopen(cfgpath, "r");
if( cfgfile )
{
fscanf(cfgfile, "%d %d %d %d", &savedRes, &savedDpi, &customX, &customY);
fscanf(cfgfile, "%d %d %d %d %d %d", &savedRes, &savedDpi, &customX, &customY, builtinKeyboard, ctrlAltShiftKeys);
fclose(cfgfile);
}
sprintf(custom, "%dx%d", customX, customY);
@@ -482,7 +483,7 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
}
}
SDL_FillRect(SDL_GetVideoSurface(), NULL, 0);
y = VID_Y/3;
y = VID_Y/4;
renderString("Tap the screen to change", vertical ? VID_Y / 2 : VID_X/2, y);
y += 30;
renderString("display resolution and font scale (DPI)", vertical ? VID_Y / 2 : VID_X/2, y);
@@ -493,6 +494,9 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
y += 30;
sprintf(buf, "Font scale: %s", fontsStr[savedDpi]);
renderString(buf, vertical ? VID_Y / 2 : VID_X/2, y);
y += 30;
sprintf(buf, "Keyboard: %s", *builtinKeyboard == 0 ? "System" : *builtinKeyboard == 1 ? "Builtin QWERTY" : "System + Builtin");
renderString(buf, vertical ? VID_Y / 2 : VID_X/2, y);
y += 40;
sprintf(buf, "Starting in %d seconds", counter / 1000 + 1);
renderString(buf, vertical ? VID_Y / 2 : VID_X/2, y);
@@ -668,6 +672,58 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
*displayW = *displayW / fontsVal[dpi];
*displayH = *displayH / fontsVal[dpi];
okay = !config;
while ( !okay )
{
while (SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_KEYDOWN:
if (event.key.keysym.sym == SDLK_HELP)
return;
break;
case SDL_MOUSEBUTTONUP:
{
//SDL_GetMouseState(&x, &y);
if( vertical )
{
int z = x;
x = y;
y = z;
}
if( y > 0 && y < VID_Y * 2 / 6 )
*builtinKeyboard = (*builtinKeyboard + 1) % 3;
if( y > VID_Y * 2 / 6 && y < VID_Y * 4 / 6 )
*ctrlAltShiftKeys = !*ctrlAltShiftKeys;
if( y > VID_Y * 4 / 6 && y < VID_Y * 6 / 6 )
okay = 1;
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Screen coords %d %d dpi %d\n", x, y, res);
}
break;
case SDL_JOYBALLMOTION:
x = event.jball.xrel;
y = event.jball.yrel;
break;
}
}
SDL_FillRect(SDL_GetVideoSurface(), NULL, 0);
char buf[100];
sprintf(buf, "Keyboard: %s", *builtinKeyboard == 0 ? "System" : *builtinKeyboard == 1 ? "Builtin QWERTY" : "System + Builtin");
renderString(buf, VID_X/2, VID_Y * 1 / 6);
sprintf(buf, "Separate Ctrl/Alt/Shift keys: %s", *ctrlAltShiftKeys == 0 ? "No" : "Yes");
renderString(buf, VID_X/2, VID_Y * 3 / 6);
sprintf(buf, "Okay");
renderString(buf, VID_X/2, VID_Y * 5 / 6);
SDL_Delay(100);
SDL_Flip(SDL_GetVideoSurface());
}
SDL_JoystickClose(j0);
if( config )
@@ -675,7 +731,7 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
cfgfile = fopen(cfgpath, "w");
if( cfgfile )
{
fprintf(cfgfile, "%d %d %d %d\n", res, dpi, customX, customY);
fprintf(cfgfile, "%d %d %d %d %d %d\n", res, dpi, customX, customY, *builtinKeyboard, *ctrlAltShiftKeys);
fclose(cfgfile);
}
}
@@ -687,7 +743,7 @@ void XSDL_generateBackground(const char * port, int showHelp, int resolutionW, i
struct ifconf ifc;
struct ifreq ifr[20];
SDL_Surface * surf;
int y = resolutionH * 1 / 3;
int y = resolutionH * 1 / 6;
char msg[128];
if (resolutionH > resolutionW)
@@ -756,6 +812,13 @@ void XSDL_generateBackground(const char * port, int showHelp, int resolutionW, i
sprintf (msg, "in your SSH client");
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
y += resolutionH * 20 / VID_Y;
sprintf (msg, "If you run Linux in chroot on this device, run:");
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
y += resolutionH * 15 / VID_Y;
sprintf (msg, "export DISPLAY=:0 PULSE_SERVER=tcp:127.0.0.1:4712");
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
SDL_SaveBMP(surf, "background.bmp");
SDL_FreeSurface(surf);
}

View File

@@ -6,7 +6,7 @@ enum { VID_X = 480, VID_Y = 320 };
void XSDL_initSDL();
void XSDL_deinitSDL();
void XSDL_unpackFiles(int freeSpaceRequiredMb);
void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, int * displayH);
void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, int * displayH, int * builtinKeyboard, int * ctrlAltShiftKeys);
void XSDL_generateBackground(const char * port, int showHelp, int resolutionW, int resolutionH);
void XSDL_showServerLaunchErrorMessage();

View File

@@ -48,6 +48,7 @@ int main( int argc, char* argv[] )
int screenResOverride = 0;
int screenButtons = 0;
int warnDiskSpaceMb = 0;
int builtinKeyboard = 0;
int resolutionW = atoi(getenv("DISPLAY_RESOLUTION_WIDTH"));
int resolutionH = atoi(getenv("DISPLAY_RESOLUTION_HEIGHT"));
@@ -118,7 +119,7 @@ int main( int argc, char* argv[] )
if( !screenResOverride )
{
XSDL_showConfigMenu(&resolutionW, &displayW, &resolutionH, &displayH);
XSDL_showConfigMenu(&resolutionW, &displayW, &resolutionH, &displayH, &builtinKeyboard, &screenButtons);
sprintf( screenres, "%d/%dx%d/%dx%d", resolutionW, displayW, resolutionH, displayH, SDL_GetVideoInfo()->vfmt->BitsPerPixel );
}
@@ -149,6 +150,12 @@ int main( int argc, char* argv[] )
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, 0);
}
{
char s[16];
sprintf(s, "%d", builtinKeyboard);
setenv("XSDL_BUILTIN_KEYBOARD", s, 1);
}
__android_log_print(ANDROID_LOG_INFO, "XSDL", "XSDL video resolution %s, args:", screenres);
for( i = 0; i < argnum; i++ )
__android_log_print(ANDROID_LOG_INFO, "XSDL", "> %s", args[i]);