From f76c81941a001bde59a9c4df5445569d2134ab5b Mon Sep 17 00:00:00 2001
From: Wouter Van Meir <wouter.vanmeir@pandora.be>
Date: Mon, 31 May 2010 17:33:27 +0200
Subject: Call MallocFrameBuffer before SetFormatAndEncodings

The hook is still called after InitialiseRFBConnection() so we can choose
the color settings depending on the vnc server (or settings) in that hook.

This way one can use the "VNC server default format" pixelformat if the
client supports it, or perform a workaround (Intel AMT KVM "classic vnc"
server only works using 8bit colors in RFB3.8)

Signed-off-by: Wouter Van Meir <wouter.vanmeir@pandora.be>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 libvncclient/vncviewer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c
index 094ba34..6541c1d 100644
--- a/libvncclient/vncviewer.c
+++ b/libvncclient/vncviewer.c
@@ -221,13 +221,13 @@ static rfbBool rfbInitConnection(rfbClient* client)
   if (!InitialiseRFBConnection(client))
     return FALSE;
 
-  if (!SetFormatAndEncodings(client))
-    return FALSE;
-
   client->width=client->si.framebufferWidth;
   client->height=client->si.framebufferHeight;
   client->MallocFrameBuffer(client);
 
+  if (!SetFormatAndEncodings(client))
+    return FALSE;
+
   if (client->updateRect.x < 0) {
     client->updateRect.x = client->updateRect.y = 0;
     client->updateRect.w = client->width;
-- 
cgit v1.2.3

