]> source.dussan.org Git - tigervnc.git/commitdiff
Provide correct dimensions for XShm setup
authorPierre Ossman <ossman@cendio.se>
Mon, 30 Dec 2019 09:50:52 +0000 (10:50 +0100)
committerPierre Ossman <ossman@cendio.se>
Mon, 30 Dec 2019 09:52:23 +0000 (10:52 +0100)
Since 53f913a we initialize the underlying PixelBuffer with 0x0
dimensions, which means we need to keep more explicit track of what
we are trying to allocate in the setup methods.

vncviewer/PlatformPixelBuffer.cxx
vncviewer/PlatformPixelBuffer.h

index 61f7b743b8156d90e4c97fb71ba486421e96450a..59e51d596425ecf7dc0893d1ea4577a4a6b869e9 100644 (file)
@@ -43,7 +43,7 @@ PlatformPixelBuffer::PlatformPixelBuffer(int width, int height) :
 #endif
 {
 #if !defined(WIN32) && !defined(__APPLE__)
-  if (!setupShm()) {
+  if (!setupShm(width, height)) {
     xim = XCreateImage(fl_display, CopyFromParent, 32,
                        ZPixmap, 0, 0, width, height, 32, 0);
     if (!xim)
@@ -136,7 +136,7 @@ static int XShmAttachErrorHandler(Display *dpy, XErrorEvent *error)
   return 0;
 }
 
-bool PlatformPixelBuffer::setupShm()
+bool PlatformPixelBuffer::setupShm(int width, int height)
 {
   int major, minor;
   Bool pixmaps;
@@ -153,7 +153,7 @@ bool PlatformPixelBuffer::setupShm()
   shminfo = new XShmSegmentInfo;
 
   xim = XShmCreateImage(fl_display, CopyFromParent, 32,
-                        ZPixmap, 0, shminfo, width(), height());
+                        ZPixmap, 0, shminfo, width, height);
   if (!xim)
     goto free_shminfo;
 
index f9038cd9c74c84900c0b82a5d0684eaf58ff218f..ec439f64fc3f1eed7485abd056d7a2e2bf7e13d5 100644 (file)
@@ -53,7 +53,7 @@ protected:
 
 #if !defined(WIN32) && !defined(__APPLE__)
 protected:
-  bool setupShm();
+  bool setupShm(int width, int height);
 
 protected:
   XShmSegmentInfo *shminfo;