Xserver: Better DPI selection dialog

This commit is contained in:
pelya
2014-01-03 01:02:21 +02:00
parent 9e5cba8aab
commit f3f4d13cf9
4 changed files with 66 additions and 43 deletions

View File

@@ -1,21 +1,16 @@
# The application settings for Android libSDL port
AppSettingVersion=19
# libSDL version to use (1.2 or 1.3, specify 1.3 for SDL2)
LibSdlVersion=1.2
# Specify application name (e.x. My Application)
AppName="GIMP Inkscape"
# Specify reversed site name of application (e.x. com.mysite.myapp)
AppFullName=org.gimp.inkscape
# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape
ScreenOrientation=h
# Application version code (integer)
AppVersionCode=28207
# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer
InhibitSuspend=n
# Application user-visible version name (string)
AppVersionName="2.8.2.07"
# 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
@@ -25,6 +20,25 @@ InhibitSuspend=n
# 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:http://sourceforge.net/projects/libsdl-android/files/ubuntu/dist-gimp-wheezy.tar.gz/download^!!Data files|:busybox:busybox^!!Data files|:DroidSansMono.ttf:DroidSansMono.ttf"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=y
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
DeleteFilesOnUpgrade="%"
# Here you may type readme text, which will be shown during startup. Format is:
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
ReadmeText=''
# libSDL version to use (1.2/1.3/2.0)
LibSdlVersion=1.2
# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape
ScreenOrientation=h
# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer
InhibitSuspend=n
# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only
# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32)
VideoDepthBpp=24
@@ -75,6 +89,8 @@ CompatibilityHacksSlowCompatibleEventQueue=n
# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL
CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState=
# Application uses SDL_UpdateRects() properly, and does not draw in any region outside those rects.
# This improves drawing speed, but I know only one application that does that, and it's written by me (y)/(n)
CompatibilityHacksProperUsageOfSDL_UpdateRects=y
# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user
@@ -86,7 +102,7 @@ AppNeedsTwoButtonMouse=y
# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n)
ShowMouseCursor=n
# Users are complaining that the video output is slow, so screw pen precision
# Generate more touch events, by default SDL generates one event per one video frame, this is useful for drawing apps (y) or (n)
GenerateSubframeTouchEvents=n
# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n)
@@ -118,6 +134,12 @@ AppUsesMultitouch=y
# This option will add additional permission to Android manifest (y)/(n)
AppRecordsAudio=n
# Application needs to access SD card. If your data files are bigger than 5 Mb, enable it. (y) / (n)
AccessSdCard=
# Immersive mode - Android will hide on-screen Home/Back keys. Looks bad if you invoke Android keyboard. (y) / (n)
ImmersiveMode=
# Application implements Android-specific routines to put to background, and will not draw anything to screen
# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them
# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n)
@@ -159,7 +181,7 @@ StartupMenuButtonTimeout=3000
# Menu items to hide from startup menu, available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout
HiddenMenuOptions='' #SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMouse.DisplaySizeConfig
HiddenMenuOptions=''
# Menu items to show at startup - this is Java code snippet, leave empty for default
# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration()
@@ -174,18 +196,6 @@ MultiABI=armeabi-v7a
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
AppMinimumRAM=0
# Application version code (integer)
AppVersionCode=28207
# Application user-visible version name (string)
AppVersionName="2.8.2.07"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=y
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
DeleteFilesOnUpgrade="%"
# Optional shared libraries to compile - removing some of them will save space
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
@@ -210,11 +220,7 @@ AppSubdirsBuild=''
AppBuildExclude=''
# Application command line parameters, including app name as 0-th param
AppCmdline='XSDL -nohelp /data/data/org.gimp.inkscape/files/chroot.sh bin/sh ./start-gimp.sh'
# Here you may type readme text, which will be shown during startup. Format is:
# Text in English, use \\\\n to separate lines^de:Text in Deutsch^ru:Text in Russian, and so on (that's four backslashes, nice isn't it?)
ReadmeText=''
AppCmdline='XSDL -nohelp -exec /data/data/org.gimp.inkscape/files/chroot.sh bin/sh ./start-gimp.sh'
# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens
# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge

View File

