aboutsummaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2018-02-27 15:55:44 +0100
committerPierre Ossman <ossman@cendio.se>2018-02-27 15:55:44 +0100
commit7450a6fe11d873aa74221e81c8457b8bddff8149 (patch)
treeca686f7236cd7a90006ed7d1b432961a3cac374b /unix
parentb7b733a1415911cad9874fca85d6276bae9caa01 (diff)
downloadtigervnc-7450a6fe11d873aa74221e81c8457b8bddff8149.tar.gz
tigervnc-7450a6fe11d873aa74221e81c8457b8bddff8149.zip
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.
Diffstat (limited to 'unix')
-rw-r--r--unix/x0vncserver/Image.cxx15
-rw-r--r--unix/x0vncserver/Image.h4
-rw-r--r--unix/x0vncserver/XPixelBuffer.cxx2
3 files changed, 12 insertions, 9 deletions
diff --git a/unix/x0vncserver/Image.cxx b/unix/x0vncserver/Image.cxx
index f1a45933..a5bd2b0d 100644
--- a/unix/x0vncserver/Image.cxx
+++ b/unix/x0vncserver/Image.cxx
@@ -58,13 +58,13 @@ ImageCleanup imageCleanup;
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 @@ Image::Image(Display *d, int width, int height)
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 @@ void ShmImage::Init(int width, int height, const XVisualInfo *vinfo)
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 23502eb9..bf62e7d0 100644
--- a/unix/x0vncserver/Image.h
+++ b/unix/x0vncserver/Image.h
@@ -38,8 +38,6 @@ public:
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 @@ protected:
int w, int h);
Display *dpy;
- bool trueColor;
-
};
//
diff --git a/unix/x0vncserver/XPixelBuffer.cxx b/unix/x0vncserver/XPixelBuffer.cxx
index f4641825..4769b651 100644
--- a/unix/x0vncserver/XPixelBuffer.cxx
+++ b/unix/x0vncserver/XPixelBuffer.cxx
@@ -41,7 +41,7 @@ XPixelBuffer::XPixelBuffer(Display *dpy, ImageFactory &factory,
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),