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
diff --git a/unix/vncviewer/CConn.cxx b/unix/vncviewer/CConn.cxx
index 4a1aeb0..79195a8 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 @@
currentEncoding = encNum;
}
cp.supportsDesktopResize = true;
+ cp.supportsExtendedDesktopSize = true;
cp.supportsDesktopRename = true;
cp.supportsLocalCursor = useLocalCursor;
cp.customCompressLevel = customCompressLevel;
@@ -266,10 +269,17 @@
// 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 @@
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 d969a68..27ab8e3 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 @@
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 @@
private:
+ void resizeFramebuffer();
void recreateViewport();
void reconfigureViewport();
void initMenu();