Mercurial > hg > Applications > TreeVNC
annotate src/main/java/jp/ac/u_ryukyu/treevnc/ScreenChangeRequest.java @ 280:9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
author | oc |
---|---|
date | Sun, 11 Jan 2015 03:38:25 +0900 |
parents | 11b59b223222 |
children | 4713559f5838 |
rev | line source |
---|---|
107 | 1 package jp.ac.u_ryukyu.treevnc; |
2 | |
112 | 3 import java.nio.ByteBuffer; |
4 import java.nio.ByteOrder; | |
5 | |
107 | 6 import com.glavsoft.exceptions.TransportException; |
7 import com.glavsoft.rfb.client.ClientToServerMessage; | |
8 import com.glavsoft.transport.Writer; | |
9 | |
10 /** | |
11 * ClientCutText | |
12 * The client has new ISO 8859-1 (Latin-1) text in its cut buffer. Ends of lines are repre- | |
13 * sented by the linefeed / newline character (value 10) alone. No carriage-return (value | |
14 * 13) is needed. There is currently no way to transfer text outside the Latin-1 character | |
15 * set. | |
16 * 1 - U8 - 6 | |
17 * 3 - - padding | |
18 * 4 - U32 - length | |
19 * length - U8 array - text | |
20 */ | |
21 public class ScreenChangeRequest implements ClientToServerMessage { | |
113
bce2ef0a2e79
use ProtocolContext.sendMessage for upward command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
22 final String bytes; |
170 | 23 private short id; |
257 | 24 private int frameSizeWidth; |
25 private int frameSizeHeight; | |
107 | 26 |
257 | 27 public ScreenChangeRequest(String adr, short id, int width, int height) { |
112 | 28 this.bytes = adr; |
170 | 29 this.id = id; |
257 | 30 this.frameSizeWidth = width; |
31 this.frameSizeHeight = height; | |
112 | 32 System.out.println("Client send change screen server request :" + adr); |
107 | 33 } |
34 | |
280
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
35 @Override |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
36 public void send(Writer writer) throws TransportException { |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
37 ByteBuffer out = ByteBuffer.allocate(bytes.length()+25); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
38 out.order(ByteOrder.BIG_ENDIAN); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
39 out.put(SERVER_CHANGE_REQUEST); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
40 out.put((byte)0); // padding |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
41 out.putShort(id); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
42 out.putInt(bytes.length()); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
43 out.put(bytes.getBytes()); |
257 | 44 out.putInt(frameSizeWidth); |
45 out.putInt(frameSizeHeight); | |
280
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
46 writer.write(out.array(), 0, out.position()); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
47 writer.flush(); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
48 } |
107 | 49 |
50 @Override | |
51 public String toString() { | |
112 | 52 return "Screen change request: [length: " + bytes.length() +", text: ...]" + new String (bytes); |
107 | 53 } |
54 } |