Browse files

Xserver: show error message when server does not start

  • Loading branch information...
1 parent f047192 commit 7d40446ea071e7ef6d4f0d88e326b582767b8e22 @pelya committed Nov 12, 2013
View
2 createSourceArchive.sh
@@ -11,4 +11,4 @@ tar -c -z --exclude-vcs --exclude="*.o" --exclude="*.d" --exclude="*.dep" \
`find project/jni/application -maxdepth 1 -type f -o -type l` \
project/jni/application/src \
project/jni/application/`readlink project/jni/application/src` \
-project/AndroidManifest.xml project/src
+project/AndroidManifest.xml project/src "$@"
View
2 project/jni/application/xserver-gimp/AndroidAppSettings.cfg
@@ -23,7 +23,7 @@ InhibitSuspend=n
# 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:http://10.0.0.99/dist-gimp-wheezy.tar.gz|: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"
+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"
# 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)
View
27 project/jni/application/xserver/gfx.c
@@ -245,7 +245,7 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
renderString(resStr[i*4+ii], VID_X/8 + (ii*VID_X/4), VID_Y/4 + (i*VID_Y/2));
SDL_GetMouseState(&x, &y);
renderString("X", x, y);
- SDL_Delay(200);
+ SDL_Delay(150);
SDL_Flip(SDL_GetVideoSurface());
}
//dpiScale = (float)resVal[res][0] / (float)*resolutionW;
@@ -278,7 +278,7 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
renderString(fontsStr[i*4+ii], VID_X/8 + (ii*VID_X/4), VID_Y/8 + (i*VID_Y/4));
SDL_GetMouseState(&x, &y);
renderString("X", x, y);
- SDL_Delay(200);
+ SDL_Delay(150);
SDL_Flip(SDL_GetVideoSurface());
}
*displayW = *displayW / fontsVal[dpi];
@@ -351,15 +351,34 @@ void XSDL_generateBackground(const char * port, int showHelp)
SDL_FreeSurface(surf);
}
+void XSDL_showServerLaunchErrorMessage()
+{
+ showErrorMessage( "Error: X server failed to launch,\n"
+ "because of stale Unix socket with non-existing path.\n\n"
+ "Power off your device and power it on,\n"
+ "and everything will work again.");
+}
+
void showErrorMessage(const char *msg)
{
SDL_Event event;
+ const char * s;
+ int y = VID_Y/3;
SDL_FillRect(SDL_GetVideoSurface(), NULL, 0);
- renderString(msg, VID_X/2, VID_Y/2);
+ for( s = msg; s && s[0]; s = strchr(s, '\n'), s += (s ? 1 : 0), y += 30 )
+ {
+ const char * s1 = strchr(s, '\n');
+ int len = s1 ? s1 - s : strlen(s);
+ char buf[512];
+ strncpy(buf, s, len);
+ buf[len] = 0;
+ if( len > 0 )
+ renderString(buf, VID_X/2, y);
+ }
SDL_Flip(SDL_GetVideoSurface());
while (1)
{
- while (SDL_PollEvent(&event))
+ while (SDL_WaitEvent(&event))
{
switch (event.type)
{
View
1 project/jni/application/xserver/gfx.h
@@ -8,5 +8,6 @@ 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_showServerLaunchErrorMessage();
#endif
View
10 project/jni/application/xserver/main.c
@@ -16,6 +16,7 @@
extern int android_main( int argc, char *argv[], char *envp[] );
static void setupEnv(void);
+static void showError(void);
int main( int argc, char* argv[] )
{
@@ -131,6 +132,8 @@ int main( int argc, char* argv[] )
for( i = 0; i < ARGNUM; i++ )
__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);
return android_main( ARGNUM, args, envp );
}
@@ -151,3 +154,10 @@ void setupEnv(void)
setenv("USER_ID", buf, 1);
setenv("USER", pwd->pw_name, 1);
}
+
+void showError(void)
+{
+ XSDL_initSDL();
+ XSDL_showServerLaunchErrorMessage();
+ XSDL_deinitSDL();
+}
2 project/jni/application/xserver/xserver
@@ -1 +1 @@
-Subproject commit 1921292f96ecaec4a5297cdd64b0bc0b35f5b488
+Subproject commit 34c905d98666a1f023e27e969c7b18984f8b619e

0 comments on commit 7d40446

Please sign in to comment.