Gimp: Togglable on-screen Ctrl/Alt/Shift buttons

This commit is contained in:
pelya
2014-03-01 23:19:35 +02:00
parent c06af51a92
commit c870f8c7a0
5 changed files with 63 additions and 19 deletions

View File

@@ -61,7 +61,7 @@ SwVideoMode=y
SdlVideoResize=y
# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n)
SdlVideoResizeKeepAspect=y
SdlVideoResizeKeepAspect=n
# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread -
# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n)

View File

@@ -7,10 +7,10 @@ AppName="GIMP Inkscape"
AppFullName=org.gimp.inkscape
# Application version code (integer)
AppVersionCode=28212
AppVersionCode=28213
# Application user-visible version name (string)
AppVersionName="2.8.2.12"
AppVersionName="2.8.2.13"
# 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
@@ -21,7 +21,7 @@ AppVersionName="2.8.2.12"
AppDataDownloadUrl="!!Data files|:data.tar.gz:http://sourceforge.net/projects/libsdl-android/files/ubuntu/dist-gimp-wheezy.tar.gz/download^!!Data files|:DroidSansMono.ttf:DroidSansMono.ttf"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=n
ResetSdlConfigForThisVersion=y
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
DeleteFilesOnUpgrade="%"
@@ -160,24 +160,24 @@ NonBlockingSwapBuffers=n
RedefinedKeys="LALT UNDO NO_REMAP NO_REMAP UNDO HELP"
# Number of virtual keyboard keys (currently 6 is maximum)
AppTouchscreenKeyboardKeysAmount=0
AppTouchscreenKeyboardKeysAmount=3
# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right)
RedefinedKeysScreenKb="LALT RETURN KP_PLUS KP_MINUS SPACE DELETE KP_PLUS KP_MINUS 1 2"
RedefinedKeysScreenKb="LCTRL LALT LSHIFT RETURN SPACE DELETE KP_PLUS KP_MINUS 1 2"
# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu
RedefinedKeysScreenKbNames="LALT RETURN KP_PLUS KP_MINUS SPACE DELETE KP_PLUS KP_MINUS 1 2"
RedefinedKeysScreenKbNames="LCTRL LALT LSHIFT RETURN SPACE DELETE KP_PLUS KP_MINUS 1 2"
# On-screen keys theme
# 0 = Ultimate Droid by Sean Stieber (green, with gamepad joystick)
# 1 = Simple Theme by Beholder (white, with gamepad joystick)
# 2 = Sun by Sirea (yellow, with round joystick)
# 3 = Keen by Gerstrong (multicolor, with round joystick)
TouchscreenKeysTheme=2
TouchscreenKeysTheme=0
# Redefine gamepad keys to SDL keysyms, button order is:
# A B X Y L1 R1 L2 R2 LThumb RThumb
RedefinedKeysGamepad="LALT RETURN KP_PLUS KP_MINUS SPACE DELETE KP_PLUS KP_MINUS 1 2"
RedefinedKeysGamepad="LCTRL LALT LSHIFT RETURN SPACE DELETE KP_PLUS KP_MINUS 1 2"
# How long to show startup menu button, in msec, 0 to disable startup menu
StartupMenuButtonTimeout=3000
@@ -223,7 +223,7 @@ AppSubdirsBuild=''
AppBuildExclude=''
# Application command line parameters, including app name as 0-th param
AppCmdline='XSDL -nohelp -exec /data/data/org.gimp.inkscape/files/chroot.sh bin/sh ./start-gimp.sh'
AppCmdline='XSDL -nohelp -screenbuttons -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

@@ -22,6 +22,10 @@ You will need both xcb-proto and python-xcbgen packages
to have version 1.10-1, you may download newer packages
from http://packages.ubuntu.com/ or https://www.debian.org/distrib/packages
Copy images from directory project/jni/application/xserver-gimp/keyboard
to project/themes/UltimateDroid, go to directory project/themes,
and run script ./convert.sh
Then run commands:
git clone git@github.com:pelya/commandergenius.git sdl-android

View File

@@ -9,6 +9,7 @@
#include <sys/un.h>
#include <errno.h>
#include <SDL/SDL.h>
#include <SDL/SDL_screenkeyboard.h>
#include <android/log.h>
#include "gfx.h"
@@ -37,6 +38,8 @@ int main( int argc, char* argv[] )
enum { ARGNUM = 8 };
char * envp[] = { NULL };
int printHelp = 1;
int screenResOverride = 0;
int screenButtons = 0;
int resolutionW = atoi(getenv("DISPLAY_RESOLUTION_WIDTH"));
int resolutionH = atoi(getenv("DISPLAY_RESOLUTION_HEIGHT"));
@@ -46,6 +49,10 @@ int main( int argc, char* argv[] )
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Actual video resolution %d/%dx%d/%d", resolutionW, displayW, resolutionH, displayH);
setupEnv();
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, 0);
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, 0);
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, 0);
XSDL_initSDL();
XSDL_unpackFiles();
@@ -98,19 +105,27 @@ 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] == ':')
{
strcpy(port, argv[1]);
}
else if( strcmp(argv[1], "-nohelp") == 0 )
{
printHelp = 0;
}
else if( strcmp(argv[1], "-screen") == 0 )
{
screenResOverride = 1;
argc--;
argv++;
strcpy(screenres, argv[1]);
}
else if( strcmp(argv[1], "-screenbuttons") == 0 )
{
screenButtons = 1;
}
else
{
args[argnum] = argv[1];
@@ -124,7 +139,8 @@ int main( int argc, char* argv[] )
XSDL_deinitSDL();
sprintf( screenres, "%d/%dx%d/%dx%d", resolutionW, displayW, resolutionH, displayH, SDL_GetVideoInfo()->vfmt->BitsPerPixel );
if( !screenResOverride )
sprintf( screenres, "%d/%dx%d/%dx%d", resolutionW, displayW, resolutionH, displayH, SDL_GetVideoInfo()->vfmt->BitsPerPixel );
if( printHelp )
{
@@ -135,6 +151,30 @@ int main( int argc, char* argv[] )
argnum += 2;
}
if( screenButtons )
{
SDL_Rect pos;
pos.x = 0;
pos.h = SDL_ListModes(NULL, 0)[0]->h / 10;
pos.y = SDL_ListModes(NULL, 0)[0]->h - pos.h;
pos.w = 40 * SDL_ListModes(NULL, 0)[0]->w / resolutionW;
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, 1);
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &pos);
SDL_ANDROID_SetScreenKeyboardButtonImagePos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &pos);
SDL_ANDROID_SetScreenKeyboardButtonStayPressedAfterTouch(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, 1);
pos.y -= pos.h;
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, 1);
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, &pos);
SDL_ANDROID_SetScreenKeyboardButtonImagePos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, &pos);
SDL_ANDROID_SetScreenKeyboardButtonStayPressedAfterTouch(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, 1);
pos.y -= pos.h;
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, 1);
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, &pos);
SDL_ANDROID_SetScreenKeyboardButtonImagePos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, &pos);
SDL_ANDROID_SetScreenKeyboardButtonStayPressedAfterTouch(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, 1);
SDL_ANDROID_SetScreenKeyboardTransparency(255); // opaque
}
__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]);