]> source.dussan.org Git - tigervnc.git/commitdiff
Check for TrueColor support in x0vncserver
authorPierre Ossman <ossman@cendio.se>
Tue, 27 Feb 2018 14:55:44 +0000 (15:55 +0100)
committerPierre Ossman <ossman@cendio.se>
Tue, 27 Feb 2018 14:55:44 +0000 (15:55 +0100)
Colour map support was removed in b6b4dc6, but x0vncserver didn't
properly check if the X server required it.

unix/x0vncserver/Image.cxx
unix/x0vncserver/Image.h
unix/x0vncserver/XPixelBuffer.cxx

index f1a45933bd18294e8774eaf63b3579a01066808d..a5bd2b0ded97da6971236475c719ff9fca130a27 100644 (file)
@@ -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;
 
index 23502eb95c3ade2d6d13347831a9cbb67a1f8658..bf62e7d0b775307d32bb43c5931b299bec2dc126 100644 (file)
@@ -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;
-
 };
 
 //
index f4641825e7fb96e1dab7f47fdd7e7efd14790123..4769b651c786b7390283df2095c499a789559985 100644 (file)
@@ -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),