Commit 0c0111d6 authored by dscho's avatar dscho

x11vnc now works with colour maps

parent 2c820a71
...@@ -170,17 +170,20 @@ int main(int argc,char** argv) ...@@ -170,17 +170,20 @@ int main(int argc,char** argv)
screen->rfbServerFormat.trueColour = TRUE; screen->rfbServerFormat.trueColour = TRUE;
if ( screen->rfbServerFormat.bitsPerPixel == 8 ) { if ( screen->rfbServerFormat.bitsPerPixel == 8 ) {
if(CellsOfScreen(ScreenOfDisplay(dpy,xscreen))!=0) { if(CellsOfScreen(ScreenOfDisplay(dpy,xscreen))) {
XColor color[256]; XColor color[256];
int i; int i;
screen->colourMap.count = 256;
screen->rfbServerFormat.trueColour = FALSE; screen->rfbServerFormat.trueColour = FALSE;
screen->colourMap.is16 = TRUE; 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); screen->colourMap.data.shorts = (short*)malloc(3*sizeof(short)*screen->colourMap.count);
for(i=0;i<screen->colourMap.count;i++) { for(i=0;i<screen->colourMap.count;i++) {
screen->colourMap.data.shorts[i*6+0] = color[i].red; screen->colourMap.data.shorts[i*3+0] = color[i].red;
screen->colourMap.data.shorts[i*6+2] = color[i].green; screen->colourMap.data.shorts[i*3+1] = color[i].green;
screen->colourMap.data.shorts[i*6+4] = color[i].blue; screen->colourMap.data.shorts[i*3+2] = color[i].blue;
} }
} else { } else {
screen->rfbServerFormat.redShift = 0; screen->rfbServerFormat.redShift = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment