[Developement] Added ability to freeze video (enable/disabe rectangular screen area that treated as video) using tight rfb video freeze extension(if server support it).
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3474 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/java/src/com/tightvnc/vncviewer/ButtonPanel.java b/java/src/com/tightvnc/vncviewer/ButtonPanel.java
index 63ad6a1..dea182d 100644
--- a/java/src/com/tightvnc/vncviewer/ButtonPanel.java
+++ b/java/src/com/tightvnc/vncviewer/ButtonPanel.java
@@ -39,9 +39,10 @@
Button ctrlAltDelButton;
Button refreshButton;
Button selectButton;
- Button videoIgnoreButton;
+ Button videoFreezeButton;
- final String videoIgnoreLabel = "Video Ignore";
+ final String enableVideoFreezeLabel = "Enable Video Freeze";
+ final String disableVideoFreezeLabel = "Disable Video Freeze";
final String selectEnterLabel = "Select Video Area";
final String selectLeaveLabel = "Hide Selection";
@@ -88,11 +89,10 @@
/**
* Add video ignore button to the ButtonPanel.
*/
- public void addVideoIgnoreButton() {
- videoIgnoreButton = new Button(videoIgnoreLabel);
- videoIgnoreButton.setEnabled(false);
- add(selectButton);
- videoIgnoreButton.addActionListener(this);
+ public void addVideoFreezeButton() {
+ videoFreezeButton = new Button(enableVideoFreezeLabel);
+ add(videoFreezeButton);
+ videoFreezeButton.addActionListener(this);
}
//
@@ -156,11 +156,32 @@
} else if (evt.getSource() == clipboardButton) {
viewer.clipboard.setVisible(!viewer.clipboard.isVisible());
- } else if (evt.getSource() == videoIgnoreButton) {
+ } else if (evt.getSource() == videoFreezeButton) {
+
//
- // Do something onVideoIgnoreButtonClick event
- // ...
+ // Send video freeze message to server and change caption of button
//
+
+ //
+ // TODO: Move this code to another place.
+ //
+
+ boolean sendOk = true;
+ boolean currentFreezeState =
+ videoFreezeButton.getLabel().equals(disableVideoFreezeLabel);
+ try {
+ viewer.rfb.trySendVideoFreeze(!currentFreezeState);
+ } catch (IOException ex) {
+ sendOk = false;
+ ex.printStackTrace();
+ }
+ if (sendOk) {
+ if (!currentFreezeState) {
+ videoFreezeButton.setLabel(disableVideoFreezeLabel);
+ } else {
+ videoFreezeButton.setLabel(enableVideoFreezeLabel);
+ }
+ }
} else if (evt.getSource() == ctrlAltDelButton) {
try {
final int modifiers = InputEvent.CTRL_MASK | InputEvent.ALT_MASK;