aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb/ServerParams.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'common/rfb/ServerParams.cxx')
-rw-r--r--common/rfb/ServerParams.cxx31
1 files changed, 25 insertions, 6 deletions
diff --git a/common/rfb/ServerParams.cxx b/common/rfb/ServerParams.cxx
index b7432b8f..4b8f6136 100644
--- a/common/rfb/ServerParams.cxx
+++ b/common/rfb/ServerParams.cxx
@@ -24,12 +24,18 @@
#include <stdexcept>
+#include <core/LogWriter.h>
+#include <core/string.h>
+
#include <rfb/ledStates.h>
+#include <rfb/Cursor.h>
+#include <rfb/ScreenSet.h>
#include <rfb/ServerParams.h>
-#include <rfb/util.h>
using namespace rfb;
+static core::LogWriter vlog("ServerParams");
+
ServerParams::ServerParams()
: majorVersion(0), minorVersion(0),
supportsQEMUKeyEvent(false),
@@ -40,7 +46,11 @@ ServerParams::ServerParams()
{
setName("");
- cursor_ = new Cursor(0, 0, Point(), nullptr);
+ screenLayout_ = new ScreenSet();
+
+ pf_ = new PixelFormat();
+
+ cursor_ = new Cursor(0, 0, {}, nullptr);
clipFlags = 0;
memset(clipSizes, 0, sizeof(clipSizes));
@@ -60,17 +70,25 @@ void ServerParams::setDimensions(int width, int height)
void ServerParams::setDimensions(int width, int height, const ScreenSet& layout)
{
- if (!layout.validate(width, height))
+ if (!layout.validate(width, height)) {
+ char buffer[2048];
+ vlog.debug("Invalid screen layout for %dx%d:", width, height);
+ layout.print(buffer, sizeof(buffer));
+ vlog.debug("%s", buffer);
+
throw std::invalid_argument("Attempted to configure an invalid screen 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?");
@@ -101,7 +119,8 @@ uint32_t ServerParams::clipboardSize(unsigned int format) const
return clipSizes[i];
}
- throw std::invalid_argument(rfb::format("Invalid clipboard format 0x%x", format));
+ throw std::invalid_argument(
+ core::format("Invalid clipboard format 0x%x", format));
}
void ServerParams::setClipboardCaps(uint32_t flags, const uint32_t* lengths)