@@ -23,6 +23,7 @@ static int unpackFinished = 0;
static void renderString(const char *c, int x, int y);
static void renderStringColor(const char *c, int x, int y, int r, int g, int b, SDL_Surface * surf);
static void renderStringScaled(const char *c, int size, int x, int y, int r, int g, int b, SDL_Surface * surf);
static void * unpackFilesThread(void * unused);
static void showErrorMessage(const char *msg);
@@ -214,10 +215,10 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
};
const char * fontsStr[] = {
"x2.5", "x2", "x1.7", "x1.5",
"x1.3", "x1", "x0.9", "x0.8",
"x0.7", "x0.6", "x0.5", "x0.4",
"x0.3", "x0.2", "x0.15", "x0.1"
"X2.5", "X2", "X1.7", "X1.5",
"X1.3", "X1", "X0.9", "X0.8",
"X0.7", "X0.6", "X0.5", "X0.4",
"X0.3", "X0.2", "X0.15", "X0.1"
};
const float fontsVal[] = {
2.5f, 2.0f, 1.7f, 1.5f,
@@ -225,6 +226,7 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
0.7f, 0.6f, 0.5f, 0.4f,
0.3f, 0.2f, 0.15f, 0.1f
};
const float fontPtToMm = 0.3528f;
sprintf(native, "%dx%d native", resVal[0][0], resVal[0][1]);
@@ -310,10 +312,11 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
for(i = 0; i < 4; i++)
for(ii = 0; ii < 4; ii++)
{
int scale = (float)(*displayH) * (float)(*resolutionH) / 3500.0f * fontsVal[i*4+ii];
if( vertical )
renderString(fontsStr[i*4+ii], VID_Y/8 + (i*VID_Y/4), VID_X/8 + (ii*VID_X/4));
renderStringScaled(fontsStr[i*4+ii], scale, VID_Y/8 + (i*VID_Y/4), VID_X/8 + (ii*VID_X/4), 255, 255, 255, SDL_GetVideoSurface());
else
renderString(fontsStr[i*4+ii], VID_X/8 + (ii*VID_X/4), VID_Y/8 + (i*VID_Y/4));
renderStringScaled(fontsStr[i*4+ii], scale, VID_X/8 + (ii*VID_X/4), VID_Y/8 + (i*VID_Y/4), 255, 255, 255, SDL_GetVideoSurface());
}
SDL_GetMouseState(&x, &y);
renderString("X", x, y);
@@ -482,3 +485,17 @@ void renderString(const char *c, int x, int y)
renderStringColor(c, x, y, 255, 255, 255, SDL_GetVideoSurface());
}
void renderStringScaled(const char *c, int size, int x, int y, int r, int g, int b, SDL_Surface * surf)
{
SDL_Color fColor = {r, g, b};
SDL_Rect fontRect = {0, 0, 0, 0};
TTF_Font* font = TTF_OpenFont("DroidSansMono.ttf", size);
SDL_Surface* fontSurface = TTF_RenderUTF8_Solid(font, c, fColor);
TTF_CloseFont(font);
fontRect.w = fontSurface->w;
fontRect.h = fontSurface->h;
fontRect.x = x - fontRect.w / 2;
fontRect.y = y - fontRect.h / 2;
SDL_BlitSurface(fontSurface, NULL, surf, &fontRect);
SDL_FreeSurface(fontSurface);
}

View File

@@ -98,6 +98,13 @@ int main( int argc, char* argv[] )
break;
}
if( argc > 1 && strcmp(argv[1], "-nohelp") == 0 )
{
printHelp = 0;
argc--;
argv++;
}
while( argc > 1 )
{
if( argv[1][0] == ':')
@@ -106,7 +113,7 @@ int main( int argc, char* argv[] )
}
else
{
args[argnum] = argv[0];
args[argnum] = argv[1];
argnum++;
}
argc--;
@@ -119,13 +126,6 @@ int main( int argc, char* argv[] )
sprintf( screenres, "%d/%dx%d/%dx%d", resolutionW, displayW, resolutionH, displayH, SDL_GetVideoInfo()->vfmt->BitsPerPixel );
if( argc > 1 && strcmp(argv[1], "-nohelp") == 0 )
{
printHelp = 0;
argc--;
argv++;
}
if( printHelp )
{
sprintf( clientcmd, "%s/usr/bin/xhost + ; %s/usr/bin/xli -onroot -fillscreen background.bmp",