Check for TrueColor support in x0vncserver
Colour map support was removed in b6b4dc6, but x0vncserver didn't
properly check if the X server required it.
diff --git a/unix/x0vncserver/Image.cxx b/unix/x0vncserver/Image.cxx
index f1a4593..a5bd2b0 100644
--- a/unix/x0vncserver/Image.cxx
+++ b/unix/x0vncserver/Image.cxx
@@ -58,13 +58,13 @@
static rfb::LogWriter vlog("Image");
Image::Image(Display *d)
- : xim(NULL), dpy(d), trueColor(true)
+ : xim(NULL), dpy(d)
{
imageCleanup.images.push_back(this);
}
Image::Image(Display *d, int width, int height)
- : xim(NULL), dpy(d), trueColor(true)
+ : xim(NULL), dpy(d)
{
imageCleanup.images.push_back(this);
Init(width, height);
@@ -73,7 +73,11 @@
void Image::Init(int width, int height)
{
Visual* vis = DefaultVisual(dpy, DefaultScreen(dpy));
- trueColor = (vis->c_class == TrueColor);
+
+ if (vis->c_class != TrueColor) {
+ vlog.error("pseudocolour not supported");
+ exit(1);
+ }
xim = XCreateImage(dpy, vis, DefaultDepth(dpy, DefaultScreen(dpy)),
ZPixmap, 0, 0, width, height, BitmapPad(dpy), 0);
@@ -239,7 +243,10 @@
depth = vinfo->depth;
}
- trueColor = (visual->c_class == TrueColor);
+ if (visual->c_class != TrueColor) {
+ vlog.error("pseudocolour not supported");
+ exit(1);
+ }
shminfo = new XShmSegmentInfo;
diff --git a/unix/x0vncserver/Image.h b/unix/x0vncserver/Image.h
index 23502eb..bf62e7d 100644
--- a/unix/x0vncserver/Image.h
+++ b/unix/x0vncserver/Image.h
@@ -38,8 +38,6 @@
Image(Display *d, int width, int height);
virtual ~Image();
- bool isTrueColor() const { return trueColor; }
-
virtual const char *className() const {
return "Image";
}
@@ -84,8 +82,6 @@
int w, int h);
Display *dpy;
- bool trueColor;
-
};
//
diff --git a/unix/x0vncserver/XPixelBuffer.cxx b/unix/x0vncserver/XPixelBuffer.cxx
index f464182..4769b65 100644
--- a/unix/x0vncserver/XPixelBuffer.cxx
+++ b/unix/x0vncserver/XPixelBuffer.cxx
@@ -41,7 +41,7 @@
format = PixelFormat(m_image->xim->bits_per_pixel,
m_image->xim->depth,
(m_image->xim->byte_order == MSBFirst),
- m_image->isTrueColor(),
+ true,
m_image->xim->red_mask >> (ffs(m_image->xim->red_mask) - 1),
m_image->xim->green_mask >> (ffs(m_image->xim->green_mask) - 1),
m_image->xim->blue_mask >> (ffs(m_image->xim->blue_mask) - 1),