comparison src/main/java/com/glavsoft/rfb/protocol/Protocol.java @ 50:225e3873d75f

Modified to be able to specify the region of the screen in the argument.
author one
date Tue, 09 Jul 2013 18:08:16 +0900
parents b0c7fad4c695
children 986f16afb753
comparison
equal deleted inserted replaced
49:b0c7fad4c695 50:225e3873d75f
65 private IRepaintController repaintController; 65 private IRepaintController repaintController;
66 private PixelFormat serverPixelFormat; 66 private PixelFormat serverPixelFormat;
67 private Thread senderThread; 67 private Thread senderThread;
68 private Thread receiverThread; 68 private Thread receiverThread;
69 private byte[] initData; 69 private byte[] initData;
70 private boolean isRetina = false;
70 71
71 public Protocol(Reader reader, Writer writer, 72 public Protocol(Reader reader, Writer writer,
72 IPasswordRetriever passwordRetriever, ProtocolSettings settings) { 73 IPasswordRetriever passwordRetriever, ProtocolSettings settings) {
73 this.reader = reader; 74 this.reader = reader;
74 this.writer = writer; 75 this.writer = writer;
76 this.settings = settings; 77 this.settings = settings;
77 decoders = new DecodersContainer(); 78 decoders = new DecodersContainer();
78 decoders.instantiateDecodersWhenNeeded(settings.encodings); 79 decoders.instantiateDecodersWhenNeeded(settings.encodings);
79 state = new HandshakeState(this); 80 state = new HandshakeState(this);
80 } 81 }
81 82
82 @Override 83 @Override
83 public void changeStateTo(ProtocolState state) { 84 public void changeStateTo(ProtocolState state) {
84 this.state = state; 85 this.state = state;
85 } 86 }
86 87
115 remoteDesctopName = name; 116 remoteDesctopName = name;
116 } 117 }
117 118
118 @Override 119 @Override
119 public int getFbWidth() { 120 public int getFbWidth() {
120 //return 1000;
121 return fbWidth; 121 return fbWidth;
122 } 122 }
123 123
124 @Override 124 @Override
125 public void setFbWidth(int fbWidth) { 125 public void setFbWidth(int fbWidth) {
126 // this.fbWidth = 1002; 126 if(!isRetina)
127 this.fbWidth = fbWidth; 127 this.fbWidth = fbWidth;
128 } 128 }
129 129
130 @Override 130 @Override
131 public int getFbHeight() { 131 public int getFbHeight() {
132 //return 500;
133 return fbHeight; 132 return fbHeight;
134 } 133 }
135 134
136 @Override 135 @Override
137 public byte[] getInitData() { 136 public byte[] getInitData() {
143 this.initData = initData; 142 this.initData = initData;
144 } 143 }
145 144
146 @Override 145 @Override
147 public void setFbHeight(int fbHeight) { 146 public void setFbHeight(int fbHeight) {
148 // this.fbHeight = 502; 147 if(!isRetina)
149 this.fbHeight = fbHeight; 148 this.fbHeight = fbHeight;
150 } 149 }
151 150
152 @Override 151 @Override
153 public IPasswordRetriever getPasswordRetriever() { 152 public IPasswordRetriever getPasswordRetriever() {
154 return passwordRetriever; 153 return passwordRetriever;
263 } 262 }
264 } 263 }
265 264
266 @Override 265 @Override
267 public void sendRefreshMessage() { 266 public void sendRefreshMessage() {
268 // sendMessage(new FramebufferUpdateRequestMessage(0, 0, fbWidth, fbHeight, false)); 267 // sendMessage(new FramebufferUpdateRequestMessage(0, 0, fbWidth, fbHeight, false));
269 sendMessage(new FramebufferUpdateRequestMessage(0, 0, 1000, 500, false)); 268 sendMessage(new FramebufferUpdateRequestMessage(0, 0, 1006, 506, false));
270 logger.fine("sent: full FB Refresh"); 269 logger.fine("sent: full FB Refresh");
271 } 270 }
272 271
273 @Override 272 @Override
274 public void cleanUpSession(String message) { 273 public void cleanUpSession(String message) {
359 decoders, this, rfb); 358 decoders, this, rfb);
360 receiverThread = new Thread(receiverTask); 359 receiverThread = new Thread(receiverTask);
361 receiverThread.start(); 360 receiverThread.start();
362 } 361 }
363 362
363 public void setScreenSizeRetina(int fbWidth, int fbHeight) {
364 isRetina = true;
365 this.fbWidth = fbWidth;
366 this.fbHeight = fbHeight;
367 }
364 } 368 }