mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-61 Console proxy has plenty of files with CRLF line ending.
This commit is contained in:
parent
f03d438c4c
commit
0bf8c5a18f
@ -30,8 +30,8 @@ import com.cloud.consoleproxy.util.ImageHelper;
|
|||||||
import com.cloud.consoleproxy.util.TileInfo;
|
import com.cloud.consoleproxy.util.TileInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A <code>BuffereImageCanvas</code> component represents frame buffer image on the
|
* A <code>BuffereImageCanvas</code> component represents frame buffer image on
|
||||||
* screen. It also notifies its subscribers when screen is repainted.
|
* the screen. It also notifies its subscribers when screen is repainted.
|
||||||
*/
|
*/
|
||||||
public class BufferedImageCanvas extends Canvas implements FrameBufferCanvas {
|
public class BufferedImageCanvas extends Canvas implements FrameBufferCanvas {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -75,7 +75,7 @@ public class BufferedImageCanvas extends Canvas implements FrameBufferCanvas {
|
|||||||
public void paint(Graphics g) {
|
public void paint(Graphics g) {
|
||||||
// Only part of image, requested with repaint(Rectangle), will be
|
// Only part of image, requested with repaint(Rectangle), will be
|
||||||
// painted on screen.
|
// painted on screen.
|
||||||
synchronized(offlineImage) {
|
synchronized (offlineImage) {
|
||||||
g.drawImage(offlineImage, 0, 0, this);
|
g.drawImage(offlineImage, 0, 0, this);
|
||||||
}
|
}
|
||||||
// Notify server that update is painted on screen
|
// Notify server that update is painted on screen
|
||||||
@ -91,15 +91,14 @@ public class BufferedImageCanvas extends Canvas implements FrameBufferCanvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void copyTile(Graphics2D g, int x, int y, Rectangle rc) {
|
public void copyTile(Graphics2D g, int x, int y, Rectangle rc) {
|
||||||
synchronized(offlineImage) {
|
synchronized (offlineImage) {
|
||||||
g.drawImage(offlineImage, x, y, x + rc.width, y + rc.height,
|
g.drawImage(offlineImage, x, y, x + rc.width, y + rc.height, rc.x, rc.y, rc.x + rc.width, rc.y + rc.height, null);
|
||||||
rc.x, rc.y, rc.x + rc.width, rc.y + rc.height, null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Image getFrameBufferScaledImage(int width, int height) {
|
public Image getFrameBufferScaledImage(int width, int height) {
|
||||||
if(offlineImage != null)
|
if (offlineImage != null)
|
||||||
return offlineImage.getScaledInstance(width, height, Image.SCALE_DEFAULT);
|
return offlineImage.getScaledInstance(width, height, Image.SCALE_DEFAULT);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -112,10 +111,9 @@ public class BufferedImageCanvas extends Canvas implements FrameBufferCanvas {
|
|||||||
width = offlineImage.getWidth();
|
width = offlineImage.getWidth();
|
||||||
height = offlineImage.getHeight();
|
height = offlineImage.getHeight();
|
||||||
|
|
||||||
BufferedImage bufferedImage = new BufferedImage(width, height,
|
BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
|
||||||
BufferedImage.TYPE_3BYTE_BGR);
|
|
||||||
Graphics2D g = bufferedImage.createGraphics();
|
Graphics2D g = bufferedImage.createGraphics();
|
||||||
synchronized(offlineImage) {
|
synchronized (offlineImage) {
|
||||||
g.drawImage(offlineImage, 0, 0, width, height, 0, 0, width, height, null);
|
g.drawImage(offlineImage, 0, 0, width, height, 0, 0, width, height, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,17 +127,15 @@ public class BufferedImageCanvas extends Canvas implements FrameBufferCanvas {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] getTilesMergedJpeg(List<TileInfo> tileList, int tileWidth, int tileHeight) {
|
public byte[] getTilesMergedJpeg(List<TileInfo> tileList, int tileWidth, int tileHeight) {
|
||||||
int width = Math.max(tileWidth, tileWidth*tileList.size());
|
int width = Math.max(tileWidth, tileWidth * tileList.size());
|
||||||
BufferedImage bufferedImage = new BufferedImage(width, tileHeight,
|
BufferedImage bufferedImage = new BufferedImage(width, tileHeight, BufferedImage.TYPE_3BYTE_BGR);
|
||||||
BufferedImage.TYPE_3BYTE_BGR);
|
|
||||||
Graphics2D g = bufferedImage.createGraphics();
|
Graphics2D g = bufferedImage.createGraphics();
|
||||||
|
|
||||||
synchronized(offlineImage) {
|
synchronized (offlineImage) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(TileInfo tile : tileList) {
|
for (TileInfo tile : tileList) {
|
||||||
Rectangle rc = tile.getTileRect();
|
Rectangle rc = tile.getTileRect();
|
||||||
g.drawImage(offlineImage, i*tileWidth, 0, i*tileWidth + rc.width, rc.height,
|
g.drawImage(offlineImage, i * tileWidth, 0, i * tileWidth + rc.width, rc.height, rc.x, rc.y, rc.x + rc.width, rc.y + rc.height, null);
|
||||||
rc.x, rc.y, rc.x + rc.width, rc.y + rc.height, null);
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,8 @@ import com.cloud.consoleproxy.util.TileInfo;
|
|||||||
|
|
||||||
public interface FrameBufferCanvas {
|
public interface FrameBufferCanvas {
|
||||||
Image getFrameBufferScaledImage(int width, int height);
|
Image getFrameBufferScaledImage(int width, int height);
|
||||||
|
|
||||||
public byte[] getFrameBufferJpeg();
|
public byte[] getFrameBufferJpeg();
|
||||||
|
|
||||||
public byte[] getTilesMergedJpeg(List<TileInfo> tileList, int tileWidth, int tileHeight);
|
public byte[] getTilesMergedJpeg(List<TileInfo> tileList, int tileWidth, int tileHeight);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,8 +19,8 @@ package com.cloud.consoleproxy.vnc;
|
|||||||
public interface FrameBufferUpdateListener {
|
public interface FrameBufferUpdateListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify listener, that frame buffer update packet is received, so client is
|
* Notify listener, that frame buffer update packet is received, so client
|
||||||
* permitted (but not obligated) to ask server to send another update.
|
* is permitted (but not obligated) to ask server to send another update.
|
||||||
*/
|
*/
|
||||||
void frameBufferPacketReceived();
|
void frameBufferPacketReceived();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,8 +19,8 @@ package com.cloud.consoleproxy.vnc;
|
|||||||
public interface PaintNotificationListener {
|
public interface PaintNotificationListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify subscriber that screen is updated, so client can send another frame
|
* Notify subscriber that screen is updated, so client can send another
|
||||||
* buffer update request to server.
|
* frame buffer update request to server.
|
||||||
*/
|
*/
|
||||||
void imagePaintedOnScreen();
|
void imagePaintedOnScreen();
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ import java.nio.charset.Charset;
|
|||||||
public interface RfbConstants {
|
public interface RfbConstants {
|
||||||
|
|
||||||
public static final String RFB_PROTOCOL_VERSION_MAJOR = "RFB 003.";
|
public static final String RFB_PROTOCOL_VERSION_MAJOR = "RFB 003.";
|
||||||
// public static final String VNC_PROTOCOL_VERSION_MINOR = "003";
|
// public static final String VNC_PROTOCOL_VERSION_MINOR = "003";
|
||||||
public static final String VNC_PROTOCOL_VERSION_MINOR = "003";
|
public static final String VNC_PROTOCOL_VERSION_MINOR = "003";
|
||||||
public static final String RFB_PROTOCOL_VERSION = RFB_PROTOCOL_VERSION_MAJOR + VNC_PROTOCOL_VERSION_MINOR;
|
public static final String RFB_PROTOCOL_VERSION = RFB_PROTOCOL_VERSION_MAJOR + VNC_PROTOCOL_VERSION_MINOR;
|
||||||
|
|
||||||
@ -33,8 +33,8 @@ public interface RfbConstants {
|
|||||||
/**
|
/**
|
||||||
* Client message types.
|
* Client message types.
|
||||||
*/
|
*/
|
||||||
public static final int CLIENT_SET_PIXEL_FORMAT = 0, CLIENT_FIX_COLOURMAP_ENTRIES = 1, CLIENT_SET_ENCODINGS = 2, CLIENT_FRAMEBUFFER_UPDATE_REQUEST = 3,
|
public static final int CLIENT_SET_PIXEL_FORMAT = 0, CLIENT_FIX_COLOURMAP_ENTRIES = 1, CLIENT_SET_ENCODINGS = 2, CLIENT_FRAMEBUFFER_UPDATE_REQUEST = 3, CLIENT_KEYBOARD_EVENT = 4,
|
||||||
CLIENT_KEYBOARD_EVENT = 4, CLIENT_POINTER_EVENT = 5, CLIENT_CUT_TEXT = 6;
|
CLIENT_POINTER_EVENT = 5, CLIENT_CUT_TEXT = 6;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server authorization type
|
* Server authorization type
|
||||||
@ -54,7 +54,7 @@ public interface RfbConstants {
|
|||||||
/**
|
/**
|
||||||
* Pseudo-encodings.
|
* Pseudo-encodings.
|
||||||
*/
|
*/
|
||||||
public final static int ENCODING_CURSOR = -239 /*0xFFFFFF11*/, ENCODING_DESKTOP_SIZE = -223 /*0xFFFFFF21*/;
|
public final static int ENCODING_CURSOR = -239 /* 0xFFFFFF11 */, ENCODING_DESKTOP_SIZE = -223 /* 0xFFFFFF21 */;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encodings, which we support.
|
* Encodings, which we support.
|
||||||
@ -62,7 +62,8 @@ public interface RfbConstants {
|
|||||||
public final static int[] SUPPORTED_ENCODINGS_ARRAY = { ENCODING_RAW, ENCODING_COPY_RECT, ENCODING_DESKTOP_SIZE };
|
public final static int[] SUPPORTED_ENCODINGS_ARRAY = { ENCODING_RAW, ENCODING_COPY_RECT, ENCODING_DESKTOP_SIZE };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Frame buffer update request type: update of whole screen or partial update.
|
* Frame buffer update request type: update of whole screen or partial
|
||||||
|
* update.
|
||||||
*/
|
*/
|
||||||
public static final int FRAMEBUFFER_FULL_UPDATE_REQUEST = 0, FRAMEBUFFER_INCREMENTAL_UPDATE_REQUEST = 1;
|
public static final int FRAMEBUFFER_FULL_UPDATE_REQUEST = 0, FRAMEBUFFER_INCREMENTAL_UPDATE_REQUEST = 1;
|
||||||
|
|
||||||
|
|||||||
@ -90,8 +90,7 @@ public class VncClient {
|
|||||||
this.clientListener = clientListener;
|
this.clientListener = clientListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VncClient(String host, int port, String password, boolean noUI, ConsoleProxyClientListener clientListener)
|
public VncClient(String host, int port, String password, boolean noUI, ConsoleProxyClientListener clientListener) throws UnknownHostException, IOException {
|
||||||
throws UnknownHostException, IOException {
|
|
||||||
|
|
||||||
this.noUI = noUI;
|
this.noUI = noUI;
|
||||||
this.clientListener = clientListener;
|
this.clientListener = clientListener;
|
||||||
@ -99,27 +98,27 @@ public class VncClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
if(sender != null)
|
if (sender != null)
|
||||||
sender.closeConnection();
|
sender.closeConnection();
|
||||||
|
|
||||||
if(receiver != null)
|
if (receiver != null)
|
||||||
receiver.closeConnection();
|
receiver.closeConnection();
|
||||||
|
|
||||||
if(is != null) {
|
if (is != null) {
|
||||||
try {
|
try {
|
||||||
is.close();
|
is.close();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(os != null) {
|
if (os != null) {
|
||||||
try {
|
try {
|
||||||
os.close();
|
os.close();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(socket != null) {
|
if (socket != null) {
|
||||||
try {
|
try {
|
||||||
socket.close();
|
socket.close();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
@ -131,10 +130,9 @@ public class VncClient {
|
|||||||
return clientListener;
|
return clientListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void connectTo(String host, int port, String path,
|
public void connectTo(String host, int port, String path, String session, boolean useSSL, String sid) throws UnknownHostException, IOException {
|
||||||
String session, boolean useSSL, String sid) throws UnknownHostException, IOException {
|
if (port < 0) {
|
||||||
if(port < 0) {
|
if (useSSL)
|
||||||
if(useSSL)
|
|
||||||
port = 443;
|
port = 443;
|
||||||
else
|
else
|
||||||
port = 80;
|
port = 80;
|
||||||
@ -175,7 +173,7 @@ public class VncClient {
|
|||||||
canvas.addKeyListener(sender);
|
canvas.addKeyListener(sender);
|
||||||
|
|
||||||
Frame frame = null;
|
Frame frame = null;
|
||||||
if(!noUI)
|
if (!noUI)
|
||||||
frame = createVncClientMainWindow(canvas, screen.getDesktopName());
|
frame = createVncClientMainWindow(canvas, screen.getDesktopName());
|
||||||
|
|
||||||
new Thread(sender).start();
|
new Thread(sender).start();
|
||||||
@ -185,7 +183,7 @@ public class VncClient {
|
|||||||
try {
|
try {
|
||||||
receiver.run();
|
receiver.run();
|
||||||
} finally {
|
} finally {
|
||||||
if(frame != null) {
|
if (frame != null) {
|
||||||
frame.setVisible(false);
|
frame.setVisible(false);
|
||||||
frame.dispose();
|
frame.dispose();
|
||||||
}
|
}
|
||||||
@ -355,7 +353,8 @@ public class VncClient {
|
|||||||
* bit. E.g. 01001100 will become 00110010.
|
* bit. E.g. 01001100 will become 00110010.
|
||||||
*
|
*
|
||||||
* See also: http://www.vidarholen.net/contents/junk/vnc.html ,
|
* See also: http://www.vidarholen.net/contents/junk/vnc.html ,
|
||||||
* http://bytecrafter .blogspot.com/2010/09/des-encryption-as-used-in-vnc.html
|
* http://bytecrafter
|
||||||
|
* .blogspot.com/2010/09/des-encryption-as-used-in-vnc.html
|
||||||
*
|
*
|
||||||
* @param b
|
* @param b
|
||||||
* a byte
|
* a byte
|
||||||
@ -388,7 +387,7 @@ public class VncClient {
|
|||||||
int framebufferWidth = is.readUnsignedShort();
|
int framebufferWidth = is.readUnsignedShort();
|
||||||
int framebufferHeight = is.readUnsignedShort();
|
int framebufferHeight = is.readUnsignedShort();
|
||||||
screen.setFramebufferSize(framebufferWidth, framebufferHeight);
|
screen.setFramebufferSize(framebufferWidth, framebufferHeight);
|
||||||
if(clientListener != null)
|
if (clientListener != null)
|
||||||
clientListener.onFramebufferSizeChange(framebufferWidth, framebufferHeight);
|
clientListener.onFramebufferSizeChange(framebufferWidth, framebufferHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,14 +424,14 @@ public class VncClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FrameBufferCanvas getFrameBufferCanvas() {
|
public FrameBufferCanvas getFrameBufferCanvas() {
|
||||||
if(receiver != null)
|
if (receiver != null)
|
||||||
return receiver.getCanvas();
|
return receiver.getCanvas();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void requestUpdate(boolean fullUpdate) {
|
public void requestUpdate(boolean fullUpdate) {
|
||||||
if(fullUpdate)
|
if (fullUpdate)
|
||||||
sender.requestFullScreenUpdate();
|
sender.requestFullScreenUpdate();
|
||||||
else
|
else
|
||||||
sender.imagePaintedOnScreen();
|
sender.imagePaintedOnScreen();
|
||||||
|
|||||||
@ -97,16 +97,14 @@ public class VncClientPacketSender implements Runnable, PaintNotificationListene
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void requestFullScreenUpdate() {
|
public void requestFullScreenUpdate() {
|
||||||
queue.add(new FramebufferUpdateRequestPacket(RfbConstants.FRAMEBUFFER_FULL_UPDATE_REQUEST, 0, 0, screen.getFramebufferWidth(), screen
|
queue.add(new FramebufferUpdateRequestPacket(RfbConstants.FRAMEBUFFER_FULL_UPDATE_REQUEST, 0, 0, screen.getFramebufferWidth(), screen.getFramebufferHeight()));
|
||||||
.getFramebufferHeight()));
|
|
||||||
updateRequestSent = true;
|
updateRequestSent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void imagePaintedOnScreen() {
|
public void imagePaintedOnScreen() {
|
||||||
if (!updateRequestSent) {
|
if (!updateRequestSent) {
|
||||||
queue.add(new FramebufferUpdateRequestPacket(RfbConstants.FRAMEBUFFER_INCREMENTAL_UPDATE_REQUEST, 0, 0, screen.getFramebufferWidth(), screen
|
queue.add(new FramebufferUpdateRequestPacket(RfbConstants.FRAMEBUFFER_INCREMENTAL_UPDATE_REQUEST, 0, 0, screen.getFramebufferWidth(), screen.getFramebufferHeight()));
|
||||||
.getFramebufferHeight()));
|
|
||||||
updateRequestSent = true;
|
updateRequestSent = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,13 +41,12 @@ public class VncScreenDescription {
|
|||||||
/**
|
/**
|
||||||
* Store information about server pixel format.
|
* Store information about server pixel format.
|
||||||
*/
|
*/
|
||||||
public void setPixelFormat(int bitsPerPixel, int depth, int bigEndianFlag, int trueColorFlag, int redMax, int greenMax, int blueMax, int redShift,
|
public void setPixelFormat(int bitsPerPixel, int depth, int bigEndianFlag, int trueColorFlag, int redMax, int greenMax, int blueMax, int redShift, int greenShift, int blueShift) {
|
||||||
int greenShift, int blueShift) {
|
|
||||||
|
|
||||||
bytesPerPixel = (bitsPerPixel + 7) / 8;
|
bytesPerPixel = (bitsPerPixel + 7) / 8;
|
||||||
|
|
||||||
rgb888_32_le = (depth == 24 && bitsPerPixel == 32 && redShift == 16 && greenShift == 8 && blueShift == 0 && redMax == 255 && greenMax == 255
|
rgb888_32_le = (depth == 24 && bitsPerPixel == 32 && redShift == 16 && greenShift == 8 && blueShift == 0 && redMax == 255 && greenMax == 255 && blueMax == 255
|
||||||
&& blueMax == 255 && bigEndianFlag == RfbConstants.LITTLE_ENDIAN && trueColorFlag == RfbConstants.TRUE_COLOR);
|
&& bigEndianFlag == RfbConstants.LITTLE_ENDIAN && trueColorFlag == RfbConstants.TRUE_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -38,8 +38,8 @@ public class VncServerPacketReceiver implements Runnable {
|
|||||||
private final FrameBufferUpdateListener fburListener;
|
private final FrameBufferUpdateListener fburListener;
|
||||||
private final ConsoleProxyClientListener clientListener;
|
private final ConsoleProxyClientListener clientListener;
|
||||||
|
|
||||||
public VncServerPacketReceiver(DataInputStream is, BufferedImageCanvas canvas, VncScreenDescription screen, VncClient vncConnection,
|
public VncServerPacketReceiver(DataInputStream is, BufferedImageCanvas canvas, VncScreenDescription screen, VncClient vncConnection, FrameBufferUpdateListener fburListener,
|
||||||
FrameBufferUpdateListener fburListener, ConsoleProxyClientListener clientListener) {
|
ConsoleProxyClientListener clientListener) {
|
||||||
this.screen = screen;
|
this.screen = screen;
|
||||||
this.canvas = canvas;
|
this.canvas = canvas;
|
||||||
this.is = is;
|
this.is = is;
|
||||||
@ -118,6 +118,6 @@ public class VncServerPacketReceiver implements Runnable {
|
|||||||
StringSelection contents = new StringSelection(clipboardContent.getContent());
|
StringSelection contents = new StringSelection(clipboardContent.getContent());
|
||||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(contents, null);
|
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(contents, null);
|
||||||
|
|
||||||
s_logger.info("Server clipboard buffer: "+clipboardContent.getContent());
|
s_logger.info("Server clipboard buffer: " + clipboardContent.getContent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,6 @@ public class FramebufferUpdateRequestPacket implements ClientPacket {
|
|||||||
this.height = height;
|
this.height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(DataOutputStream os) throws IOException {
|
public void write(DataOutputStream os) throws IOException {
|
||||||
os.writeByte(RfbConstants.CLIENT_FRAMEBUFFER_UPDATE_REQUEST);
|
os.writeByte(RfbConstants.CLIENT_FRAMEBUFFER_UPDATE_REQUEST);
|
||||||
|
|||||||
@ -25,22 +25,19 @@ public class SetEncodingsPacket implements ClientPacket {
|
|||||||
|
|
||||||
private final int[] encodings;
|
private final int[] encodings;
|
||||||
|
|
||||||
public SetEncodingsPacket(int[] encodings)
|
public SetEncodingsPacket(int[] encodings) {
|
||||||
{
|
|
||||||
this.encodings = encodings;
|
this.encodings = encodings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(DataOutputStream os) throws IOException
|
public void write(DataOutputStream os) throws IOException {
|
||||||
{
|
|
||||||
os.writeByte(RfbConstants.CLIENT_SET_ENCODINGS);
|
os.writeByte(RfbConstants.CLIENT_SET_ENCODINGS);
|
||||||
|
|
||||||
os.writeByte(0);//padding
|
os.writeByte(0);// padding
|
||||||
|
|
||||||
os.writeShort(encodings.length);
|
os.writeShort(encodings.length);
|
||||||
|
|
||||||
for(int i=0;i<encodings.length;i++)
|
for (int i = 0; i < encodings.length; i++) {
|
||||||
{
|
|
||||||
os.writeInt(encodings[i]);
|
os.writeInt(encodings[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,8 +28,8 @@ public class SetPixelFormatPacket implements ClientPacket {
|
|||||||
|
|
||||||
private final VncScreenDescription screen;
|
private final VncScreenDescription screen;
|
||||||
|
|
||||||
public SetPixelFormatPacket(VncScreenDescription screen, int bitsPerPixel, int depth, int bigEndianFlag, int trueColorFlag, int redMax, int greenMax,
|
public SetPixelFormatPacket(VncScreenDescription screen, int bitsPerPixel, int depth, int bigEndianFlag, int trueColorFlag, int redMax, int greenMax, int blueMax, int redShift, int greenShift,
|
||||||
int blueMax, int redShift, int greenShift, int blueShift) {
|
int blueShift) {
|
||||||
this.screen = screen;
|
this.screen = screen;
|
||||||
this.bitsPerPixel = bitsPerPixel;
|
this.bitsPerPixel = bitsPerPixel;
|
||||||
this.depth = depth;
|
this.depth = depth;
|
||||||
|
|||||||
@ -33,8 +33,7 @@ public class FramebufferUpdatePacket {
|
|||||||
private final BufferedImageCanvas canvas;
|
private final BufferedImageCanvas canvas;
|
||||||
private final ConsoleProxyClientListener clientListener;
|
private final ConsoleProxyClientListener clientListener;
|
||||||
|
|
||||||
public FramebufferUpdatePacket(BufferedImageCanvas canvas, VncScreenDescription screen, DataInputStream is,
|
public FramebufferUpdatePacket(BufferedImageCanvas canvas, VncScreenDescription screen, DataInputStream is, ConsoleProxyClientListener clientListener) throws IOException {
|
||||||
ConsoleProxyClientListener clientListener) throws IOException {
|
|
||||||
|
|
||||||
this.screen = screen;
|
this.screen = screen;
|
||||||
this.canvas = canvas;
|
this.canvas = canvas;
|
||||||
@ -75,7 +74,7 @@ public class FramebufferUpdatePacket {
|
|||||||
|
|
||||||
case RfbConstants.ENCODING_DESKTOP_SIZE: {
|
case RfbConstants.ENCODING_DESKTOP_SIZE: {
|
||||||
rect = new FrameBufferSizeChangeRequest(canvas, width, height);
|
rect = new FrameBufferSizeChangeRequest(canvas, width, height);
|
||||||
if(this.clientListener != null)
|
if (this.clientListener != null)
|
||||||
this.clientListener.onFramebufferSizeChange(width, height);
|
this.clientListener.onFramebufferSizeChange(width, height);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -86,7 +85,7 @@ public class FramebufferUpdatePacket {
|
|||||||
|
|
||||||
paint(rect, canvas);
|
paint(rect, canvas);
|
||||||
|
|
||||||
if(this.clientListener != null)
|
if (this.clientListener != null)
|
||||||
this.clientListener.onFramebufferUpdate(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
|
this.clientListener.onFramebufferUpdate(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -69,8 +69,7 @@ public class RawRect extends AbstractRect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Unsupported data buffer in buffered image: expected data buffer of type int (DataBufferInt). Actual data buffer type: "
|
throw new RuntimeException("Unsupported data buffer in buffered image: expected data buffer of type int (DataBufferInt). Actual data buffer type: " + dataBuf.getClass().getSimpleName());
|
||||||
+ dataBuf.getClass().getSimpleName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,10 @@ public interface Rect {
|
|||||||
void paint(BufferedImage offlineImage, Graphics2D graphics);
|
void paint(BufferedImage offlineImage, Graphics2D graphics);
|
||||||
|
|
||||||
int getX();
|
int getX();
|
||||||
|
|
||||||
int getY();
|
int getY();
|
||||||
|
|
||||||
int getWidth();
|
int getWidth();
|
||||||
|
|
||||||
int getHeight();
|
int getHeight();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user