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">
|
depends="compile">
|
||||||
<war destfile="${dist.dir}/guacamole.war"
|
<war destfile="${dist.dir}/guacamole.war"
|
||||||
webxml="${build.dir}/WEB-INF/web.xml">
|
webxml="${build.dir}/WEB-INF/web.xml">
|
||||||
<fileset dir="${build.dir}"/>
|
<fileset dir="${build.dir}">
|
||||||
|
<exclude name="META-INF/**"/>
|
||||||
|
</fileset>
|
||||||
</war>
|
</war>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
@@ -58,6 +58,18 @@
|
|||||||
<Parameter name="output-bpp" value="24"/>
|
<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"/>
|
<Realm className="org.apache.catalina.realm.MemoryRealm" pathname="conf/guacamole-users.xml"/>
|
||||||
</Context>
|
</Context>
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@ public class GuacamoleConfiguration extends Configuration {
|
|||||||
private int outputBPP;
|
private int outputBPP;
|
||||||
private boolean compressStream;
|
private boolean compressStream;
|
||||||
private String protocol;
|
private String protocol;
|
||||||
|
private boolean swapRedAndBlue;
|
||||||
|
|
||||||
public GuacamoleConfiguration(ServletContext context) throws GuacamoleException {
|
public GuacamoleConfiguration(ServletContext context) throws GuacamoleException {
|
||||||
|
|
||||||
@@ -37,6 +38,7 @@ public class GuacamoleConfiguration extends Configuration {
|
|||||||
outputBPP = readIntParameter("output-bpp", 8, 8, 24);
|
outputBPP = readIntParameter("output-bpp", 8, 8, 24);
|
||||||
compressStream = readBooleanParameter("compress-stream", false);
|
compressStream = readBooleanParameter("compress-stream", false);
|
||||||
protocol = readParameter("protocol", "vnc", "vnc");
|
protocol = readParameter("protocol", "vnc", "vnc");
|
||||||
|
swapRedAndBlue = readBooleanParameter("swap-red-blue", false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,4 +58,8 @@ public class GuacamoleConfiguration extends Configuration {
|
|||||||
return protocol;
|
return protocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getSwapRedAndBlue() {
|
||||||
|
return swapRedAndBlue;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -123,7 +123,8 @@ public class GuacamoleSession {
|
|||||||
vncconfig.getPort(),
|
vncconfig.getPort(),
|
||||||
vncconfig.getPassword(),
|
vncconfig.getPassword(),
|
||||||
vncconfig.getBPP(),
|
vncconfig.getBPP(),
|
||||||
config.getOutputBPP()
|
config.getOutputBPP(),
|
||||||
|
config.getSwapRedAndBlue()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -165,7 +165,7 @@ public class VNCClient extends Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// password = null for no authentication
|
// 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 {
|
throws VNCException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -325,11 +325,11 @@ public class VNCClient extends Client {
|
|||||||
// Set pixel format
|
// Set pixel format
|
||||||
VNCFullColorImageReader fullColorReader;
|
VNCFullColorImageReader fullColorReader;
|
||||||
if (colorBits == 8)
|
if (colorBits == 8)
|
||||||
fullColorReader = new VNCFullColorImageReader(bigEndian, 3, 3, 2, 8);
|
fullColorReader = new VNCFullColorImageReader(bigEndian, 3, 3, 2, 8, swapRedAndBlue);
|
||||||
else if (colorBits == 16)
|
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)
|
else if (colorBits == 24)
|
||||||
fullColorReader = new VNCFullColorImageReader(bigEndian, 8, 8, 8, outputBPP);
|
fullColorReader = new VNCFullColorImageReader(bigEndian, 8, 8, 8, outputBPP, swapRedAndBlue);
|
||||||
else
|
else
|
||||||
throw new VNCException("Color depth " + colorBits + " not supported. Only color depths of 8, 16, or 24 are allowed.");
|
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 readAsIndexed;
|
||||||
private boolean bigEndian;
|
private boolean bigEndian;
|
||||||
|
|
||||||
|
private boolean swapRedAndBlue;
|
||||||
|
|
||||||
public boolean isBigEndian() {
|
public boolean isBigEndian() {
|
||||||
return bigEndian;
|
return bigEndian;
|
||||||
}
|
}
|
||||||
@@ -81,7 +83,9 @@ public class VNCFullColorImageReader extends VNCImageReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up BGR reader
|
// 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;
|
depth = redBits + greenBits + blueBits;
|
||||||
|
|
||||||
@@ -136,8 +140,10 @@ public class VNCFullColorImageReader extends VNCImageReader {
|
|||||||
red = input.read();
|
red = input.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
int color = (red << 16) | (green << 8) | blue;
|
if (swapRedAndBlue)
|
||||||
return color;
|
return (blue << 16) | (green << 8) | red;
|
||||||
|
else
|
||||||
|
return (red << 16) | (green << 8) | blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -173,8 +179,10 @@ public class VNCFullColorImageReader extends VNCImageReader {
|
|||||||
green <<= 8 - greenBits;
|
green <<= 8 - greenBits;
|
||||||
blue <<= 8 - blueBits;
|
blue <<= 8 - blueBits;
|
||||||
|
|
||||||
int color = (red << 16) | (green << 8) | blue;
|
if (swapRedAndBlue)
|
||||||
return color;
|
return (blue << 16) | (green << 8) | red;
|
||||||
|
else
|
||||||
|
return (red << 16) | (green << 8) | blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user