mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Merge branch 'tickets/35' of ssh://guacamole.git.sourceforge.net/gitroot/guacamole/guacamole into releases/0.3.0
This commit is contained in:
@@ -33,7 +33,9 @@
|
||||
depends="compile">
|
||||
<war destfile="${dist.dir}/guacamole.war"
|
||||
webxml="${build.dir}/WEB-INF/web.xml">
|
||||
<fileset dir="${build.dir}"/>
|
||||
<fileset dir="${build.dir}">
|
||||
<exclude name="META-INF/**"/>
|
||||
</fileset>
|
||||
</war>
|
||||
</target>
|
||||
|
||||
|
@@ -58,6 +58,18 @@
|
||||
<Parameter name="output-bpp" value="24"/>
|
||||
-->
|
||||
|
||||
|
||||
<!-- Swap red and blue components. Some VNC servers may not honor
|
||||
the client's request for certain pixel formats, instead
|
||||
returning RGB as BGR.
|
||||
|
||||
If colors look strange (blues look red or brown) when using
|
||||
Guacamole, uncomment and set this parameter to true. -->
|
||||
|
||||
<!--
|
||||
<Parameter name="swap-red-blue" value="false"/>
|
||||
-->
|
||||
|
||||
<Realm className="org.apache.catalina.realm.MemoryRealm" pathname="conf/guacamole-users.xml"/>
|
||||
</Context>
|
||||
|
||||
|
@@ -28,6 +28,7 @@ public class GuacamoleConfiguration extends Configuration {
|
||||
private int outputBPP;
|
||||
private boolean compressStream;
|
||||
private String protocol;
|
||||
private boolean swapRedAndBlue;
|
||||
|
||||
public GuacamoleConfiguration(ServletContext context) throws GuacamoleException {
|
||||
|
||||
@@ -37,6 +38,7 @@ public class GuacamoleConfiguration extends Configuration {
|
||||
outputBPP = readIntParameter("output-bpp", 8, 8, 24);
|
||||
compressStream = readBooleanParameter("compress-stream", false);
|
||||
protocol = readParameter("protocol", "vnc", "vnc");
|
||||
swapRedAndBlue = readBooleanParameter("swap-red-blue", false);
|
||||
|
||||
}
|
||||
|
||||
@@ -56,4 +58,8 @@ public class GuacamoleConfiguration extends Configuration {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public boolean getSwapRedAndBlue() {
|
||||
return swapRedAndBlue;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -123,7 +123,8 @@ public class GuacamoleSession {
|
||||
vncconfig.getPort(),
|
||||
vncconfig.getPassword(),
|
||||
vncconfig.getBPP(),
|
||||
config.getOutputBPP()
|
||||
config.getOutputBPP(),
|
||||
config.getSwapRedAndBlue()
|
||||
)
|
||||
);
|
||||
|
||||
|
@@ -165,7 +165,7 @@ public class VNCClient extends Client {
|
||||
}
|
||||
|
||||
// password = null for no authentication
|
||||
public VNCClient(String host, int port, String password, int colorBits, int outputBPP)
|
||||
public VNCClient(String host, int port, String password, int colorBits, int outputBPP, boolean swapRedAndBlue)
|
||||
throws VNCException {
|
||||
|
||||
try {
|
||||
@@ -325,11 +325,11 @@ public class VNCClient extends Client {
|
||||
// Set pixel format
|
||||
VNCFullColorImageReader fullColorReader;
|
||||
if (colorBits == 8)
|
||||
fullColorReader = new VNCFullColorImageReader(bigEndian, 3, 3, 2, 8);
|
||||
fullColorReader = new VNCFullColorImageReader(bigEndian, 3, 3, 2, 8, swapRedAndBlue);
|
||||
else if (colorBits == 16)
|
||||
fullColorReader = new VNCFullColorImageReader(bigEndian, 5, 6, 5, outputBPP);
|
||||
fullColorReader = new VNCFullColorImageReader(bigEndian, 5, 6, 5, outputBPP, swapRedAndBlue);
|
||||
else if (colorBits == 24)
|
||||
fullColorReader = new VNCFullColorImageReader(bigEndian, 8, 8, 8, outputBPP);
|
||||
fullColorReader = new VNCFullColorImageReader(bigEndian, 8, 8, 8, outputBPP, swapRedAndBlue);
|
||||
else
|
||||
throw new VNCException("Color depth " + colorBits + " not supported. Only color depths of 8, 16, or 24 are allowed.");
|
||||
|
||||
|
@@ -44,6 +44,8 @@ public class VNCFullColorImageReader extends VNCImageReader {
|
||||
private boolean readAsIndexed;
|
||||
private boolean bigEndian;
|
||||
|
||||
private boolean swapRedAndBlue;
|
||||
|
||||
public boolean isBigEndian() {
|
||||
return bigEndian;
|
||||
}
|
||||
@@ -81,8 +83,10 @@ public class VNCFullColorImageReader extends VNCImageReader {
|
||||
}
|
||||
|
||||
// Set up BGR reader
|
||||
public VNCFullColorImageReader(boolean bigEndian, int redBits, int greenBits, int blueBits, int outputBPP) throws VNCException {
|
||||
public VNCFullColorImageReader(boolean bigEndian, int redBits, int greenBits, int blueBits, int outputBPP, boolean swapRedAndBlue) throws VNCException {
|
||||
|
||||
this.swapRedAndBlue = swapRedAndBlue;
|
||||
|
||||
depth = redBits + greenBits + blueBits;
|
||||
|
||||
if (depth > 0 && depth <= 8)
|
||||
@@ -136,8 +140,10 @@ public class VNCFullColorImageReader extends VNCImageReader {
|
||||
red = input.read();
|
||||
}
|
||||
|
||||
int color = (red << 16) | (green << 8) | blue;
|
||||
return color;
|
||||
if (swapRedAndBlue)
|
||||
return (blue << 16) | (green << 8) | red;
|
||||
else
|
||||
return (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -173,8 +179,10 @@ public class VNCFullColorImageReader extends VNCImageReader {
|
||||
green <<= 8 - greenBits;
|
||||
blue <<= 8 - blueBits;
|
||||
|
||||
int color = (red << 16) | (green << 8) | blue;
|
||||
return color;
|
||||
if (swapRedAndBlue)
|
||||
return (blue << 16) | (green << 8) | red;
|
||||
else
|
||||
return (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user