Properly parse the SetDesktopSize message.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3708 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/rfb/SMsgHandler.cxx b/common/rfb/SMsgHandler.cxx
index 0c74f0f..8124c50 100644
--- a/common/rfb/SMsgHandler.cxx
+++ b/common/rfb/SMsgHandler.cxx
@@ -1,4 +1,5 @@
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
+ * Copyright 2009 Pierre Ossman for Cendio AB
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,6 +18,7 @@
*/
#include <rfb/Exception.h>
#include <rfb/SMsgHandler.h>
+#include <rfb/ScreenSet.h>
using namespace rfb;
@@ -47,9 +49,11 @@
{
}
-void SMsgHandler::setDesktopSize(int fb_width, int fb_height)
+void SMsgHandler::setDesktopSize(int fb_width, int fb_height,
+ const ScreenSet& layout)
{
cp.width = fb_width;
cp.height = fb_height;
+ cp.screenLayout = layout;
}
diff --git a/common/rfb/SMsgHandler.h b/common/rfb/SMsgHandler.h
index 78cff2f..f212edf 100644
--- a/common/rfb/SMsgHandler.h
+++ b/common/rfb/SMsgHandler.h
@@ -1,4 +1,5 @@
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
+ * Copyright 2009 Pierre Ossman for Cendio AB
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,6 +27,7 @@
#include <rfb/PixelFormat.h>
#include <rfb/ConnParams.h>
#include <rfb/InputHandler.h>
+#include <rfb/ScreenSet.h>
namespace rdr { class InStream; }
@@ -46,7 +48,8 @@
virtual void setPixelFormat(const PixelFormat& pf);
virtual void setEncodings(int nEncodings, rdr::U32* encodings);
virtual void framebufferUpdateRequest(const Rect& r, bool incremental) = 0;
- virtual void setDesktopSize(int fb_width, int fb_height) = 0;
+ virtual void setDesktopSize(int fb_width, int fb_height,
+ const ScreenSet& layout) = 0;
// InputHandler interface
// The InputHandler methods will be called for the corresponding messages.
diff --git a/common/rfb/SMsgReaderV3.cxx b/common/rfb/SMsgReaderV3.cxx
index 1408fe6..168e6aa 100644
--- a/common/rfb/SMsgReaderV3.cxx
+++ b/common/rfb/SMsgReaderV3.cxx
@@ -24,6 +24,7 @@
#include <rdr/InStream.h>
#include <rfb/SMsgReaderV3.h>
#include <rfb/SMsgHandler.h>
+#include <rfb/ScreenSet.h>
using namespace rfb;
@@ -64,6 +65,9 @@
{
int width, height;
int screens, i;
+ rdr::U32 id, flags;
+ int sx, sy, sw, sh;
+ ScreenSet layout;
is->skip(1);
@@ -73,9 +77,17 @@
screens = is->readU8();
is->skip(1);
- // XXX: We don't support this command properly yet
- is->skip(screens * 16);
+ for (i = 0;i < screens;i++) {
+ id = is->readU32();
+ sx = is->readU16();
+ sy = is->readU16();
+ sw = is->readU16();
+ sh = is->readU16();
+ flags = is->readU32();
- handler->setDesktopSize(width, height);
+ layout.add_screen(Screen(id, sx, sy, sw, sh, flags));
+ }
+
+ handler->setDesktopSize(width, height, layout);
}
diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx
index 10050e3..29c6274 100644
--- a/common/rfb/VNCSConnectionST.cxx
+++ b/common/rfb/VNCSConnectionST.cxx
@@ -509,7 +509,8 @@
}
}
-void VNCSConnectionST::setDesktopSize(int fb_width, int fb_height)
+void VNCSConnectionST::setDesktopSize(int fb_width, int fb_height,
+ const ScreenSet& layout)
{
vlog.info("Rejecting client request to change desktop size");
writer()->writeExtendedDesktopSize(resultProhibited);
diff --git a/common/rfb/VNCSConnectionST.h b/common/rfb/VNCSConnectionST.h
index d5c7a36..c1750b9 100644
--- a/common/rfb/VNCSConnectionST.h
+++ b/common/rfb/VNCSConnectionST.h
@@ -125,7 +125,8 @@
virtual void keyEvent(rdr::U32 key, bool down);
virtual void clientCutText(const char* str, int len);
virtual void framebufferUpdateRequest(const Rect& r, bool incremental);
- virtual void setDesktopSize(int fb_width, int fb_height);
+ virtual void setDesktopSize(int fb_width, int fb_height,
+ const ScreenSet& layout);
virtual void setInitialColourMap();
virtual void supportsLocalCursor();