/* 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
*/
#include <rfb/Exception.h>
#include <rfb/CMsgHandler.h>
+#include <rfb/screenTypes.h>
using namespace rfb;
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)
{
}
/* 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
// 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);
/* 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
case pseudoEncodingDesktopSize:
handler->setDesktopSize(w, h);
break;
+ case pseudoEncodingExtendedDesktopSize:
+ readExtendedDesktopSize(x, y, w, h);
+ break;
case pseudoEncodingDesktopName:
readSetDesktopName(x, y, w, h);
break;
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);
+}
+
/* 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
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;
};
}
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)) {
/* 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
#include <rfb/LogWriter.h>
#include <rfb/util.h>
#include <rfb/Password.h>
+#include <rfb/screenTypes.h>
#include <network/TcpSocket.h>
#include "TXViewport.h"
currentEncoding = encNum;
}
cp.supportsDesktopResize = true;
+ cp.supportsExtendedDesktopSize = true;
cp.supportsDesktopRename = true;
cp.supportsLocalCursor = useLocalCursor;
cp.customCompressLevel = customCompressLevel;
// 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
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;
/* 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
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();
private:
+ void resizeFramebuffer();
void recreateViewport();
void reconfigureViewport();
void initMenu();