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";
/**
* 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);
}
//
} else if (evt.getSource() == clipboardButton) {
viewer.clipboard.setVisible(!viewer.clipboard.isVisible());
- } else if (evt.getSource() == videoIgnoreButton) {
+ } else if (evt.getSource() == videoFreezeButton) {
+
+ //
+ // Send video freeze message to server and change caption of button
//
- // Do something onVideoIgnoreButtonClick event
- // ...
+
+ //
+ // 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;
// Non-standard client-to-server messages
final static int EnableContinuousUpdates = 150;
final static int VideoRectangleSelection = 151;
+ final static int VideoFreeze = 152;
+ final static String SigVideoFreeze = "VD_FREEZ";
final static String SigEnableContinuousUpdates = "CUC_ENCU";
final static String SigVideoRectangleSelection = "VRECTSEL";
clientMsgCaps.add(VideoRectangleSelection, TightVncVendor,
SigVideoRectangleSelection,
"Select a rectangle to be treated as video");
+ clientMsgCaps.add(VideoFreeze, TightVncVendor,
+ SigVideoFreeze,
+ "Disable/enable video rectangle");
// Supported encoding types
encodingCaps.add(EncodingCopyRect, StandardVendor,
System.out.println("Video rectangle selection message sent");
}
+ void trySendVideoFreeze(boolean freeze) throws IOException
+ {
+ if (!clientMsgCaps.isEnabled(VideoFreeze)) {
+ System.out.println("Video freeze is not supported by the server");
+ return;
+ }
+
+ byte[] b = new byte[2];
+ byte fb = 0;
+ if (freeze) {
+ fb = 1;
+ }
+
+ b[0] = (byte) VideoFreeze;
+ b[1] = (byte) fb;
+
+ os.write(b);
+
+ System.out.println("Video freeze selection message sent");
+ }
+
public void startTiming() {
timing = true;