From 34bb06193e20940e269bff1740939d6ed286856c Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Sat, 21 Mar 2009 21:16:14 +0000 Subject: [PATCH] Properly parse the SetDesktopSize message. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3708 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- common/rfb/SMsgHandler.cxx | 6 +++++- common/rfb/SMsgHandler.h | 5 ++++- common/rfb/SMsgReaderV3.cxx | 18 +++++++++++++++--- common/rfb/VNCSConnectionST.cxx | 3 ++- common/rfb/VNCSConnectionST.h | 3 ++- 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/common/rfb/SMsgHandler.cxx b/common/rfb/SMsgHandler.cxx index 0c74f0f5..8124c50d 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 #include +#include using namespace rfb; @@ -47,9 +49,11 @@ void SMsgHandler::supportsLocalCursor() { } -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 78cff2f7..f212edfd 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 #include #include +#include namespace rdr { class InStream; } @@ -46,7 +48,8 @@ namespace rfb { 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 1408fe66..168e6aab 100644 --- a/common/rfb/SMsgReaderV3.cxx +++ b/common/rfb/SMsgReaderV3.cxx @@ -24,6 +24,7 @@ #include #include #include +#include using namespace rfb; @@ -64,6 +65,9 @@ void SMsgReaderV3::readSetDesktopSize() { int width, height; int screens, i; + rdr::U32 id, flags; + int sx, sy, sw, sh; + ScreenSet layout; is->skip(1); @@ -73,9 +77,17 @@ void SMsgReaderV3::readSetDesktopSize() 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 10050e38..29c62746 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -509,7 +509,8 @@ void VNCSConnectionST::framebufferUpdateRequest(const Rect& r,bool incremental) } } -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 d5c7a36b..c1750b92 100644 --- a/common/rfb/VNCSConnectionST.h +++ b/common/rfb/VNCSConnectionST.h @@ -125,7 +125,8 @@ namespace rfb { 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(); -- 2.39.5