Let CMsgHandler::serverInit() handle initial set up
Avoid using the callbacks used for runtime changes for the initial
setup. They weren't really useful anyway as you could not allocate
a framebuffer without also knowing the pixel format. So make things
more clear by letting serverInit() get the initial settings.
diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx
index 805c8c3..14ef221 100644
--- a/common/rfb/CConnection.cxx
+++ b/common/rfb/CConnection.cxx
@@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
+#include <assert.h>
#include <stdio.h>
#include <string.h>
@@ -335,12 +336,19 @@
CMsgHandler::setExtendedDesktopSize(reason, result, w, h, layout);
}
-void CConnection::serverInit()
+void CConnection::serverInit(int width, int height,
+ const PixelFormat& pf,
+ const char* name)
{
+ CMsgHandler::serverInit(width, height, pf, name);
+
state_ = RFBSTATE_NORMAL;
vlog.debug("initialisation done");
initDone();
+ assert(framebuffer != NULL);
+ assert(framebuffer->width() == server.width());
+ assert(framebuffer->height() == server.height());
}
void CConnection::readAndDecodeRect(const Rect& r, int encoding,