Also, the Windows viewer now accepts arguments with both spellings. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@69 3789f03b-4d11-0410-bbf8-ca57d06f2519tags/v0.0.90
} | } | ||||
if (!trueColour) { | if (!trueColour) { | ||||
strncat(str, " colour-map", len-1-strlen(str)); | |||||
strncat(str, " color-map", len-1-strlen(str)); | |||||
return; | return; | ||||
} | } | ||||
if (!outPF.trueColour) { | if (!outPF.trueColour) { | ||||
if (outPF.bpp != 8) | if (outPF.bpp != 8) | ||||
throw Exception("TransImageGetter: outPF has colour map but not 8bpp"); | |||||
throw Exception("TransImageGetter: outPF has color map but not 8bpp"); | |||||
if (!inPF.trueColour) { | if (!inPF.trueColour) { | ||||
if (inPF.bpp != 8) | if (inPF.bpp != 8) | ||||
throw Exception("TransImageGetter: inPF has colourMap but not 8bpp"); | |||||
throw Exception("TransImageGetter: inPF has colorMap but not 8bpp"); | |||||
// CM to CM/Cube | // CM to CM/Cube | ||||
// CM to TC | // CM to TC | ||||
if (inPF.bpp != 8) | if (inPF.bpp != 8) | ||||
throw Exception("TransImageGetter: inPF has colourMap but not 8bpp"); | |||||
throw Exception("TransImageGetter: inPF has colorMap but not 8bpp"); | |||||
transFn = transSimpleFns[inPF.bpp/16][outPF.bpp/16]; | transFn = transSimpleFns[inPF.bpp/16][outPF.bpp/16]; | ||||
(*initSimpleCMtoTCFns[outPF.bpp/16]) (&table, inPF, pb->getColourMap(), | (*initSimpleCMtoTCFns[outPF.bpp/16]) (&table, inPF, pb->getColourMap(), | ||||
outPF); | outPF); |
format = pf; | format = pf; | ||||
recreateBuffer(); | recreateBuffer(); | ||||
if ((pf.bpp <= 8) && pf.trueColour) { | if ((pf.bpp <= 8) && pf.trueColour) { | ||||
vlog.debug("creating %d-bit TrueColour palette", pf.depth); | |||||
vlog.debug("creating %d-bit TrueColor palette", pf.depth); | |||||
for (int i=0; i < (1<<(pf.depth)); i++) { | for (int i=0; i < (1<<(pf.depth)); i++) { | ||||
palette[i].b = ((((i >> pf.blueShift) & pf.blueMax) * 65535) + pf.blueMax/2) / pf.blueMax; | palette[i].b = ((((i >> pf.blueShift) & pf.blueMax) * 65535) + pf.blueMax/2) / pf.blueMax; | ||||
palette[i].g = ((((i >> pf.greenShift) & pf.greenMax) * 65535) + pf.greenMax/2) / pf.greenMax; | palette[i].g = ((((i >> pf.greenShift) & pf.greenMax) * 65535) + pf.greenMax/2) / pf.greenMax; | ||||
void DIBSectionBuffer::refreshPalette() { | void DIBSectionBuffer::refreshPalette() { | ||||
if (format.bpp > 8) { | if (format.bpp > 8) { | ||||
vlog.error("refresh palette called for truecolour DIB"); | |||||
vlog.error("refresh palette called for truecolor DIB"); | |||||
return; | return; | ||||
} | } | ||||
vlog.debug("refreshing palette"); | vlog.debug("refreshing palette"); |
UINT entries = ::GetSystemPaletteEntries(dc, 0, 256, syspalette); | UINT entries = ::GetSystemPaletteEntries(dc, 0, 256, syspalette); | ||||
if (entries == 0) { | if (entries == 0) { | ||||
vlog.info("resorting to standard 16 colour palette"); | |||||
vlog.info("resorting to standard 16 color palette"); | |||||
for (unsigned int i=0;i<256;i++) { | for (unsigned int i=0;i<256;i++) { | ||||
int v = (i%16) >= 8 ? 127 : 255; | int v = (i%16) >= 8 ? 127 : 255; | ||||
syspalette[i].peRed = i & 1 ? v : 0; | syspalette[i].peRed = i & 1 ? v : 0; |
recreatePixelBuffer(); | recreatePixelBuffer(); | ||||
break; | break; | ||||
case WMMonitor::Notifier::DisplayColourMapChanged: | case WMMonitor::Notifier::DisplayColourMapChanged: | ||||
vlog.debug("desktop colourmap changed"); | |||||
vlog.debug("desktop colormap changed"); | |||||
pb->updateColourMap(); | pb->updateColourMap(); | ||||
if (server) | if (server) | ||||
server->setColourMapEntries(); | server->setColourMapEntries(); |
switch (bi.bmiHeader.biBitCount) { | switch (bi.bmiHeader.biBitCount) { | ||||
case 16: | case 16: | ||||
// RGB 555 - High Colour | // RGB 555 - High Colour | ||||
dcLog.info("16-bit High Colour"); | |||||
dcLog.info("16-bit High Color"); | |||||
rMask = 0x7c00; | rMask = 0x7c00; | ||||
bMask = 0x001f; | bMask = 0x001f; | ||||
gMask = 0x03e0; | gMask = 0x03e0; | ||||
case 24: | case 24: | ||||
case 32: | case 32: | ||||
// RGB 888 - True Colour | // RGB 888 - True Colour | ||||
dcLog.info("24/32-bit High Colour"); | |||||
dcLog.info("24/32-bit High Color"); | |||||
rMask = 0xff0000; | rMask = 0xff0000; | ||||
gMask = 0x00ff00; | gMask = 0x00ff00; | ||||
bMask = 0x0000ff; | bMask = 0x0000ff; |
// Check on the true colour mode | // Check on the true colour mode | ||||
if (!(cp.pf()).trueColour) | if (!(cp.pf()).trueColour) | ||||
throw rdr::Exception("This version plays only true colour session!"); | |||||
throw rdr::Exception("This version plays only true color session!"); | |||||
// Set the session pixel format | // Set the session pixel format | ||||
buffer->setPF(cp.pf()); | buffer->setPF(cp.pf()); |
.TP | .TP | ||||
.B \-cc 3 | .B \-cc 3 | ||||
As an alternative to the default TrueColor visual, this allows you to run an | As an alternative to the default TrueColor visual, this allows you to run an | ||||
Xvnc server with a PseudoColor visual (i.e. one which uses a colour map or | |||||
Xvnc server with a PseudoColor visual (i.e. one which uses a color map or | |||||
palette), which can be useful for running some old X applications which only | palette), which can be useful for running some old X applications which only | ||||
work on such a display. Values other than 3 (PseudoColor) and 4 (TrueColor) | work on such a display. Values other than 3 (PseudoColor) and 4 (TrueColor) | ||||
for the \-cc option may result in strange behaviour, and PseudoColor desktops | for the \-cc option may result in strange behaviour, and PseudoColor desktops |
static BoolParameter useLocalCursor("UseLocalCursor", "Render the mouse cursor locally", true); | static BoolParameter useLocalCursor("UseLocalCursor", "Render the mouse cursor locally", true); | ||||
static BoolParameter useDesktopResize("UseDesktopResize", "Support dynamic desktop resizing", true); | static BoolParameter useDesktopResize("UseDesktopResize", "Support dynamic desktop resizing", true); | ||||
static BoolParameter fullColour("FullColour", | |||||
"Use full colour", true); | |||||
static IntParameter lowColourLevel("LowColourLevel", | |||||
"Colour level to use on slow connections. " | |||||
"0 = Very Low (8 colours), 1 = Low (64 colours), 2 = Medium (256 colours)", | |||||
static BoolParameter fullColour("FullColor", | |||||
"Use full color", true); | |||||
static AliasParameter fullColourAlias("FullColour", "Alias for FullColor", &fullColour); | |||||
static IntParameter lowColourLevel("LowColorLevel", | |||||
"Color level to use on slow connections. " | |||||
"0 = Very Low (8 colors), 1 = Low (64 colors), 2 = Medium (256 colors)", | |||||
2); | 2); | ||||
static AliasParameter lowColourLevelAlias("LowColourLevel", "Alias for LowColorLevel", &lowColourLevel); | |||||
static BoolParameter fullScreen("FullScreen", | static BoolParameter fullScreen("FullScreen", | ||||
"Use the whole display to show the remote desktop." | "Use the whole display to show the remote desktop." | ||||
"(Press F8 to access the viewer menu)", | "(Press F8 to access the viewer menu)", |
// Select best color level | // Select best color level | ||||
newFullColour = (kbitsPerSecond > 256); | newFullColour = (kbitsPerSecond > 256); | ||||
if (newFullColour != options.fullColour) { | if (newFullColour != options.fullColour) { | ||||
vlog.info("Throughput %d kbit/s - full colour is now %s", | |||||
vlog.info("Throughput %d kbit/s - full color is now %s", | |||||
kbitsPerSecond, | kbitsPerSecond, | ||||
newFullColour ? "enabled" : "disabled"); | newFullColour ? "enabled" : "disabled"); | ||||
options.fullColour = newFullColour; | options.fullColour = newFullColour; |
IDD_FORMAT DIALOG DISCARDABLE 0, 0, 201, 160 | IDD_FORMAT DIALOG DISCARDABLE 0, 0, 201, 160 | ||||
STYLE DS_MODALFRAME | DS_CONTROL | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_MODALFRAME | DS_CONTROL | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||
CAPTION "Colour/Encoding" | |||||
CAPTION "Color/Encoding" | |||||
FONT 8, "MS Sans Serif" | FONT 8, "MS Sans Serif" | ||||
BEGIN | BEGIN | ||||
CONTROL "&Auto select",IDC_ENCODING_AUTO,"Button", | CONTROL "&Auto select",IDC_ENCODING_AUTO,"Button", | ||||
CONTROL "Raw",IDC_ENCODING_RAW,"Button",BS_AUTORADIOBUTTON,10,75, | CONTROL "Raw",IDC_ENCODING_RAW,"Button",BS_AUTORADIOBUTTON,10,75, | ||||
75,15 | 75,15 | ||||
GROUPBOX "Colour level",IDC_STATIC,95,20,99,75 | |||||
CONTROL "&Full (all available colours)",IDC_FORMAT_FULLCOLOUR, | |||||
GROUPBOX "Color level",IDC_STATIC,95,20,99,75 | |||||
CONTROL "&Full (all available colors)",IDC_FORMAT_FULLCOLOUR, | |||||
"Button",BS_AUTORADIOBUTTON | WS_GROUP,100,30,90,15 | "Button",BS_AUTORADIOBUTTON | WS_GROUP,100,30,90,15 | ||||
CONTROL "&Medium (256 colours)",IDC_FORMAT_MEDIUMCOLOUR,"Button", | |||||
CONTROL "&Medium (256 colors)",IDC_FORMAT_MEDIUMCOLOUR,"Button", | |||||
BS_AUTORADIOBUTTON,100,45,90,14 | BS_AUTORADIOBUTTON,100,45,90,14 | ||||
CONTROL "&Low (64 colours)",IDC_FORMAT_LOWCOLOUR,"Button", | |||||
CONTROL "&Low (64 colors)",IDC_FORMAT_LOWCOLOUR,"Button", | |||||
BS_AUTORADIOBUTTON,100,60,90,16 | BS_AUTORADIOBUTTON,100,60,90,16 | ||||
CONTROL "&Very low (8 colours)",IDC_FORMAT_VERYLOWCOLOUR,"Button", | |||||
CONTROL "&Very low (8 colors)",IDC_FORMAT_VERYLOWCOLOUR,"Button", | |||||
BS_AUTORADIOBUTTON,100,75,90,15 | BS_AUTORADIOBUTTON,100,75,90,15 | ||||
CONTROL "Custom compression level:",IDC_CUSTOM_COMPRESSLEVEL, | CONTROL "Custom compression level:",IDC_CUSTOM_COMPRESSLEVEL, |
// Select best color level | // Select best color level | ||||
newFullColour = (kbitsPerSecond > 256); | newFullColour = (kbitsPerSecond > 256); | ||||
if (newFullColour != fullColour) { | if (newFullColour != fullColour) { | ||||
vlog.info("Throughput %d kbit/s - full colour is now %s", | |||||
vlog.info("Throughput %d kbit/s - full color is now %s", | |||||
kbitsPerSecond, | kbitsPerSecond, | ||||
newFullColour ? "enabled" : "disabled"); | newFullColour ? "enabled" : "disabled"); | ||||
fullColour = newFullColour; | fullColour = newFullColour; |
public: | public: | ||||
OptionsDialog(Display* dpy, OptionsDialogCallback* cb_) | OptionsDialog(Display* dpy, OptionsDialogCallback* cb_) | ||||
: TXDialog(dpy, 400, 450, "VNC Viewer: Connection Options"), cb(cb_), | : TXDialog(dpy, 400, 450, "VNC Viewer: Connection Options"), cb(cb_), | ||||
formatAndEnc(dpy, "Encoding and Colour Level:", this), | |||||
formatAndEnc(dpy, "Encoding and Color Level:", this), | |||||
inputs(dpy, "Inputs:", this), | inputs(dpy, "Inputs:", this), | ||||
misc(dpy, "Misc:", this), | misc(dpy, "Misc:", this), | ||||
autoSelect(dpy, "Auto select", this, false, this), | autoSelect(dpy, "Auto select", this, false, this), | ||||
fullColour(dpy, "Full (all available colours)", this, true, this), | |||||
mediumColour(dpy, "Medium (256 colours)", this, true, this), | |||||
lowColour(dpy, "Low (64 colours)", this, true, this), | |||||
veryLowColour(dpy, "Very low (8 colours)", this, true, this), | |||||
fullColour(dpy, "Full (all available colors)", this, true, this), | |||||
mediumColour(dpy, "Medium (256 colors)", this, true, this), | |||||
lowColour(dpy, "Low (64 colors)", this, true, this), | |||||
veryLowColour(dpy, "Very low (8 colors)", this, true, this), | |||||
tight(dpy, "Tight", this, true, this), | tight(dpy, "Tight", this, true, this), | ||||
zrle(dpy, "ZRLE", this, true, this), | zrle(dpy, "ZRLE", this, true, this), | ||||
hextile(dpy, "Hextile", this, true, this), | hextile(dpy, "Hextile", this, true, this), |
"invisible cursor", true); | "invisible cursor", true); | ||||
BoolParameter autoSelect("AutoSelect", | BoolParameter autoSelect("AutoSelect", | ||||
"Auto select pixel format and encoding", true); | "Auto select pixel format and encoding", true); | ||||
BoolParameter fullColour("FullColour", | |||||
"Use full colour", true); | |||||
AliasParameter fullColor("FullColor", "Alias for FullColour", &fullColour); | |||||
IntParameter lowColourLevel("LowColourLevel", | |||||
"Colour level to use on slow connections. " | |||||
"0 = Very Low (8 colours), 1 = Low (64 colours), " | |||||
"2 = Medium (256 colours)", 2); | |||||
BoolParameter fullColour("FullColor", | |||||
"Use full color", true); | |||||
AliasParameter fullColourAlias("FullColour", "Alias for FullColor", &fullColour); | |||||
IntParameter lowColourLevel("LowColorLevel", | |||||
"Color level to use on slow connections. " | |||||
"0 = Very Low (8 colors), 1 = Low (64 colors), " | |||||
"2 = Medium (256 colors)", 2); | |||||
AliasParameter lowColourLevelAlias("LowColourLevel", "Alias for LowColorLevel", &lowColourLevel); | |||||
StringParameter preferredEncoding("PreferredEncoding", | StringParameter preferredEncoding("PreferredEncoding", | ||||
"Preferred encoding to use (ZRLE, hextile or" | "Preferred encoding to use (ZRLE, hextile or" | ||||
" raw) - implies AutoSelect=0", ""); | " raw) - implies AutoSelect=0", ""); |
.SH AUTOMATIC PROTOCOL SELECTION | .SH AUTOMATIC PROTOCOL SELECTION | ||||
The viewer tests the speed of the connection to the server and chooses the | The viewer tests the speed of the connection to the server and chooses the | ||||
encoding and pixel format (colour level) appropriately. This makes it much | |||||
encoding and pixel format (color level) appropriately. This makes it much | |||||
easier to use than previous versions where the user had to specify arcane | easier to use than previous versions where the user had to specify arcane | ||||
command line arguments. | command line arguments. | ||||
The viewer normally starts out assuming the link is slow, using a low colour | |||||
The viewer normally starts out assuming the link is slow, using a low color | |||||
level and using the encoding with the best compression. If it turns out that | level and using the encoding with the best compression. If it turns out that | ||||
the link is fast enough it switches to full-colour mode and will use an | |||||
the link is fast enough it switches to full-color mode and will use an | |||||
encoding which compresses less but is faster to generate, thus improving the | encoding which compresses less but is faster to generate, thus improving the | ||||
interactive feel. Automatic selection can be turned off by setting the | interactive feel. Automatic selection can be turned off by setting the | ||||
\fBAutoSelect\fP parameter to false, or from the options dialog. | \fBAutoSelect\fP parameter to false, or from the options dialog. | ||||
encoding and pixel format appropriately. Turn it off with \fB-AutoSelect=0\fP. | encoding and pixel format appropriately. Turn it off with \fB-AutoSelect=0\fP. | ||||
.TP | .TP | ||||
.B \-FullColour, \-FullColor | |||||
Tells the VNC server to send full-colour pixels in the best format for this | |||||
display. By default a low colour mode is used until AutoSelect decides the | |||||
.B \-FullColor, \-FullColour | |||||
Tells the VNC server to send full-color pixels in the best format for this | |||||
display. By default a low color mode is used until AutoSelect decides the | |||||
link is fast enough. However if the server's native pixel format is | link is fast enough. However if the server's native pixel format is | ||||
colourmapped (as opposed to truecolour) then the server's format is used by | |||||
colormapped (as opposed to truecolor) then the server's format is used by | |||||
default. | default. | ||||
.TP | .TP | ||||
.B \-LowColourLevel \fIlevel\fP | |||||
Selects the reduced colour level to use on slow links. \fIlevel\fP can range | |||||
from 0 to 2, 0 meaning 8 colours, 1 meaning 64 colours (the default), 2 meaning | |||||
256 colours. | |||||
.B \-LowColorLevel, \-LowColourLevel \fIlevel\fP | |||||
Selects the reduced color level to use on slow links. \fIlevel\fP can range | |||||
from 0 to 2, 0 meaning 8 colors, 1 meaning 64 colors (the default), 2 meaning | |||||
256 colors. | |||||
.TP | .TP | ||||
.B \-PreferredEncoding \fIencoding\fP | .B \-PreferredEncoding \fIencoding\fP |
.TP | .TP | ||||
.B \-cc 3 | .B \-cc 3 | ||||
As an alternative to the default TrueColor visual, this allows you to run an | As an alternative to the default TrueColor visual, this allows you to run an | ||||
Xvnc server with a PseudoColor visual (i.e. one which uses a colour map or | |||||
Xvnc server with a PseudoColor visual (i.e. one which uses a color map or | |||||
palette), which can be useful for running some old X applications which only | palette), which can be useful for running some old X applications which only | ||||
work on such a display. Values other than 3 (PseudoColor) and 4 (TrueColor) | work on such a display. Values other than 3 (PseudoColor) and 4 (TrueColor) | ||||
for the \-cc option may result in strange behaviour, and PseudoColor desktops | for the \-cc option may result in strange behaviour, and PseudoColor desktops |