Split out ServerParams from ConnParams
We need to track different things in the server and client, so
separate things to two independent structures to keep things more
clear.
diff --git a/common/rfb/CMsgReader.cxx b/common/rfb/CMsgReader.cxx
index 7502df6..3ce7473 100644
--- a/common/rfb/CMsgReader.cxx
+++ b/common/rfb/CMsgReader.cxx
@@ -192,10 +192,11 @@
void CMsgReader::readRect(const Rect& r, int encoding)
{
- if ((r.br.x > handler->cp.width()) || (r.br.y > handler->cp.height())) {
+ if ((r.br.x > handler->server.width()) ||
+ (r.br.y > handler->server.height())) {
fprintf(stderr, "Rect too big: %dx%d at %d,%d exceeds %dx%d\n",
r.width(), r.height(), r.tl.x, r.tl.y,
- handler->cp.width(), handler->cp.height());
+ handler->server.width(), handler->server.height());
throw Exception("Rect too big");
}
@@ -269,7 +270,7 @@
if (width > maxCursorSize || height > maxCursorSize)
throw Exception("Too big cursor");
- int data_len = width * height * (handler->cp.pf().bpp/8);
+ int data_len = width * height * (handler->server.pf().bpp/8);
int mask_len = ((width+7)/8) * height;
rdr::U8Array data(data_len);
rdr::U8Array mask(mask_len);
@@ -290,14 +291,14 @@
int byte = y * maskBytesPerRow + x / 8;
int bit = 7 - x % 8;
- handler->cp.pf().rgbFromBuffer(out, in, 1);
+ handler->server.pf().rgbFromBuffer(out, in, 1);
if (mask.buf[byte] & (1 << bit))
out[3] = 255;
else
out[3] = 0;
- in += handler->cp.pf().bpp/8;
+ in += handler->server.pf().bpp/8;
out += 4;
}
}
@@ -321,10 +322,10 @@
encoding = is->readS32();
- origPF = handler->cp.pf();
- handler->cp.setPF(rgbaPF);
+ origPF = handler->server.pf();
+ handler->server.setPF(rgbaPF);
handler->readAndDecodeRect(pb.getRect(), encoding, &pb);
- handler->cp.setPF(origPF);
+ handler->server.setPF(origPF);
// On-wire data has pre-multiplied alpha, but we store it
// non-pre-multiplied