summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordscho <dscho>2001-11-19 17:51:46 +0000
committerdscho <dscho>2001-11-19 17:51:46 +0000
commit0c0111d6a4dcb37601fa1900ec7b9a0c59487f93 (patch)
treebd2c8552418f6d57afd08fa37fe0b6316ff0bc60
parent2c820a714bf99cc7cf6b02dd73608d1bf21971e4 (diff)
downloadlibtdevnc-0c0111d6a4dcb37601fa1900ec7b9a0c59487f93.tar.gz
libtdevnc-0c0111d6a4dcb37601fa1900ec7b9a0c59487f93.zip
x11vnc now works with colour maps
-rw-r--r--x11vnc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/x11vnc.c b/x11vnc.c
index 3ff868f..894402c 100644
--- a/x11vnc.c
+++ b/x11vnc.c
@@ -170,17 +170,20 @@ int main(int argc,char** argv)
screen->rfbServerFormat.trueColour = TRUE;
if ( screen->rfbServerFormat.bitsPerPixel == 8 ) {
- if(CellsOfScreen(ScreenOfDisplay(dpy,xscreen))!=0) {
+ if(CellsOfScreen(ScreenOfDisplay(dpy,xscreen))) {
XColor color[256];
int i;
+ screen->colourMap.count = 256;
screen->rfbServerFormat.trueColour = FALSE;
screen->colourMap.is16 = TRUE;
- screen->colourMap.count = XQueryColors(dpy,DefaultColormap(dpy,xscreen),color,16);
+ for(i=0;i<256;i++)
+ color[i].pixel=i;
+ XQueryColors(dpy,DefaultColormap(dpy,xscreen),color,256);
screen->colourMap.data.shorts = (short*)malloc(3*sizeof(short)*screen->colourMap.count);
for(i=0;i<screen->colourMap.count;i++) {
- screen->colourMap.data.shorts[i*6+0] = color[i].red;
- screen->colourMap.data.shorts[i*6+2] = color[i].green;
- screen->colourMap.data.shorts[i*6+4] = color[i].blue;
+ screen->colourMap.data.shorts[i*3+0] = color[i].red;
+ screen->colourMap.data.shorts[i*3+1] = color[i].green;
+ screen->colourMap.data.shorts[i*3+2] = color[i].blue;
}
} else {
screen->rfbServerFormat.redShift = 0;