annotate src/main/java/jp/ac/u_ryukyu/treevnc/ScreenChangeRequest.java @ 410:da1d6d6b4981

Enable retina scale to fit screen
author innparusu
date Thu, 19 Nov 2015 15:19:29 +0900
parents cdab1354e227
children c225c7963778
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
107
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
1 package jp.ac.u_ryukyu.treevnc;
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
2
112
918dc3ee1c79 send composed data.
oc
parents: 111
diff changeset
3 import java.nio.ByteBuffer;
918dc3ee1c79 send composed data.
oc
parents: 111
diff changeset
4 import java.nio.ByteOrder;
918dc3ee1c79 send composed data.
oc
parents: 111
diff changeset
5
107
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
6 import com.glavsoft.exceptions.TransportException;
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
7 import com.glavsoft.rfb.client.ClientToServerMessage;
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
8 import com.glavsoft.transport.Writer;
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
9
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
10 /**
339
4713559f5838 if have a parent, send serverChangeRequest and whereToConnect
oc
parents: 280
diff changeset
11 * ServerChangeRequest
4713559f5838 if have a parent, send serverChangeRequest and whereToConnect
oc
parents: 280
diff changeset
12 * Change VNCServer
4713559f5838 if have a parent, send serverChangeRequest and whereToConnect
oc
parents: 280
diff changeset
13 * 1 - U8 - 240
107
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
14 * 3 - - padding
339
4713559f5838 if have a parent, send serverChangeRequest and whereToConnect
oc
parents: 280
diff changeset
15 * 4 - - id
107
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
16 * 4 - U32 - length
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
17 * length - U8 array - text
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
18 */
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
19 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
20 final String bytes;
410
da1d6d6b4981 Enable retina scale to fit screen
innparusu
parents: 405
diff changeset
21 private final int scale;
da1d6d6b4981 Enable retina scale to fit screen
innparusu
parents: 405
diff changeset
22 private short id;
257
11b59b223222 add function of fixing display size
oc
parents: 170
diff changeset
23 private int frameSizeWidth;
11b59b223222 add function of fixing display size
oc
parents: 170
diff changeset
24 private int frameSizeHeight;
340
fd529c51095f add port ScreenChangeRequest value.
oc
parents: 339
diff changeset
25 private int port;
405
cdab1354e227 Add multiscreen Share Filtering flag
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 359
diff changeset
26 private int shareScreenNumber;
107
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
27
410
da1d6d6b4981 Enable retina scale to fit screen
innparusu
parents: 405
diff changeset
28 public ScreenChangeRequest(String adr, int port, short id, int width, int height, int shareScreenNumber, int scale) {
112
918dc3ee1c79 send composed data.
oc
parents: 111
diff changeset
29 this.bytes = adr;
340
fd529c51095f add port ScreenChangeRequest value.
oc
parents: 339
diff changeset
30 this.port = port;
170
2c36ea3f93da send id in initData message and changeServer.
oc
parents: 113
diff changeset
31 this.id = id;
257
11b59b223222 add function of fixing display size
oc
parents: 170
diff changeset
32 this.frameSizeWidth = width;
11b59b223222 add function of fixing display size
oc
parents: 170
diff changeset
33 this.frameSizeHeight = height;
405
cdab1354e227 Add multiscreen Share Filtering flag
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 359
diff changeset
34 this.shareScreenNumber = shareScreenNumber;
410
da1d6d6b4981 Enable retina scale to fit screen
innparusu
parents: 405
diff changeset
35 this.scale = scale;
112
918dc3ee1c79 send composed data.
oc
parents: 111
diff changeset
36 System.out.println("Client send change screen server request :" + adr);
107
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
37 }
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
38
280
9c5874d0f37e fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents: 257
diff changeset
39 @Override
9c5874d0f37e fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents: 257
diff changeset
40 public void send(Writer writer) throws TransportException {
410
da1d6d6b4981 Enable retina scale to fit screen
innparusu
parents: 405
diff changeset
41 ByteBuffer out = ByteBuffer.allocate(bytes.length()+29);
280
9c5874d0f37e fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents: 257
diff changeset
42 out.order(ByteOrder.BIG_ENDIAN);
9c5874d0f37e fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents: 257
diff changeset
43 out.put(SERVER_CHANGE_REQUEST);
9c5874d0f37e fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents: 257
diff changeset
44 out.put((byte)0); // padding
9c5874d0f37e fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents: 257
diff changeset
45 out.putShort(id);
9c5874d0f37e fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents: 257
diff changeset
46 out.putInt(bytes.length());
9c5874d0f37e fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents: 257
diff changeset
47 out.put(bytes.getBytes());
257
11b59b223222 add function of fixing display size
oc
parents: 170
diff changeset
48 out.putInt(frameSizeWidth);
11b59b223222 add function of fixing display size
oc
parents: 170
diff changeset
49 out.putInt(frameSizeHeight);
340
fd529c51095f add port ScreenChangeRequest value.
oc
parents: 339
diff changeset
50 out.putInt(port);
405
cdab1354e227 Add multiscreen Share Filtering flag
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 359
diff changeset
51 out.putInt(shareScreenNumber);
410
da1d6d6b4981 Enable retina scale to fit screen
innparusu
parents: 405
diff changeset
52 out.putInt(scale);
280
9c5874d0f37e fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents: 257
diff changeset
53 writer.write(out.array(), 0, out.position());
9c5874d0f37e fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents: 257
diff changeset
54 writer.flush();
9c5874d0f37e fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents: 257
diff changeset
55 }
107
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
56
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
57 @Override
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
58 public String toString() {
340
fd529c51095f add port ScreenChangeRequest value.
oc
parents: 339
diff changeset
59 return "Screen change request: [length: " + bytes.length() +", text: ...]" + new String (bytes) + " : " + port;
107
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
60 }
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
61 }