diff 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
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/protocol/Protocol.java	Tue Jun 18 19:15:21 2013 +0900
+++ b/src/main/java/com/glavsoft/rfb/protocol/Protocol.java	Tue Jul 09 18:08:16 2013 +0900
@@ -67,6 +67,7 @@
 	private Thread senderThread;
 	private Thread receiverThread;
 	private byte[] initData;
+	private boolean isRetina = false;
 
 	public Protocol(Reader reader, Writer writer,
 			IPasswordRetriever passwordRetriever, ProtocolSettings settings) {
@@ -78,7 +79,7 @@
 		decoders.instantiateDecodersWhenNeeded(settings.encodings);
 		state = new HandshakeState(this);
 	}
-
+	
 	@Override
 	public void changeStateTo(ProtocolState state) {
 		this.state = state;
@@ -117,19 +118,17 @@
 
 	@Override
 	public int getFbWidth() {
-		//return 1000;
 		return fbWidth;
 	}
 
 	@Override
 	public void setFbWidth(int fbWidth) {
-		// this.fbWidth = 1002;
-		this.fbWidth = fbWidth;
+		if(!isRetina)
+			this.fbWidth = fbWidth;
 	}
 
 	@Override
 	public int getFbHeight() {
-		//return 500;
 		return fbHeight;
 	}
 
@@ -145,8 +144,8 @@
 	
 	@Override
 	public void setFbHeight(int fbHeight) {
-		// this.fbHeight = 502;
-		 this.fbHeight = fbHeight;
+		if(!isRetina)
+			this.fbHeight = fbHeight;
 	}
 
 	@Override
@@ -265,8 +264,8 @@
 
 	@Override
 	public void sendRefreshMessage() {
-		// sendMessage(new FramebufferUpdateRequestMessage(0, 0, fbWidth, fbHeight, false));
-		sendMessage(new FramebufferUpdateRequestMessage(0, 0, 1000, 500, false));
+//	    sendMessage(new FramebufferUpdateRequestMessage(0, 0, fbWidth, fbHeight, false));
+		sendMessage(new FramebufferUpdateRequestMessage(0, 0, 1006, 506, false));
 		logger.fine("sent: full FB Refresh");
 	}
 
@@ -361,4 +360,9 @@
 		receiverThread.start();
 	}
 	
+	public void setScreenSizeRetina(int fbWidth, int fbHeight) {
+		isRetina = true;
+		this.fbWidth = fbWidth;
+		this.fbHeight = fbHeight;
+	}
 }