diff --git a/src/main/java/com/loomcom/symon/ui/VideoWindow.java b/src/main/java/com/loomcom/symon/ui/VideoWindow.java index 1610539..ac7130e 100644 --- a/src/main/java/com/loomcom/symon/ui/VideoWindow.java +++ b/src/main/java/com/loomcom/symon/ui/VideoWindow.java @@ -61,6 +61,7 @@ public class VideoWindow extends JFrame implements DeviceChangeListener { private static final Logger logger = Logger.getLogger(VideoWindow.class.getName()); + private static final long WINDOW_REPAINT_INTERVAL = 66; // 30fps rate private static final int CHAR_WIDTH = 8; private static final int CHAR_HEIGHT = 8; @@ -127,6 +128,18 @@ public class VideoWindow extends JFrame implements DeviceChangeListener { public void run() { if (cursorBlinkRate > 0) { hideCursor = !hideCursor; + } + } + }); + } + } + + private class WindowPainter implements Runnable { + public void run() { + SwingUtilities.invokeLater(new Runnable () { + @Override + public void run() { + if (VideoWindow.this.isVisible()) { VideoWindow.this.repaint(); } } @@ -152,6 +165,11 @@ public class VideoWindow extends JFrame implements DeviceChangeListener { TimeUnit.MILLISECONDS); } + scheduler.scheduleAtFixedRate(new WindowPainter(), + WINDOW_REPAINT_INTERVAL, + WINDOW_REPAINT_INTERVAL, + TimeUnit.MILLISECONDS); + // Capture some state from the CRTC that will define the // window size. When these values change, the window will // need to re-pack and redraw.