changeset 5844:22039a8a6341

RT-33706 DFB: clear screen when application exits Reviewed-by: ddhill Contributed-by: kselle
author Daniel Blaukopf <daniel.blaukopf@oracle.com>
date Thu, 28 Nov 2013 13:08:56 +0200
parents ee94f7e65ab3
children 8fd1e1131277
files modules/graphics/src/main/java/com/sun/glass/ui/lens/LensApplication.java modules/graphics/src/main/native-glass/lens/wm/screen/fbdevScreen.c
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/com/sun/glass/ui/lens/LensApplication.java	Thu Nov 28 12:52:32 2013 +0200
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/lens/LensApplication.java	Thu Nov 28 13:08:56 2013 +0200
@@ -919,6 +919,11 @@
         }, "Lens Event Thread");
         setEventThread(toolkitThread);
         toolkitThread.start();
+        Runtime.getRuntime().addShutdownHook(new Thread() {
+            @Override public void run() {
+                shutdown();
+            }
+        });
     }
 
     private static int nativeThreadCounter = 0;
--- a/modules/graphics/src/main/native-glass/lens/wm/screen/fbdevScreen.c	Thu Nov 28 12:52:32 2013 +0200
+++ b/modules/graphics/src/main/native-glass/lens/wm/screen/fbdevScreen.c	Thu Nov 28 13:08:56 2013 +0200
@@ -50,6 +50,7 @@
 #define FB_DEVICE "/dev/fb0"
 static int windowIndex = 1;
 
+void do_screen_clear();
 
 jboolean glass_application_initialize(JNIEnv *env) {
     //nothing to do
@@ -169,6 +170,11 @@
     //noop for eglfb as screen is managed in prism
     return;
 #else
+    do_screen_clear();
+#endif
+}
+
+void do_screen_clear() {
     FILE *fb;
     int y;
     NativeScreen fbScreen = glass_screen_getMainScreen();
@@ -200,15 +206,13 @@
         default:
             GLASS_LOG_SEVERE("Cannot write to screen of depth %i", fbScreen->depth);
     }
-
     GLASS_LOG_FINE("fclose(%s)", FB_DEVICE);
     fclose(fb);
-#endif
 }
 
 
 void lens_platform_shutdown(JNIEnv *env) {
-    //nothing to do;
+    do_screen_clear();
 }