diff options
author | Pierre Ossman <ossman@cendio.se> | 2009-03-20 13:02:50 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2009-03-20 13:02:50 +0000 |
commit | 49f8822a8fd1a1d4a21451bc5d3566e4eb15942e (patch) | |
tree | 0e78a3768fba9c9c59695cdabe128517b019157c | |
parent | c5e25601d923169c30b656246ac503451f04e638 (diff) | |
download | tigervnc-49f8822a8fd1a1d4a21451bc5d3566e4eb15942e.tar.gz tigervnc-49f8822a8fd1a1d4a21451bc5d3566e4eb15942e.zip |
Minimal client side support for the extended desktop size protocol.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3699 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r-- | common/rfb/CMsgHandler.cxx | 11 | ||||
-rw-r--r-- | common/rfb/CMsgHandler.h | 8 | ||||
-rw-r--r-- | common/rfb/CMsgReaderV3.cxx | 17 | ||||
-rw-r--r-- | common/rfb/CMsgReaderV3.h | 2 | ||||
-rw-r--r-- | common/rfb/CMsgWriter.cxx | 2 | ||||
-rw-r--r-- | unix/vncviewer/CConn.cxx | 29 | ||||
-rw-r--r-- | unix/vncviewer/CConn.h | 3 |
7 files changed, 65 insertions, 7 deletions
diff --git a/common/rfb/CMsgHandler.cxx b/common/rfb/CMsgHandler.cxx index 4b338524..fa675dcc 100644 --- a/common/rfb/CMsgHandler.cxx +++ b/common/rfb/CMsgHandler.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/CMsgHandler.h> +#include <rfb/screenTypes.h> using namespace rfb; @@ -34,6 +36,15 @@ void CMsgHandler::setDesktopSize(int width, int height) cp.height = height; } +void CMsgHandler::setExtendedDesktopSize(int reason, int result, int width, int height) +{ + if ((reason == reasonClient) && (result != resultSuccess)) + return; + + cp.width = width; + cp.height = height; +} + void CMsgHandler::setCursor(int w, int h, const Point& hotspot, void* data, void* mask) { } diff --git a/common/rfb/CMsgHandler.h b/common/rfb/CMsgHandler.h index 188963a4..49d407ad 100644 --- a/common/rfb/CMsgHandler.h +++ b/common/rfb/CMsgHandler.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 @@ -38,11 +39,12 @@ namespace rfb { // The following methods are called as corresponding messages are read. A // derived class should override these methods as desired. Note that for - // the setDesktopSize(), setPixelFormat() and setName() methods, a derived - // class should call on to CMsgHandler's methods to set the members of cp - // appropriately. + // the setDesktopSize(), setExtendedDesktopSize(), setPixelFormat() and + // setName() methods, a derived class should call on to CMsgHandler's + // methods to set the members of cp appropriately. virtual void setDesktopSize(int w, int h); + virtual void setExtendedDesktopSize(int reason, int result, int w, int h); virtual void setCursor(int width, int height, const Point& hotspot, void* data, void* mask); virtual void setPixelFormat(const PixelFormat& pf); diff --git a/common/rfb/CMsgReaderV3.cxx b/common/rfb/CMsgReaderV3.cxx index 83f758e7..05fd9488 100644 --- a/common/rfb/CMsgReaderV3.cxx +++ b/common/rfb/CMsgReaderV3.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 @@ -76,6 +77,9 @@ void CMsgReaderV3::readMsg() case pseudoEncodingDesktopSize: handler->setDesktopSize(w, h); break; + case pseudoEncodingExtendedDesktopSize: + readExtendedDesktopSize(x, y, w, h); + break; case pseudoEncodingDesktopName: readSetDesktopName(x, y, w, h); break; @@ -115,3 +119,16 @@ void CMsgReaderV3::readSetDesktopName(int x, int y, int w, int h) delete [] name; } +void CMsgReaderV3::readExtendedDesktopSize(int x, int y, int w, int h) +{ + unsigned int screens; + + screens = is->readU8(); + is->skip(3); + + // XXX: We just ignore screen info right now + is->skip(16 * screens); + + handler->setExtendedDesktopSize(x, y, w, h); +} + diff --git a/common/rfb/CMsgReaderV3.h b/common/rfb/CMsgReaderV3.h index a3b604e6..8aecdea5 100644 --- a/common/rfb/CMsgReaderV3.h +++ b/common/rfb/CMsgReaderV3.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 @@ -30,6 +31,7 @@ namespace rfb { private: virtual void readFramebufferUpdate(); virtual void readSetDesktopName(int x, int y, int w, int h); + virtual void readExtendedDesktopSize(int x, int y, int w, int h); int nUpdateRectsLeft; }; } diff --git a/common/rfb/CMsgWriter.cxx b/common/rfb/CMsgWriter.cxx index 82f7189d..3f968dea 100644 --- a/common/rfb/CMsgWriter.cxx +++ b/common/rfb/CMsgWriter.cxx @@ -64,6 +64,8 @@ void CMsgWriter::writeSetEncodings(int preferredEncoding, bool useCopyRect) encodings[nEncodings++] = pseudoEncodingCursor; if (cp->supportsDesktopResize) encodings[nEncodings++] = pseudoEncodingDesktopSize; + if (cp->supportsExtendedDesktopSize) + encodings[nEncodings++] = pseudoEncodingExtendedDesktopSize; if (cp->supportsDesktopRename) encodings[nEncodings++] = pseudoEncodingDesktopName; if (Decoder::supported(preferredEncoding)) { diff --git a/unix/vncviewer/CConn.cxx b/unix/vncviewer/CConn.cxx index 4a1aeb0e..79195a8b 100644 --- a/unix/vncviewer/CConn.cxx +++ b/unix/vncviewer/CConn.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 @@ -30,6 +31,7 @@ #include <rfb/LogWriter.h> #include <rfb/util.h> #include <rfb/Password.h> +#include <rfb/screenTypes.h> #include <network/TcpSocket.h> #include "TXViewport.h" @@ -74,6 +76,7 @@ CConn::CConn(Display* dpy_, int argc_, char** argv_, network::Socket* sock_, currentEncoding = encNum; } cp.supportsDesktopResize = true; + cp.supportsExtendedDesktopSize = true; cp.supportsDesktopRename = true; cp.supportsLocalCursor = useLocalCursor; cp.customCompressLevel = customCompressLevel; @@ -266,10 +269,17 @@ void CConn::serverInit() { // it is set initially). void CConn::setDesktopSize(int w, int h) { CConnection::setDesktopSize(w,h); - if (desktop) { - desktop->resize(w, h); - recreateViewport(); - } + resizeFramebuffer(); +} + +// setExtendedDesktopSize() is a more advanced version of setDesktopSize() +void CConn::setExtendedDesktopSize(int reason, int result, int w, int h) { + CConnection::setExtendedDesktopSize(reason, result, w,h); + + if ((reason == reasonClient) && (result != resultSuccess)) + return; + + resizeFramebuffer(); } // setName() is called when the desktop name changes @@ -617,6 +627,17 @@ void CConn::getOptions() { checkEncodings(); } +void CConn::resizeFramebuffer() +{ + if (!desktop) + return; + if ((desktop->width() == cp.width) && (desktop->height() == cp.height)) + return; + + desktop->resize(cp.width, cp.height); + recreateViewport(); +} + void CConn::recreateViewport() { TXViewport* oldViewport = viewport; diff --git a/unix/vncviewer/CConn.h b/unix/vncviewer/CConn.h index d969a68c..27ab8e31 100644 --- a/unix/vncviewer/CConn.h +++ b/unix/vncviewer/CConn.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 @@ -74,6 +75,7 @@ public: rfb::CSecurity* getCSecurity(int secType); void serverInit(); void setDesktopSize(int w, int h); + void setExtendedDesktopSize(int reason, int result, int w, int h); void setName(const char* name); void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs); void bell(); @@ -89,6 +91,7 @@ public: private: + void resizeFramebuffer(); void recreateViewport(); void reconfigureViewport(); void initMenu(); |