CConn::CConn()
: window(0), sameMachine(false), encodingChange(false), formatChange(false),
lastUsedEncoding_(encodingRaw), sock(0), sockEvent(CreateEvent(0, TRUE, FALSE, 0)),
- reverseConnection(false), requestUpdate(false), isClosed_(false) {
+ reverseConnection(false), requestUpdate(false), firstUpdate(true),
+ isClosed_(false) {
}
CConn::~CConn() {
// - Set optional features in ConnParams
cp.supportsLocalCursor = options.useLocalCursor;
cp.supportsDesktopResize = options.useDesktopResize;
+ cp.supportsExtendedDesktopSize = options.useDesktopResize;
cp.supportsDesktopRename = true;
cp.customCompressLevel = options.customCompressLevel;
cp.compressLevel = options.compressLevel;
CConnection::setDesktopSize(w, h);
}
+
+void
+CConn::setExtendedDesktopSize(int reason, int result, int w, int h,
+ const rfb::ScreenSet& layout) {
+ if ((reason == reasonClient) && (result != resultSuccess)) {
+ vlog.error("SetDesktopSize failed: %d", result);
+ return;
+ }
+
+ // Resize the window's buffer
+ if (window)
+ window->setSize(w, h);
+
+ // Tell the underlying CConnection
+ CConnection::setExtendedDesktopSize(reason, result, w, h, layout);
+}
+
+
void
CConn::setCursor(int w, int h, const Point& hotspot, void* data, void* mask) {
if (!options.useLocalCursor) return;
}
debugRects.clear();
}
+
+ if (firstUpdate) {
+ int width, height;
+
+ if (cp.supportsSetDesktopSize &&
+ sscanf(options.desktopSize.buf, "%dx%d", &width, &height) == 2) {
+ ScreenSet layout;
+
+ layout = cp.screenLayout;
+
+ if (layout.num_screens() == 0)
+ layout.add_screen(rfb::Screen());
+ else if (layout.num_screens() != 1) {
+ ScreenSet::iterator iter;
+
+ while (true) {
+ iter = layout.begin();
+ ++iter;
+
+ if (iter == layout.end())
+ break;
+
+ layout.remove_screen(iter->id);
+ }
+ }
+
+ layout.begin()->dimensions.tl.x = 0;
+ layout.begin()->dimensions.tl.y = 0;
+ layout.begin()->dimensions.br.x = width;
+ layout.begin()->dimensions.br.y = height;
+
+ writer()->writeSetDesktopSize(width, height, layout);
+ }
+
+ firstUpdate = false;
+ }
+
if (options.autoSelect)
autoSelectFormatAndEncoding();
void bell();
void framebufferUpdateEnd();
void setDesktopSize(int w, int h);
+ void setExtendedDesktopSize(int reason, int result, int w, int h,
+ const rfb::ScreenSet& layout);
void setCursor(int w, int h, const Point& hotspot, void* data, void* mask);
void setName(const char* name);
void serverInit();
Handle sockEvent;
bool reverseConnection;
bool requestUpdate;
+ bool firstUpdate;
// Debugging/logging
std::list<Rect> debugRects;
"(Default is to disconnect all other clients)",
false);
+StringParameter desktopSize("DesktopSize",
+ "Reconfigure desktop size on the server on "
+ "connect (if possible)", "");
+
static BoolParameter sendPtrEvents("SendPointerEvents",
"Send pointer (mouse) events to the server.", true);
static BoolParameter sendKeyEvents("SendKeyEvents",
preferredEncoding(encodingTight),
autoSelect(::autoSelect),
shared(::sharedConnection),
+desktopSize(::desktopSize.getData()),
sendPtrEvents(::sendPtrEvents),
sendKeyEvents(::sendKeyEvents),
showToolbar(::showToolbar),