Encapsulate screen layout storage in ConnParams
Avoid direct access to the screen dimensions and layout so that we
can make sure it stays sane. This also makes sure the layout is
properly updated when we only get the screen dimensions from the
server.
diff --git a/common/rfb/CMsgWriter.cxx b/common/rfb/CMsgWriter.cxx
index 44b73da..97c3336 100644
--- a/common/rfb/CMsgWriter.cxx
+++ b/common/rfb/CMsgWriter.cxx
@@ -245,8 +245,8 @@
Point p(pos);
if (p.x < 0) p.x = 0;
if (p.y < 0) p.y = 0;
- if (p.x >= cp->width) p.x = cp->width - 1;
- if (p.y >= cp->height) p.y = cp->height - 1;
+ if (p.x >= cp->width()) p.x = cp->width() - 1;
+ if (p.y >= cp->height()) p.y = cp->height() - 1;
startMsg(msgTypePointerEvent);
os->writeU8(buttonMask);