changeset 6057:00c463f633fc

RT-35253 [Monocle] Turn off cursor blinking
author Daniel Blaukopf <daniel.blaukopf@oracle.com>
date Fri, 10 Jan 2014 00:41:31 +0200
parents c37840998bfd
children 880312ec2086
files modules/graphics/src/main/java/com/sun/glass/ui/monocle/linux/FBDevScreen.java modules/graphics/src/main/java/com/sun/glass/ui/monocle/linux/SysFS.java
diffstat 2 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/linux/FBDevScreen.java	Fri Jan 10 00:30:37 2014 +0200
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/linux/FBDevScreen.java	Fri Jan 10 00:41:31 2014 +0200
@@ -44,6 +44,7 @@
     private long nativeHandle;
     private FileChannel fbdev;
     private boolean isShutdown;
+    private int consoleCursorBlink;
 
     public FBDevScreen() {
         try {
@@ -53,6 +54,16 @@
             height = vsize[1];
             nativeHandle = 1l;
             nativeFormat = Pixels.Format.BYTE_BGRA_PRE;
+            try {
+                consoleCursorBlink = SysFS.readInt(SysFS.CURSOR_BLINK);
+                if (consoleCursorBlink != 0) {
+                    SysFS.write(SysFS.CURSOR_BLINK, "0");
+                }
+            } catch (IOException e) {
+                // We failed to read or set the cursor blink state. So don't
+                // try to restore the previous state on exit.
+                consoleCursorBlink = 0;
+            }
         } catch (IOException e) {
             e.printStackTrace();
             throw (IllegalStateException)
@@ -125,6 +136,13 @@
             fbdev = null;
             isShutdown = true;
         }
+        if (consoleCursorBlink != 0) {
+            try {
+                SysFS.write(SysFS.CURSOR_BLINK, String.valueOf(consoleCursorBlink));
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
     }
 
     @Override
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/linux/SysFS.java	Fri Jan 10 00:30:37 2014 +0200
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/linux/SysFS.java	Fri Jan 10 00:41:31 2014 +0200
@@ -39,6 +39,9 @@
 
 public class SysFS {
 
+    public static final String CURSOR_BLINK =
+            "/sys/devices/virtual/graphics/fbcon/cursor_blink";
+
     /** Read input device capability data from sysfs */
     static Map<String, BitSet> readCapabilities(File sysPath) {
         Map<String, BitSet> capsMap = new HashMap<String, BitSet>();