diff --git a/vncviewer/PlatformPixelBuffer.cxx b/vncviewer/PlatformPixelBuffer.cxx
index 2b934c5..3d47163 100644
--- a/vncviewer/PlatformPixelBuffer.cxx
+++ b/vncviewer/PlatformPixelBuffer.cxx
@@ -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)
@@ -139,7 +139,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;
@@ -156,7 +156,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;
diff --git a/vncviewer/PlatformPixelBuffer.h b/vncviewer/PlatformPixelBuffer.h
index f9038cd..ec439f6 100644
--- a/vncviewer/PlatformPixelBuffer.h
+++ b/vncviewer/PlatformPixelBuffer.h
@@ -53,7 +53,7 @@ protected:
#if !defined(WIN32) && !defined(__APPLE__)
protected:
- bool setupShm();
+ bool setupShm(int width, int height);
protected:
XShmSegmentInfo *shminfo;