aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2024-11-15 19:16:08 +0100
committerPierre Ossman <ossman@cendio.se>2025-02-13 11:10:14 +0100
commit3861097921de71b8a742c1f70bc991b3518f5dd7 (patch)
treed6aa45c647e408e15fed860e3b1ffb216a7dcfb8
parentd96242158d4c3b3247e55fbe4c968994c0fd9773 (diff)
downloadtigervnc-3861097921de71b8a742c1f70bc991b3518f5dd7.tar.gz
tigervnc-3861097921de71b8a742c1f70bc991b3518f5dd7.zip
Reduce header #include:s
Make compile times faster by reducing the number of headers included in other headers.
-rw-r--r--common/network/Socket.cxx13
-rw-r--r--common/network/Socket.h11
-rw-r--r--common/network/TcpSocket.cxx1
-rw-r--r--common/network/UnixSocket.cxx1
-rw-r--r--common/rfb/Blacklist.h4
-rw-r--r--common/rfb/CConnection.cxx6
-rw-r--r--common/rfb/CConnection.h8
-rw-r--r--common/rfb/CMsgHandler.h7
-rw-r--r--common/rfb/CMsgReader.cxx3
-rw-r--r--common/rfb/CMsgReader.h1
-rw-r--r--common/rfb/CMsgWriter.cxx1
-rw-r--r--common/rfb/CSecurityRSAAES.cxx12
-rw-r--r--common/rfb/CSecurityRSAAES.h8
-rw-r--r--common/rfb/CSecurityStack.h1
-rw-r--r--common/rfb/CSecurityVeNCrypt.h3
-rw-r--r--common/rfb/ClientParams.cxx14
-rw-r--r--common/rfb/ClientParams.h16
-rw-r--r--common/rfb/ComparingUpdateTracker.h1
-rw-r--r--common/rfb/Cursor.h1
-rw-r--r--common/rfb/EncodeManager.cxx2
-rw-r--r--common/rfb/Encoder.h2
-rw-r--r--common/rfb/H264DecoderContext.h5
-rw-r--r--common/rfb/HextileEncoder.cxx2
-rw-r--r--common/rfb/JpegCompressor.h5
-rw-r--r--common/rfb/JpegDecompressor.h6
-rw-r--r--common/rfb/Region.h3
-rw-r--r--common/rfb/SConnection.cxx2
-rw-r--r--common/rfb/SConnection.h8
-rw-r--r--common/rfb/SMsgHandler.h2
-rw-r--r--common/rfb/SMsgReader.cxx2
-rw-r--r--common/rfb/SMsgWriter.cxx3
-rw-r--r--common/rfb/SMsgWriter.h4
-rw-r--r--common/rfb/SSecurity.h6
-rw-r--r--common/rfb/SSecurityPlain.cxx1
-rw-r--r--common/rfb/SSecurityPlain.h6
-rw-r--r--common/rfb/SSecurityRSAAES.cxx2
-rw-r--r--common/rfb/SSecurityRSAAES.h7
-rw-r--r--common/rfb/SSecurityTLS.h3
-rw-r--r--common/rfb/SSecurityVeNCrypt.cxx4
-rw-r--r--common/rfb/SSecurityVeNCrypt.h6
-rw-r--r--common/rfb/SSecurityVncAuth.cxx3
-rw-r--r--common/rfb/Security.h6
-rw-r--r--common/rfb/SecurityClient.cxx2
-rw-r--r--common/rfb/SecurityClient.h6
-rw-r--r--common/rfb/SecurityServer.cxx4
-rw-r--r--common/rfb/SecurityServer.h1
-rw-r--r--common/rfb/ServerParams.cxx12
-rw-r--r--common/rfb/ServerParams.h16
-rw-r--r--common/rfb/TightDecoder.cxx1
-rw-r--r--common/rfb/TightDecoder.h1
-rw-r--r--common/rfb/UpdateTracker.h1
-rw-r--r--common/rfb/VNCSConnectionST.cxx4
-rw-r--r--common/rfb/VNCServer.h9
-rw-r--r--common/rfb/VNCServerST.cxx3
-rw-r--r--common/rfb/VNCServerST.h2
-rw-r--r--common/rfb/ZRLEEncoder.cxx1
-rw-r--r--tests/perf/encperf.cxx4
-rw-r--r--unix/common/randr.cxx1
-rw-r--r--unix/common/unixcommon.h5
-rw-r--r--unix/x0vncserver/Geometry.h3
-rw-r--r--unix/x0vncserver/XDesktop.cxx1
-rw-r--r--unix/x0vncserver/XPixelBuffer.cxx1
-rw-r--r--unix/x0vncserver/XPixelBuffer.h4
-rw-r--r--unix/x0vncserver/x0vncserver.cxx4
-rw-r--r--unix/xserver/hw/vnc/RFBGlue.cc1
-rw-r--r--unix/xserver/hw/vnc/XserverDesktop.cc3
-rw-r--r--unix/xserver/hw/vnc/XserverDesktop.h3
-rw-r--r--vncviewer/CConn.cxx2
-rw-r--r--vncviewer/CConn.h2
-rw-r--r--vncviewer/DesktopWindow.cxx1
-rw-r--r--vncviewer/DesktopWindow.h2
-rw-r--r--vncviewer/UserDialog.cxx1
-rw-r--r--vncviewer/UserDialog.h2
-rw-r--r--vncviewer/Viewport.cxx2
-rw-r--r--win/rfb_win32/SocketManager.cxx2
-rw-r--r--win/winvnc/VNCServerWin32.cxx1
76 files changed, 220 insertions, 90 deletions
diff --git a/common/network/Socket.cxx b/common/network/Socket.cxx
index 49abbc84..f7ce026e 100644
--- a/common/network/Socket.cxx
+++ b/common/network/Socket.cxx
@@ -41,6 +41,9 @@
#include <rdr/Exception.h>
+#include <rdr/FdInStream.h>
+#include <rdr/FdOutStream.h>
+
#include <network/Socket.h>
#include <rfb/LogWriter.h>
@@ -99,6 +102,11 @@ Socket::~Socket()
delete outstream;
}
+int Socket::getFd()
+{
+ return outstream->getFd();
+}
+
// if shutdown() is overridden then the override MUST call on to here
void Socket::shutdown()
{
@@ -122,6 +130,11 @@ bool Socket::isShutdown() const
return isShutdown_;
}
+void Socket::cork(bool enable)
+{
+ outstream->cork(enable);
+}
+
// Was there a "?" in the ConnectionFilter used to accept this Socket?
void Socket::setRequiresQuery()
{
diff --git a/common/network/Socket.h b/common/network/Socket.h
index 34b8db8e..f1688c72 100644
--- a/common/network/Socket.h
+++ b/common/network/Socket.h
@@ -24,8 +24,11 @@
#include <list>
#include <limits.h>
-#include <rdr/FdInStream.h>
-#include <rdr/FdOutStream.h>
+
+namespace rdr {
+ class FdInStream;
+ class FdOutStream;
+}
namespace network {
@@ -40,12 +43,12 @@ namespace network {
rdr::FdInStream &inStream() {return *instream;}
rdr::FdOutStream &outStream() {return *outstream;}
- int getFd() {return outstream->getFd();}
+ int getFd();
void shutdown();
bool isShutdown() const;
- void cork(bool enable) { outstream->cork(enable); }
+ void cork(bool enable);
// information about the remote end of the socket
virtual const char* getPeerAddress() = 0; // a string e.g. "192.168.0.1"
diff --git a/common/network/TcpSocket.cxx b/common/network/TcpSocket.cxx
index c5b86543..a4eaf060 100644
--- a/common/network/TcpSocket.cxx
+++ b/common/network/TcpSocket.cxx
@@ -36,6 +36,7 @@
#endif
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <rdr/Exception.h>
diff --git a/common/network/UnixSocket.cxx b/common/network/UnixSocket.cxx
index 48561245..66c505a8 100644
--- a/common/network/UnixSocket.cxx
+++ b/common/network/UnixSocket.cxx
@@ -28,6 +28,7 @@
#include <errno.h>
#include <stdlib.h>
#include <stddef.h>
+#include <string.h>
#include <rdr/Exception.h>
diff --git a/common/rfb/Blacklist.h b/common/rfb/Blacklist.h
index c1699f29..3c9660cc 100644
--- a/common/rfb/Blacklist.h
+++ b/common/rfb/Blacklist.h
@@ -27,13 +27,11 @@
#ifndef __RFB_BLACKLIST_H__
#define __RFB_BLACKLIST_H__
-#include <string.h>
#include <time.h>
+
#include <map>
#include <string>
-#include <rfb/Configuration.h>
-
namespace rfb {
//
diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx
index 5f65624d..e58645db 100644
--- a/common/rfb/CConnection.cxx
+++ b/common/rfb/CConnection.cxx
@@ -36,6 +36,7 @@
#include <rfb/CSecurity.h>
#include <rfb/Decoder.h>
#include <rfb/KeysymStr.h>
+#include <rfb/PixelBuffer.h>
#include <rfb/Security.h>
#include <rfb/SecurityClient.h>
#include <rfb/CConnection.h>
@@ -839,6 +840,11 @@ void CConnection::setPF(const PixelFormat& pf)
formatChange = true;
}
+bool CConnection::isSecure() const
+{
+ return csecurity ? csecurity->isSecure() : false;
+}
+
void CConnection::fence(uint32_t flags, unsigned len, const uint8_t data[])
{
CMsgHandler::fence(flags, len, data);
diff --git a/common/rfb/CConnection.h b/common/rfb/CConnection.h
index 07e47e39..37f19353 100644
--- a/common/rfb/CConnection.h
+++ b/common/rfb/CConnection.h
@@ -29,8 +29,14 @@
#include <rfb/CMsgHandler.h>
#include <rfb/DecodeManager.h>
+#include <rfb/PixelFormat.h>
#include <rfb/SecurityClient.h>
+namespace rdr {
+ class InStream;
+ class OutStream;
+}
+
namespace rfb {
class CMsgReader;
@@ -237,7 +243,7 @@ namespace rfb {
// Identities, to determine the unique(ish) name of the server.
const char* getServerName() const { return serverName.c_str(); }
- bool isSecure() const { return csecurity ? csecurity->isSecure() : false; }
+ bool isSecure() const;
enum stateEnum {
RFBSTATE_UNINITIALISED,
diff --git a/common/rfb/CMsgHandler.h b/common/rfb/CMsgHandler.h
index b484b695..33c87235 100644
--- a/common/rfb/CMsgHandler.h
+++ b/common/rfb/CMsgHandler.h
@@ -27,13 +27,16 @@
#include <stdint.h>
#include <rfb/ServerParams.h>
-#include <rfb/Rect.h>
-#include <rfb/ScreenSet.h>
namespace rdr { class InStream; }
namespace rfb {
+ class ModifiablePixelBuffer;
+ struct Point;
+ struct Rect;
+ struct ScreenSet;
+
class CMsgHandler {
public:
CMsgHandler();
diff --git a/common/rfb/CMsgReader.cxx b/common/rfb/CMsgReader.cxx
index a10f7c47..1d20a6fc 100644
--- a/common/rfb/CMsgReader.cxx
+++ b/common/rfb/CMsgReader.cxx
@@ -36,6 +36,9 @@
#include <rfb/LogWriter.h>
#include <rfb/CMsgHandler.h>
#include <rfb/CMsgReader.h>
+#include <rfb/PixelBuffer.h>
+#include <rfb/ScreenSet.h>
+#include <rfb/encodings.h>
static rfb::LogWriter vlog("CMsgReader");
diff --git a/common/rfb/CMsgReader.h b/common/rfb/CMsgReader.h
index 3b1c0ddb..4fbed0ac 100644
--- a/common/rfb/CMsgReader.h
+++ b/common/rfb/CMsgReader.h
@@ -27,7 +27,6 @@
#include <stdint.h>
#include <rfb/Rect.h>
-#include <rfb/encodings.h>
namespace rdr { class InStream; }
diff --git a/common/rfb/CMsgWriter.cxx b/common/rfb/CMsgWriter.cxx
index 0128c431..6cd2cc19 100644
--- a/common/rfb/CMsgWriter.cxx
+++ b/common/rfb/CMsgWriter.cxx
@@ -34,6 +34,7 @@
#include <rfb/clipboardTypes.h>
#include <rfb/PixelFormat.h>
#include <rfb/Rect.h>
+#include <rfb/ScreenSet.h>
#include <rfb/ServerParams.h>
#include <rfb/CMsgWriter.h>
#include <rfb/util.h>
diff --git a/common/rfb/CSecurityRSAAES.cxx b/common/rfb/CSecurityRSAAES.cxx
index 0985d0f2..9b0569ed 100644
--- a/common/rfb/CSecurityRSAAES.cxx
+++ b/common/rfb/CSecurityRSAAES.cxx
@@ -41,6 +41,7 @@
#include <rfb/util.h>
#include <rdr/AESInStream.h>
#include <rdr/AESOutStream.h>
+#include <rdr/RandomStream.h>
#include <os/os.h>
enum {
@@ -147,12 +148,12 @@ bool CSecurityRSAAES::processMsg()
return false;
}
-static void random_func(void* ctx, size_t length, uint8_t* dst)
+static void random_func(void*, size_t length, uint8_t* dst)
{
- rdr::RandomStream* rs = (rdr::RandomStream*)ctx;
- if (!rs->hasData(length))
+ rdr::RandomStream rs;
+ if (!rs.hasData(length))
throw std::runtime_error("Failed to generate random");
- rs->readBytes(dst, length);
+ rs.readBytes(dst, length);
}
void CSecurityRSAAES::writePublicKey()
@@ -170,7 +171,7 @@ void CSecurityRSAAES::writePublicKey()
// set e = 65537
mpz_set_ui(clientPublicKey.e, 65537);
if (!rsa_generate_keypair(&clientPublicKey, &clientKey,
- &rs, random_func, nullptr, nullptr,
+ nullptr, random_func, nullptr, nullptr,
clientKeyLength, 0))
throw std::runtime_error("Failed to generate key");
clientKeyN = new uint8_t[rsaKeySize];
@@ -237,6 +238,7 @@ void CSecurityRSAAES::verifyServer()
void CSecurityRSAAES::writeRandom()
{
+ rdr::RandomStream rs;
rdr::OutStream* os = cc->getOutStream();
if (!rs.hasData(keySize / 8))
throw std::runtime_error("Failed to generate random");
diff --git a/common/rfb/CSecurityRSAAES.h b/common/rfb/CSecurityRSAAES.h
index af380bd3..13d18db8 100644
--- a/common/rfb/CSecurityRSAAES.h
+++ b/common/rfb/CSecurityRSAAES.h
@@ -29,8 +29,6 @@
#include <rfb/CSecurity.h>
#include <rfb/Security.h>
-#include <rdr/RandomStream.h>
-
namespace rdr {
class InStream;
class OutStream;
@@ -39,6 +37,9 @@ namespace rdr {
}
namespace rfb {
+
+ class IntParameter;
+
class CSecurityRSAAES : public CSecurity {
public:
CSecurityRSAAES(CConnection* cc, uint32_t secType,
@@ -86,9 +87,8 @@ namespace rfb {
rdr::InStream* rawis;
rdr::OutStream* rawos;
-
- rdr::RandomStream rs;
};
+
}
#endif
diff --git a/common/rfb/CSecurityStack.h b/common/rfb/CSecurityStack.h
index 521597ec..aec800f9 100644
--- a/common/rfb/CSecurityStack.h
+++ b/common/rfb/CSecurityStack.h
@@ -21,7 +21,6 @@
#define __RFB_CSECURITYSTACK_H__
#include <rfb/CSecurity.h>
-#include <rfb/Security.h>
namespace rfb {
diff --git a/common/rfb/CSecurityVeNCrypt.h b/common/rfb/CSecurityVeNCrypt.h
index f73e7927..8e2c6d5e 100644
--- a/common/rfb/CSecurityVeNCrypt.h
+++ b/common/rfb/CSecurityVeNCrypt.h
@@ -28,10 +28,11 @@
#include <stdint.h>
#include <rfb/CSecurity.h>
-#include <rfb/SecurityClient.h>
namespace rfb {
+ class SecurityClient;
+
class CSecurityVeNCrypt : public CSecurity {
public:
diff --git a/common/rfb/ClientParams.cxx b/common/rfb/ClientParams.cxx
index e5fd105e..2b2dd2c2 100644
--- a/common/rfb/ClientParams.cxx
+++ b/common/rfb/ClientParams.cxx
@@ -28,6 +28,8 @@
#include <rfb/ledStates.h>
#include <rfb/clipboardTypes.h>
#include <rfb/ClientParams.h>
+#include <rfb/Cursor.h>
+#include <rfb/ScreenSet.h>
#include <rfb/util.h>
using namespace rfb;
@@ -41,6 +43,10 @@ ClientParams::ClientParams()
{
setName("");
+ screenLayout_ = new ScreenSet();
+
+ pf_ = new PixelFormat();
+
cursor_ = new Cursor(0, 0, Point(), nullptr);
clipFlags = clipboardUTF8 | clipboardRTF | clipboardHTML |
@@ -51,7 +57,9 @@ ClientParams::ClientParams()
ClientParams::~ClientParams()
{
+ delete screenLayout_;
delete cursor_;
+ delete pf_;
}
void ClientParams::setDimensions(int width, int height)
@@ -68,12 +76,14 @@ void ClientParams::setDimensions(int width, int height, const ScreenSet& layout)
width_ = width;
height_ = height;
- screenLayout_ = layout;
+ delete screenLayout_;
+ screenLayout_ = new ScreenSet(layout);
}
void ClientParams::setPF(const PixelFormat& pf)
{
- pf_ = pf;
+ delete pf_;
+ pf_ = new PixelFormat(pf);
if (pf.bpp != 8 && pf.bpp != 16 && pf.bpp != 32)
throw std::invalid_argument("setPF: Not 8, 16 or 32 bpp?");
diff --git a/common/rfb/ClientParams.h b/common/rfb/ClientParams.h
index f715c47f..05ae884c 100644
--- a/common/rfb/ClientParams.h
+++ b/common/rfb/ClientParams.h
@@ -28,12 +28,14 @@
#include <stdint.h>
-#include <rfb/Cursor.h>
-#include <rfb/PixelFormat.h>
-#include <rfb/ScreenSet.h>
+#include <rfb/Rect.h>
namespace rfb {
+ class Cursor;
+ class PixelFormat;
+ struct ScreenSet;
+
const int subsampleUndefined = -1;
const int subsampleNone = 0;
const int subsampleGray = 1;
@@ -66,11 +68,11 @@ namespace rfb {
int width() const { return width_; }
int height() const { return height_; }
- const ScreenSet& screenLayout() const { return screenLayout_; }
+ const ScreenSet& screenLayout() const { return *screenLayout_; }
void setDimensions(int width, int height);
void setDimensions(int width, int height, const ScreenSet& layout);
- const PixelFormat& pf() const { return pf_; }
+ const PixelFormat& pf() const { return *pf_; }
void setPF(const PixelFormat& pf);
const char* name() const { return name_.c_str(); }
@@ -112,9 +114,9 @@ namespace rfb {
int width_;
int height_;
- ScreenSet screenLayout_;
+ ScreenSet* screenLayout_;
- PixelFormat pf_;
+ PixelFormat* pf_;
std::string name_;
Cursor* cursor_;
Point cursorPos_;
diff --git a/common/rfb/ComparingUpdateTracker.h b/common/rfb/ComparingUpdateTracker.h
index ca1dcc30..753c4140 100644
--- a/common/rfb/ComparingUpdateTracker.h
+++ b/common/rfb/ComparingUpdateTracker.h
@@ -19,6 +19,7 @@
#ifndef __RFB_COMPARINGUPDATETRACKER_H__
#define __RFB_COMPARINGUPDATETRACKER_H__
+#include <rfb/PixelBuffer.h>
#include <rfb/UpdateTracker.h>
namespace rfb {
diff --git a/common/rfb/Cursor.h b/common/rfb/Cursor.h
index c71f5a77..7d75251a 100644
--- a/common/rfb/Cursor.h
+++ b/common/rfb/Cursor.h
@@ -27,6 +27,7 @@
#include <vector>
#include <rfb/PixelBuffer.h>
+#include <rfb/Rect.h>
namespace rfb {
diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx
index 67a32f5b..8e4a37d0 100644
--- a/common/rfb/EncodeManager.cxx
+++ b/common/rfb/EncodeManager.cxx
@@ -25,6 +25,7 @@
#include <stdlib.h>
+#include <rfb/Cursor.h>
#include <rfb/EncodeManager.h>
#include <rfb/Encoder.h>
#include <rfb/Palette.h>
@@ -32,6 +33,7 @@
#include <rfb/SMsgWriter.h>
#include <rfb/UpdateTracker.h>
#include <rfb/LogWriter.h>
+#include <rfb/encodings.h>
#include <rfb/util.h>
#include <rfb/RawEncoder.h>
diff --git a/common/rfb/Encoder.h b/common/rfb/Encoder.h
index 5e066323..7fa2cc75 100644
--- a/common/rfb/Encoder.h
+++ b/common/rfb/Encoder.h
@@ -22,8 +22,6 @@
#include <stdint.h>
-#include <rfb/Rect.h>
-
namespace rfb {
class SConnection;
class PixelBuffer;
diff --git a/common/rfb/H264DecoderContext.h b/common/rfb/H264DecoderContext.h
index 94a1e15d..c62b48c4 100644
--- a/common/rfb/H264DecoderContext.h
+++ b/common/rfb/H264DecoderContext.h
@@ -24,9 +24,11 @@
#include <stdint.h>
#include <rfb/Rect.h>
-#include <rfb/Decoder.h>
namespace rfb {
+
+ class ModifiablePixelBuffer;
+
class H264DecoderContext {
public:
static H264DecoderContext *createContext(const Rect &r);
@@ -44,6 +46,7 @@ namespace rfb {
H264DecoderContext(const Rect &r) : rect(r) {}
};
+
}
#endif
diff --git a/common/rfb/HextileEncoder.cxx b/common/rfb/HextileEncoder.cxx
index 0666d02d..baf7b98b 100644
--- a/common/rfb/HextileEncoder.cxx
+++ b/common/rfb/HextileEncoder.cxx
@@ -22,6 +22,8 @@
#include <config.h>
#endif
+#include <rdr/OutStream.h>
+
#include <rfb/encodings.h>
#include <rfb/SConnection.h>
#include <rfb/HextileEncoder.h>
diff --git a/common/rfb/JpegCompressor.h b/common/rfb/JpegCompressor.h
index 26194204..8ebbd310 100644
--- a/common/rfb/JpegCompressor.h
+++ b/common/rfb/JpegCompressor.h
@@ -26,8 +26,6 @@
#define __RFB_JPEGCOMPRESSOR_H__
#include <rdr/MemOutStream.h>
-#include <rfb/PixelFormat.h>
-#include <rfb/Rect.h>
struct jpeg_compress_struct;
@@ -36,6 +34,9 @@ struct JPEG_DEST_MGR;
namespace rfb {
+ class PixelFormat;
+ struct Rect;
+
class JpegCompressor : public rdr::MemOutStream {
public:
diff --git a/common/rfb/JpegDecompressor.h b/common/rfb/JpegDecompressor.h
index 5d4f0c21..cbf0485a 100644
--- a/common/rfb/JpegDecompressor.h
+++ b/common/rfb/JpegDecompressor.h
@@ -26,8 +26,7 @@
#ifndef __RFB_JPEGDECOMPRESSOR_H__
#define __RFB_JPEGDECOMPRESSOR_H__
-#include <rfb/PixelFormat.h>
-#include <rfb/Rect.h>
+#include <stdint.h>
struct jpeg_decompress_struct;
@@ -36,6 +35,9 @@ struct JPEG_SRC_MGR;
namespace rfb {
+ class PixelFormat;
+ struct Rect;
+
class JpegDecompressor {
public:
diff --git a/common/rfb/Region.h b/common/rfb/Region.h
index 38de67ce..0927f763 100644
--- a/common/rfb/Region.h
+++ b/common/rfb/Region.h
@@ -29,6 +29,9 @@ struct pixman_region16;
namespace rfb {
+ struct Point;
+ struct Rect;
+
class Region {
public:
// Create an empty region
diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx
index a0a1c373..03219378 100644
--- a/common/rfb/SConnection.cxx
+++ b/common/rfb/SConnection.cxx
@@ -26,6 +26,8 @@
#include <algorithm>
+#include <rdr/OutStream.h>
+
#include <rfb/Exception.h>
#include <rfb/Security.h>
#include <rfb/clipboardTypes.h>
diff --git a/common/rfb/SConnection.h b/common/rfb/SConnection.h
index f030ae05..dcaa90de 100644
--- a/common/rfb/SConnection.h
+++ b/common/rfb/SConnection.h
@@ -26,14 +26,16 @@
#include <string>
-#include <rdr/InStream.h>
-#include <rdr/OutStream.h>
-
#include <rfb/AccessRights.h>
#include <rfb/SMsgHandler.h>
#include <rfb/SecurityServer.h>
#include <rfb/Timer.h>
+namespace rdr {
+ class InStream;
+ class OutStream;
+}
+
namespace rfb {
class SMsgReader;
diff --git a/common/rfb/SMsgHandler.h b/common/rfb/SMsgHandler.h
index c5d13d78..3fee5703 100644
--- a/common/rfb/SMsgHandler.h
+++ b/common/rfb/SMsgHandler.h
@@ -25,9 +25,7 @@
#include <stdint.h>
-#include <rfb/PixelFormat.h>
#include <rfb/ClientParams.h>
-#include <rfb/ScreenSet.h>
namespace rdr { class InStream; }
diff --git a/common/rfb/SMsgReader.cxx b/common/rfb/SMsgReader.cxx
index 5df11153..15549ed3 100644
--- a/common/rfb/SMsgReader.cxx
+++ b/common/rfb/SMsgReader.cxx
@@ -32,6 +32,8 @@
#include <rfb/qemuTypes.h>
#include <rfb/clipboardTypes.h>
#include <rfb/Exception.h>
+#include <rfb/PixelFormat.h>
+#include <rfb/ScreenSet.h>
#include <rfb/SMsgHandler.h>
#include <rfb/SMsgReader.h>
#include <rfb/Configuration.h>
diff --git a/common/rfb/SMsgWriter.cxx b/common/rfb/SMsgWriter.cxx
index 5ee0905b..69f06cf5 100644
--- a/common/rfb/SMsgWriter.cxx
+++ b/common/rfb/SMsgWriter.cxx
@@ -32,10 +32,13 @@
#include <rfb/fenceTypes.h>
#include <rfb/clipboardTypes.h>
#include <rfb/ClientParams.h>
+#include <rfb/Cursor.h>
#include <rfb/UpdateTracker.h>
#include <rfb/Encoder.h>
+#include <rfb/ScreenSet.h>
#include <rfb/SMsgWriter.h>
#include <rfb/LogWriter.h>
+#include <rfb/encodings.h>
#include <rfb/ledStates.h>
#include <rfb/util.h>
diff --git a/common/rfb/SMsgWriter.h b/common/rfb/SMsgWriter.h
index 7bc0ed6a..9bfe116b 100644
--- a/common/rfb/SMsgWriter.h
+++ b/common/rfb/SMsgWriter.h
@@ -25,15 +25,13 @@
#include <stdint.h>
-#include <rfb/encodings.h>
-#include <rfb/ScreenSet.h>
-
namespace rdr { class OutStream; }
namespace rfb {
class ClientParams;
class PixelFormat;
+ struct Rect;
struct ScreenSet;
class SMsgWriter {
diff --git a/common/rfb/SSecurity.h b/common/rfb/SSecurity.h
index 0911ecd8..edbe8185 100644
--- a/common/rfb/SSecurity.h
+++ b/common/rfb/SSecurity.h
@@ -44,12 +44,12 @@
#ifndef __RFB_SSECURITY_H__
#define __RFB_SSECURITY_H__
-#include <rfb/SConnection.h>
-
-#include <list>
+#include <rfb/AccessRights.h>
namespace rfb {
+ class SConnection;
+
class SSecurity {
public:
SSecurity(SConnection* sc_) : sc(sc_) {}
diff --git a/common/rfb/SSecurityPlain.cxx b/common/rfb/SSecurityPlain.cxx
index e62e6d60..d3134a66 100644
--- a/common/rfb/SSecurityPlain.cxx
+++ b/common/rfb/SSecurityPlain.cxx
@@ -21,6 +21,7 @@
#include <config.h>
#endif
+#include <rfb/Configuration.h>
#include <rfb/SSecurityPlain.h>
#include <rfb/SConnection.h>
#include <rfb/Exception.h>
diff --git a/common/rfb/SSecurityPlain.h b/common/rfb/SSecurityPlain.h
index c0ac049b..e8435ffd 100644
--- a/common/rfb/SSecurityPlain.h
+++ b/common/rfb/SSecurityPlain.h
@@ -20,13 +20,13 @@
#ifndef __RFB_SSECURITYPLAIN_H__
#define __RFB_SSECURITYPLAIN_H__
-#include <rfb/SConnection.h>
+#include <rfb/Security.h>
#include <rfb/SSecurity.h>
-#include <rfb/SSecurityVeNCrypt.h>
-#include <rfb/Configuration.h>
namespace rfb {
+ class StringParameter;
+
class PasswordValidator {
public:
bool validate(SConnection* sc, const char *username, const char *password)
diff --git a/common/rfb/SSecurityRSAAES.cxx b/common/rfb/SSecurityRSAAES.cxx
index 14888535..274e8470 100644
--- a/common/rfb/SSecurityRSAAES.cxx
+++ b/common/rfb/SSecurityRSAAES.cxx
@@ -40,6 +40,7 @@
#include <rdr/AESInStream.h>
#include <rdr/AESOutStream.h>
#include <rdr/Exception.h>
+#include <rdr/RandomStream.h>
#include <rfb/SSecurityRSAAES.h>
#include <rfb/SConnection.h>
@@ -345,6 +346,7 @@ static void random_func(void* ctx, size_t length, uint8_t* dst)
void SSecurityRSAAES::writeRandom()
{
+ rdr::RandomStream rs;
rdr::OutStream* os = sc->getOutStream();
if (!rs.hasData(keySize / 8))
throw std::runtime_error("Failed to generate random");
diff --git a/common/rfb/SSecurityRSAAES.h b/common/rfb/SSecurityRSAAES.h
index e3300cb7..7dcac027 100644
--- a/common/rfb/SSecurityRSAAES.h
+++ b/common/rfb/SSecurityRSAAES.h
@@ -27,8 +27,6 @@
#include <rfb/SSecurity.h>
-#include <rdr/RandomStream.h>
-
namespace rdr {
class InStream;
class OutStream;
@@ -38,6 +36,9 @@ namespace rdr {
namespace rfb {
+ class BoolParameter;
+ class StringParameter;
+
class SSecurityRSAAES : public SSecurity {
public:
SSecurityRSAAES(SConnection* sc, uint32_t secType,
@@ -96,8 +97,6 @@ namespace rfb {
rdr::InStream* rawis;
rdr::OutStream* rawos;
-
- rdr::RandomStream rs;
};
}
diff --git a/common/rfb/SSecurityTLS.h b/common/rfb/SSecurityTLS.h
index 1dc33cfd..22b56da4 100644
--- a/common/rfb/SSecurityTLS.h
+++ b/common/rfb/SSecurityTLS.h
@@ -26,6 +26,7 @@
#error "This header should not be included without HAVE_GNUTLS defined"
#endif
+#include <rfb/Security.h>
#include <rfb/SSecurity.h>
#include <gnutls/gnutls.h>
@@ -46,6 +47,8 @@ namespace rdr {
namespace rfb {
+ class StringParameter;
+
class SSecurityTLS : public SSecurity {
public:
SSecurityTLS(SConnection* sc, bool _anon);
diff --git a/common/rfb/SSecurityVeNCrypt.cxx b/common/rfb/SSecurityVeNCrypt.cxx
index 4617fddb..47a7f489 100644
--- a/common/rfb/SSecurityVeNCrypt.cxx
+++ b/common/rfb/SSecurityVeNCrypt.cxx
@@ -26,9 +26,13 @@
#include <config.h>
#endif
+#include <rfb/SConnection.h>
+#include <rfb/SecurityServer.h>
#include <rfb/SSecurityVeNCrypt.h>
#include <rfb/Exception.h>
#include <rfb/LogWriter.h>
+#include <rfb/Security.h>
+
#include <rdr/InStream.h>
#include <rdr/OutStream.h>
diff --git a/common/rfb/SSecurityVeNCrypt.h b/common/rfb/SSecurityVeNCrypt.h
index ea2bb6fb..534f94a6 100644
--- a/common/rfb/SSecurityVeNCrypt.h
+++ b/common/rfb/SSecurityVeNCrypt.h
@@ -25,11 +25,13 @@
#ifndef __SSECURITYVENCRYPT_H__
#define __SSECURITYVENCRYPT_H__
-#include <rfb/SSecurityStack.h>
-#include <rfb/SConnection.h>
+#include <rfb/SSecurity.h>
namespace rfb {
+ class SConnection;
+ class SecurityServer;
+
class SSecurityVeNCrypt : public SSecurity {
public:
SSecurityVeNCrypt(SConnection* sc, SecurityServer *sec);
diff --git a/common/rfb/SSecurityVncAuth.cxx b/common/rfb/SSecurityVncAuth.cxx
index 41f607fd..1d3580d2 100644
--- a/common/rfb/SSecurityVncAuth.cxx
+++ b/common/rfb/SSecurityVncAuth.cxx
@@ -25,6 +25,8 @@
#include <config.h>
#endif
+#include <rdr/OutStream.h>
+
#include <rfb/SSecurityVncAuth.h>
#include <rdr/RandomStream.h>
#include <rfb/SConnection.h>
@@ -32,6 +34,7 @@
#include <rfb/LogWriter.h>
#include <rfb/Exception.h>
#include <rfb/obfuscate.h>
+
#include <assert.h>
#include <string.h>
#include <stdio.h>
diff --git a/common/rfb/Security.h b/common/rfb/Security.h
index 430a1d89..29021e6d 100644
--- a/common/rfb/Security.h
+++ b/common/rfb/Security.h
@@ -24,11 +24,12 @@
#include <stdint.h>
-#include <rfb/Configuration.h>
-
#include <list>
namespace rfb {
+
+ class StringParameter;
+
const uint8_t secTypeInvalid = 0;
const uint8_t secTypeNone = 1;
const uint8_t secTypeVncAuth = 2;
@@ -115,6 +116,7 @@ namespace rfb {
const char* secTypeName(uint32_t num);
uint32_t secTypeNum(const char* name);
std::list<uint32_t> parseSecTypes(const char* types);
+
}
#endif
diff --git a/common/rfb/SecurityClient.cxx b/common/rfb/SecurityClient.cxx
index 03109ed0..3a496c6a 100644
--- a/common/rfb/SecurityClient.cxx
+++ b/common/rfb/SecurityClient.cxx
@@ -25,12 +25,14 @@
#include <stdexcept>
+#include <rfb/Configuration.h>
#include <rfb/CSecurityNone.h>
#include <rfb/CSecurityStack.h>
#include <rfb/CSecurityVeNCrypt.h>
#include <rfb/CSecurityVncAuth.h>
#include <rfb/CSecurityPlain.h>
#include <rfb/Security.h>
+#include <rfb/SecurityClient.h>
#ifdef HAVE_GNUTLS
#include <rfb/CSecurityTLS.h>
#endif
diff --git a/common/rfb/SecurityClient.h b/common/rfb/SecurityClient.h
index b86fcb35..222fac3d 100644
--- a/common/rfb/SecurityClient.h
+++ b/common/rfb/SecurityClient.h
@@ -22,12 +22,14 @@
#ifndef __RFB_SECURITYCLIENT_H__
#define __RFB_SECURITYCLIENT_H__
-#include <rfb/Configuration.h>
#include <rfb/Security.h>
-#include <rfb/CSecurity.h>
namespace rfb {
+ class CConnection;
+ class CSecurity;
+ class StringParameter;
+
class SecurityClient : public Security {
public:
SecurityClient(void) : Security(secTypes) {}
diff --git a/common/rfb/SecurityServer.cxx b/common/rfb/SecurityServer.cxx
index 8dc7260e..437163d6 100644
--- a/common/rfb/SecurityServer.cxx
+++ b/common/rfb/SecurityServer.cxx
@@ -21,7 +21,11 @@
#include <config.h>
#endif
+#include <stdexcept>
+
#include <rfb/Security.h>
+#include <rfb/SecurityServer.h>
+
#include <rfb/SSecurityNone.h>
#include <rfb/SSecurityStack.h>
#include <rfb/SSecurityPlain.h>
diff --git a/common/rfb/SecurityServer.h b/common/rfb/SecurityServer.h
index a51ee23c..42dc84e2 100644
--- a/common/rfb/SecurityServer.h
+++ b/common/rfb/SecurityServer.h
@@ -20,7 +20,6 @@
#ifndef __RFB_SECURITYSERVER_H__
#define __RFB_SECURITYSERVER_H__
-#include <rfb/Configuration.h>
#include <rfb/Security.h>
namespace rfb {
diff --git a/common/rfb/ServerParams.cxx b/common/rfb/ServerParams.cxx
index b7432b8f..ed3ac7eb 100644
--- a/common/rfb/ServerParams.cxx
+++ b/common/rfb/ServerParams.cxx
@@ -25,6 +25,8 @@
#include <stdexcept>
#include <rfb/ledStates.h>
+#include <rfb/Cursor.h>
+#include <rfb/ScreenSet.h>
#include <rfb/ServerParams.h>
#include <rfb/util.h>
@@ -40,6 +42,10 @@ ServerParams::ServerParams()
{
setName("");
+ screenLayout_ = new ScreenSet();
+
+ pf_ = new PixelFormat();
+
cursor_ = new Cursor(0, 0, Point(), nullptr);
clipFlags = 0;
@@ -65,12 +71,14 @@ void ServerParams::setDimensions(int width, int height, const ScreenSet& layout)
width_ = width;
height_ = height;
- screenLayout_ = layout;
+ delete screenLayout_;
+ screenLayout_ = new ScreenSet(layout);
}
void ServerParams::setPF(const PixelFormat& pf)
{
- pf_ = pf;
+ delete pf_;
+ pf_ = new PixelFormat(pf);
if (pf.bpp != 8 && pf.bpp != 16 && pf.bpp != 32)
throw std::invalid_argument("setPF: Not 8, 16 or 32 bpp?");
diff --git a/common/rfb/ServerParams.h b/common/rfb/ServerParams.h
index d730b891..6be9acd6 100644
--- a/common/rfb/ServerParams.h
+++ b/common/rfb/ServerParams.h
@@ -25,12 +25,12 @@
#include <string>
-#include <rfb/Cursor.h>
-#include <rfb/PixelFormat.h>
-#include <rfb/ScreenSet.h>
-
namespace rfb {
+ class Cursor;
+ class PixelFormat;
+ struct ScreenSet;
+
class ServerParams {
public:
ServerParams();
@@ -55,11 +55,11 @@ namespace rfb {
int width() const { return width_; }
int height() const { return height_; }
- const ScreenSet& screenLayout() const { return screenLayout_; }
+ const ScreenSet& screenLayout() const { return *screenLayout_; }
void setDimensions(int width, int height);
void setDimensions(int width, int height, const ScreenSet& layout);
- const PixelFormat& pf() const { return pf_; }
+ const PixelFormat& pf() const { return *pf_; }
void setPF(const PixelFormat& pf);
const char* name() const { return name_.c_str(); }
@@ -85,9 +85,9 @@ namespace rfb {
int width_;
int height_;
- ScreenSet screenLayout_;
+ ScreenSet* screenLayout_;
- PixelFormat pf_;
+ PixelFormat* pf_;
std::string name_;
Cursor* cursor_;
unsigned int ledState_;
diff --git a/common/rfb/TightDecoder.cxx b/common/rfb/TightDecoder.cxx
index a26c0bfe..8443f09f 100644
--- a/common/rfb/TightDecoder.cxx
+++ b/common/rfb/TightDecoder.cxx
@@ -33,6 +33,7 @@
#include <rfb/ServerParams.h>
#include <rfb/Exception.h>
+#include <rfb/JpegDecompressor.h>
#include <rfb/PixelBuffer.h>
#include <rfb/TightConstants.h>
#include <rfb/TightDecoder.h>
diff --git a/common/rfb/TightDecoder.h b/common/rfb/TightDecoder.h
index d569a7fd..cb94ca73 100644
--- a/common/rfb/TightDecoder.h
+++ b/common/rfb/TightDecoder.h
@@ -22,7 +22,6 @@
#include <rdr/ZlibInStream.h>
#include <rfb/Decoder.h>
-#include <rfb/JpegDecompressor.h>
namespace rfb {
diff --git a/common/rfb/UpdateTracker.h b/common/rfb/UpdateTracker.h
index e91b9621..fd597964 100644
--- a/common/rfb/UpdateTracker.h
+++ b/common/rfb/UpdateTracker.h
@@ -21,7 +21,6 @@
#include <rfb/Rect.h>
#include <rfb/Region.h>
-#include <rfb/PixelBuffer.h>
namespace rfb {
diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx
index 509f64c5..abfc3504 100644
--- a/common/rfb/VNCSConnectionST.cxx
+++ b/common/rfb/VNCSConnectionST.cxx
@@ -24,6 +24,9 @@
#include <rdr/Exception.h>
+#include <rdr/FdInStream.h>
+#include <rdr/FdOutStream.h>
+
#include <network/TcpSocket.h>
#include <rfb/ComparingUpdateTracker.h>
@@ -37,6 +40,7 @@
#include <rfb/SMsgWriter.h>
#include <rfb/VNCServerST.h>
#include <rfb/VNCSConnectionST.h>
+#include <rfb/encodings.h>
#include <rfb/screenTypes.h>
#include <rfb/fenceTypes.h>
#include <rfb/ledStates.h>
diff --git a/common/rfb/VNCServer.h b/common/rfb/VNCServer.h
index 4e3a5b23..143ac1f4 100644
--- a/common/rfb/VNCServer.h
+++ b/common/rfb/VNCServer.h
@@ -23,14 +23,19 @@
#ifndef __RFB_VNCSERVER_H__
#define __RFB_VNCSERVER_H__
+#include <list>
+
+#include <rfb/AccessRights.h>
#include <rfb/UpdateTracker.h>
-#include <rfb/SSecurity.h>
-#include <rfb/ScreenSet.h>
namespace network { class Socket; }
namespace rfb {
+ class PixelBuffer;
+ class SConnection;
+ struct ScreenSet;
+
class VNCServer : public UpdateTracker {
public:
// addSocket() tells the server to serve the Socket. The caller
diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx
index b99d33b0..bf9e6524 100644
--- a/common/rfb/VNCServerST.cxx
+++ b/common/rfb/VNCServerST.cxx
@@ -55,12 +55,15 @@
#include <assert.h>
#include <stdlib.h>
+#include <rdr/FdOutStream.h>
+
#include <network/Socket.h>
#include <rfb/ComparingUpdateTracker.h>
#include <rfb/KeyRemapper.h>
#include <rfb/KeysymStr.h>
#include <rfb/LogWriter.h>
+#include <rfb/SDesktop.h>
#include <rfb/Security.h>
#include <rfb/ServerCore.h>
#include <rfb/VNCServerST.h>
diff --git a/common/rfb/VNCServerST.h b/common/rfb/VNCServerST.h
index dc4f9aad..6c19e5be 100644
--- a/common/rfb/VNCServerST.h
+++ b/common/rfb/VNCServerST.h
@@ -26,7 +26,6 @@
#include <sys/time.h>
-#include <rfb/SDesktop.h>
#include <rfb/VNCServer.h>
#include <rfb/Blacklist.h>
#include <rfb/Cursor.h>
@@ -40,6 +39,7 @@ namespace rfb {
class ListConnInfo;
class PixelBuffer;
class KeyRemapper;
+ class SDesktop;
class VNCServerST : public VNCServer,
public Timer::Callback {
diff --git a/common/rfb/ZRLEEncoder.cxx b/common/rfb/ZRLEEncoder.cxx
index 1e2c6ef4..425c4d75 100644
--- a/common/rfb/ZRLEEncoder.cxx
+++ b/common/rfb/ZRLEEncoder.cxx
@@ -25,6 +25,7 @@
#include <rfb/Exception.h>
#include <rfb/encodings.h>
#include <rfb/Palette.h>
+#include <rfb/PixelBuffer.h>
#include <rfb/SConnection.h>
#include <rfb/ZRLEEncoder.h>
#include <rfb/Configuration.h>
diff --git a/tests/perf/encperf.cxx b/tests/perf/encperf.cxx
index f7c630a0..fe22787a 100644
--- a/tests/perf/encperf.cxx
+++ b/tests/perf/encperf.cxx
@@ -42,14 +42,12 @@
#include <rdr/FileInStream.h>
#include <rfb/AccessRights.h>
-
#include <rfb/PixelFormat.h>
-
#include <rfb/CConnection.h>
#include <rfb/CMsgReader.h>
#include <rfb/CMsgWriter.h>
+#include <rfb/Configuration.h>
#include <rfb/UpdateTracker.h>
-
#include <rfb/EncodeManager.h>
#include <rfb/SConnection.h>
#include <rfb/SMsgWriter.h>
diff --git a/unix/common/randr.cxx b/unix/common/randr.cxx
index e4e2d7be..eedfd811 100644
--- a/unix/common/randr.cxx
+++ b/unix/common/randr.cxx
@@ -28,6 +28,7 @@
#include <unixcommon.h>
#include <rfb/screenTypes.h>
#include <rfb/LogWriter.h>
+#include <rfb/ScreenSet.h>
#include <RandrGlue.h>
static rfb::LogWriter vlog("RandR");
diff --git a/unix/common/unixcommon.h b/unix/common/unixcommon.h
index d04c3ae9..1f6cd8eb 100644
--- a/unix/common/unixcommon.h
+++ b/unix/common/unixcommon.h
@@ -20,9 +20,12 @@
#ifndef UNIXCOMMON_H
#define UNIXCOMMON_H
+#include <stdint.h>
+
#include <map>
+#include <set>
-#include <rfb/ScreenSet.h>
+namespace rfb { struct ScreenSet; }
typedef std::map<unsigned int, uint32_t> OutputIdMap;
diff --git a/unix/x0vncserver/Geometry.h b/unix/x0vncserver/Geometry.h
index d938d63f..881bd326 100644
--- a/unix/x0vncserver/Geometry.h
+++ b/unix/x0vncserver/Geometry.h
@@ -24,7 +24,8 @@
#define __GEOMETRY_H__
#include <rfb/Rect.h>
-#include <rfb/Configuration.h>
+
+namespace rfb { class StringParameter; }
class Geometry
{
diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx
index b43e3f79..938c5374 100644
--- a/unix/x0vncserver/XDesktop.cxx
+++ b/unix/x0vncserver/XDesktop.cxx
@@ -31,6 +31,7 @@
#include <network/Socket.h>
#include <rfb/LogWriter.h>
+#include <rfb/ScreenSet.h>
#include <x0vncserver/XDesktop.h>
diff --git a/unix/x0vncserver/XPixelBuffer.cxx b/unix/x0vncserver/XPixelBuffer.cxx
index 0e24cc51..5244f1e9 100644
--- a/unix/x0vncserver/XPixelBuffer.cxx
+++ b/unix/x0vncserver/XPixelBuffer.cxx
@@ -25,6 +25,7 @@
#include <config.h>
#endif
+#include <string.h>
#include <vector>
#include <rfb/Region.h>
#include <X11/Xlib.h>
diff --git a/unix/x0vncserver/XPixelBuffer.h b/unix/x0vncserver/XPixelBuffer.h
index 7556e6ef..4c1b71f0 100644
--- a/unix/x0vncserver/XPixelBuffer.h
+++ b/unix/x0vncserver/XPixelBuffer.h
@@ -24,10 +24,12 @@
#define __XPIXELBUFFER_H__
#include <rfb/PixelBuffer.h>
-#include <rfb/VNCServer.h>
+
#include <x0vncserver/Image.h>
#include <x0vncserver/PollingManager.h>
+namespace rfb { class VNCServer; }
+
//
// XPixelBuffer is an Image-based implementation of FullFramePixelBuffer.
//
diff --git a/unix/x0vncserver/x0vncserver.cxx b/unix/x0vncserver/x0vncserver.cxx
index 9652f015..eba0ea8e 100644
--- a/unix/x0vncserver/x0vncserver.cxx
+++ b/unix/x0vncserver/x0vncserver.cxx
@@ -31,13 +31,17 @@
#include <errno.h>
#include <pwd.h>
+#include <rdr/FdOutStream.h>
+
#include <rfb/Logger_stdio.h>
#include <rfb/LogWriter.h>
#include <rfb/VNCServerST.h>
#include <rfb/Configuration.h>
#include <rfb/Timer.h>
+
#include <network/TcpSocket.h>
#include <network/UnixSocket.h>
+
#ifdef HAVE_LIBSYSTEMD
# include <systemd/sd-daemon.h>
#endif
diff --git a/unix/xserver/hw/vnc/RFBGlue.cc b/unix/xserver/hw/vnc/RFBGlue.cc
index 5d3e4953..eea4e9e0 100644
--- a/unix/xserver/hw/vnc/RFBGlue.cc
+++ b/unix/xserver/hw/vnc/RFBGlue.cc
@@ -22,6 +22,7 @@
#endif
#include <stdlib.h>
+#include <string.h>
#include <network/TcpSocket.h>
#include <rfb/Configuration.h>
diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc
index 260ed3a6..5b87d50f 100644
--- a/unix/xserver/hw/vnc/XserverDesktop.cc
+++ b/unix/xserver/hw/vnc/XserverDesktop.cc
@@ -37,7 +37,10 @@
#include <fcntl.h>
#include <sys/utsname.h>
+#include <rdr/FdOutStream.h>
+
#include <network/Socket.h>
+
#include <rfb/VNCServerST.h>
#include <rfb/LogWriter.h>
#include <rfb/Configuration.h>
diff --git a/unix/xserver/hw/vnc/XserverDesktop.h b/unix/xserver/hw/vnc/XserverDesktop.h
index 8c543db7..a3e671ab 100644
--- a/unix/xserver/hw/vnc/XserverDesktop.h
+++ b/unix/xserver/hw/vnc/XserverDesktop.h
@@ -33,9 +33,10 @@
#include <rfb/SDesktop.h>
#include <rfb/PixelBuffer.h>
-#include <rfb/Configuration.h>
#include <rfb/Timer.h>
+
#include <unixcommon.h>
+
#include "vncInput.h"
namespace rfb {
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index 5f943640..3962e649 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -28,6 +28,8 @@
#endif
#include <rdr/Exception.h>
+#include <rdr/FdInStream.h>
+#include <rdr/FdOutStream.h>
#include <rfb/CMsgWriter.h>
#include <rfb/CSecurity.h>
diff --git a/vncviewer/CConn.h b/vncviewer/CConn.h
index e830ecaa..55853ca0 100644
--- a/vncviewer/CConn.h
+++ b/vncviewer/CConn.h
@@ -23,7 +23,7 @@
#include <FL/Fl.H>
#include <rfb/CConnection.h>
-#include <rdr/FdInStream.h>
+
#include "UserDialog.h"
namespace network { class Socket; }
diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
index ec3d6122..a8c00f01 100644
--- a/vncviewer/DesktopWindow.cxx
+++ b/vncviewer/DesktopWindow.cxx
@@ -30,6 +30,7 @@
#include <rfb/LogWriter.h>
#include <rfb/CMsgWriter.h>
+#include <rfb/ScreenSet.h>
#include <rfb/util.h>
#include "DesktopWindow.h"
diff --git a/vncviewer/DesktopWindow.h b/vncviewer/DesktopWindow.h
index 97c3c00d..1d58a391 100644
--- a/vncviewer/DesktopWindow.h
+++ b/vncviewer/DesktopWindow.h
@@ -24,8 +24,6 @@
#include <sys/time.h>
-#include <rfb/Rect.h>
-
#include <FL/Fl_Window.H>
namespace rfb { class ModifiablePixelBuffer; }
diff --git a/vncviewer/UserDialog.cxx b/vncviewer/UserDialog.cxx
index 70a0f6ea..2d3a7084 100644
--- a/vncviewer/UserDialog.cxx
+++ b/vncviewer/UserDialog.cxx
@@ -38,6 +38,7 @@
#include <rdr/Exception.h>
+#include <rfb/CConnection.h>
#include <rfb/Exception.h>
#include <rfb/obfuscate.h>
diff --git a/vncviewer/UserDialog.h b/vncviewer/UserDialog.h
index ddafbc3c..22799fb9 100644
--- a/vncviewer/UserDialog.h
+++ b/vncviewer/UserDialog.h
@@ -19,8 +19,6 @@
#ifndef __USERDIALOG_H__
#define __USERDIALOG_H__
-#include <rfb/CConnection.h>
-
class UserDialog
{
public:
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index d643fa37..653057da 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -25,6 +25,8 @@
#include <stdio.h>
#include <string.h>
+#include <stdexcept>
+
#include <rfb/CMsgWriter.h>
#include <rfb/LogWriter.h>
#include <rfb/ledStates.h>
diff --git a/win/rfb_win32/SocketManager.cxx b/win/rfb_win32/SocketManager.cxx
index 7f6d1773..1ed37e92 100644
--- a/win/rfb_win32/SocketManager.cxx
+++ b/win/rfb_win32/SocketManager.cxx
@@ -27,6 +27,8 @@
#include <rdr/Exception.h>
+#include <rdr/FdOutStream.h>
+
#include <network/Socket.h>
#include <rfb/LogWriter.h>
diff --git a/win/winvnc/VNCServerWin32.cxx b/win/winvnc/VNCServerWin32.cxx
index ee6c60a7..43e536a5 100644
--- a/win/winvnc/VNCServerWin32.cxx
+++ b/win/winvnc/VNCServerWin32.cxx
@@ -35,6 +35,7 @@
#include <rfb/Hostname.h>
#include <rfb/LogWriter.h>
+#include <rfb/SConnection.h>
using namespace rfb;
using namespace win32;