Blame SOURCES/tigervnc-provide-correct-dimensions-for-xshm-setup.patch

3ab0c7
From 0f1ded057dbf875e69a0d72418d95610db8fa6a3 Mon Sep 17 00:00:00 2001
3ab0c7
From: Pierre Ossman <ossman@cendio.se>
3ab0c7
Date: Mon, 30 Dec 2019 10:50:52 +0100
3ab0c7
Subject: [PATCH] Provide correct dimensions for XShm setup
3ab0c7
3ab0c7
Since 53f913a we initialize the underlying PixelBuffer with 0x0
3ab0c7
dimensions, which means we need to keep more explicit track of what
3ab0c7
we are trying to allocate in the setup methods.
3ab0c7
---
3ab0c7
 vncviewer/PlatformPixelBuffer.cxx | 6 +++---
3ab0c7
 vncviewer/PlatformPixelBuffer.h   | 2 +-
3ab0c7
 2 files changed, 4 insertions(+), 4 deletions(-)
3ab0c7
3ab0c7
diff --git a/vncviewer/PlatformPixelBuffer.cxx b/vncviewer/PlatformPixelBuffer.cxx
3ab0c7
index 61f7b743b..59e51d596 100644
3ab0c7
--- a/vncviewer/PlatformPixelBuffer.cxx
3ab0c7
+++ b/vncviewer/PlatformPixelBuffer.cxx
3ab0c7
@@ -43,7 +43,7 @@ PlatformPixelBuffer::PlatformPixelBuffer(int width, int height) :
3ab0c7
 #endif
3ab0c7
 {
3ab0c7
 #if !defined(WIN32) && !defined(__APPLE__)
3ab0c7
-  if (!setupShm()) {
3ab0c7
+  if (!setupShm(width, height)) {
3ab0c7
     xim = XCreateImage(fl_display, CopyFromParent, 32,
3ab0c7
                        ZPixmap, 0, 0, width, height, 32, 0);
3ab0c7
     if (!xim)
3ab0c7
@@ -136,7 +136,7 @@ static int XShmAttachErrorHandler(Display *dpy, XErrorEvent *error)
3ab0c7
   return 0;
3ab0c7
 }
3ab0c7
 
3ab0c7
-bool PlatformPixelBuffer::setupShm()
3ab0c7
+bool PlatformPixelBuffer::setupShm(int width, int height)
3ab0c7
 {
3ab0c7
   int major, minor;
3ab0c7
   Bool pixmaps;
3ab0c7
@@ -153,7 +153,7 @@ bool PlatformPixelBuffer::setupShm()
3ab0c7
   shminfo = new XShmSegmentInfo;
3ab0c7
 
3ab0c7
   xim = XShmCreateImage(fl_display, CopyFromParent, 32,
3ab0c7
-                        ZPixmap, 0, shminfo, width(), height());
3ab0c7
+                        ZPixmap, 0, shminfo, width, height);
3ab0c7
   if (!xim)
3ab0c7
     goto free_shminfo;
3ab0c7
 
3ab0c7
diff --git a/vncviewer/PlatformPixelBuffer.h b/vncviewer/PlatformPixelBuffer.h
3ab0c7
index f9038cd9c..ec439f64f 100644
3ab0c7
--- a/vncviewer/PlatformPixelBuffer.h
3ab0c7
+++ b/vncviewer/PlatformPixelBuffer.h
3ab0c7
@@ -53,7 +53,7 @@ class PlatformPixelBuffer: public rfb::FullFramePixelBuffer, public Surface {
3ab0c7
 
3ab0c7
 #if !defined(WIN32) && !defined(__APPLE__)
3ab0c7
 protected:
3ab0c7
-  bool setupShm();
3ab0c7
+  bool setupShm(int width, int height);
3ab0c7
 
3ab0c7
 protected:
3ab0c7
   XShmSegmentInfo *shminfo;