mirror of
https://github.com/sethm/symon.git
synced 2024-06-07 19:29:27 +00:00
Repaint Video window at 30fps
A bug caused the video window to repaint only when the cursor was blinking. This meant that if the cursor was disabled, the window would never update! This change removes the repaint logic from the cursor blinking timer, and instead puts it into its own periodic timer callback that runs independently of cursor blink.
This commit is contained in:
parent
b36b442b14
commit
0bad9912ce
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user