inProcessMessages(false),
pendingSyncFence(false), syncFence(false), fenceFlags(0),
fenceDataLen(0), fenceData(NULL), congestionTimer(this),
- losslessTimer(this), server(server_), updates(false),
+ losslessTimer(this), server(server_),
updateRenderedCursor(false), removeRenderedCursor(false),
- continuousUpdates(false), encodeManager(this), pointerEventTime(0),
- clientHasCursor(false),
- accessRights(AccessDefault), startTime(time(0))
+ continuousUpdates(false), encodeManager(this), idleTimer(this),
+ pointerEventTime(0), clientHasCursor(false)
{
setStreams(&sock->inStream(), &sock->outStream());
peerEndpoint.buf = sock->getPeerEndpoint();
{
try {
if (!authenticated()) return;
- if (cp.width && cp.height &&
- (server->getPixelBuffer()->width() != cp.width ||
- server->getPixelBuffer()->height() != cp.height))
+ if (client.width() && client.height() &&
- (server->pb->width() != client.width() ||
- server->pb->height() != client.height()))
++ (server->getPixelBuffer()->width() != client.width() ||
++ server->getPixelBuffer()->height() != client.height()))
{
// We need to clip the next update to the new size, but also add any
// extra bits if it's bigger. If we wanted to do this exactly, something
//updates.intersect(server->pb->getRect());
//
- //if (server->pb->width() > cp.width)
- // updates.add_changed(Rect(cp.width, 0, server->pb->width(),
+ //if (server->pb->width() > client.width())
+ // updates.add_changed(Rect(client.width(), 0, server->pb->width(),
// server->pb->height()));
- //if (server->pb->height() > cp.height)
- // updates.add_changed(Rect(0, cp.height, cp.width,
+ //if (server->pb->height() > client.height())
+ // updates.add_changed(Rect(0, client.height(), client.width(),
// server->pb->height()));
- damagedCursorRegion.assign_intersect(server->pb->getRect());
+ damagedCursorRegion.assign_intersect(server->getPixelBuffer()->getRect());
- cp.width = server->getPixelBuffer()->width();
- cp.height = server->getPixelBuffer()->height();
- cp.screenLayout = server->getScreenLayout();
- client.setDimensions(server->pb->width(), server->pb->height(),
- server->screenLayout);
++ client.setDimensions(server->getPixelBuffer()->width(),
++ server->getPixelBuffer()->height(),
++ server->getScreenLayout());
if (state() == RFBSTATE_NORMAL) {
- // We should only send EDS to client asking for both
- if (!writer()->writeExtendedDesktopSize()) {
- if (!writer()->writeSetDesktopSize()) {
- close("Client does not support desktop resize");
- return;
- }
+ if (!client.supportsDesktopSize()) {
+ close("Client does not support desktop resize");
+ return;
}
+ writer()->writeDesktopSize(reasonServer);
}
// Drop any lossy tracking that is now outside the framebuffer
if (state() != RFBSTATE_NORMAL)
return false;
- if (!cp.supportsLocalCursorWithAlpha &&
- !cp.supportsLocalCursor && !cp.supportsLocalXCursor)
+ if (!client.supportsLocalCursor())
return true;
- if (!server->cursorPos.equals(pointerEventPos) &&
+ if (!server->getCursorPos().equals(pointerEventPos) &&
(time(0) - pointerEventTime) > 0)
return true;
void VNCSConnectionST::authSuccess()
{
- lastEventTime = time(0);
-
- server->startDesktop();
+ if (rfb::Server::idleTimeout)
+ idleTimer.start(secsToMillis(rfb::Server::idleTimeout));
// - Set the connection parameters appropriately
- cp.width = server->getPixelBuffer()->width();
- cp.height = server->getPixelBuffer()->height();
- cp.screenLayout = server->getScreenLayout();
- cp.setName(server->getName());
- cp.setLEDState(server->getLEDState());
- client.setDimensions(server->pb->width(), server->pb->height(),
- server->screenLayout);
++ client.setDimensions(server->getPixelBuffer()->width(),
++ server->getPixelBuffer()->height(),
++ server->getScreenLayout());
+ client.setName(server->getName());
- client.setLEDState(server->ledState);
++ client.setLEDState(server->getLEDState());
// - Set the default pixel format
- cp.setPF(server->getPixelBuffer()->getPF());
- client.setPF(server->pb->getPF());
++ client.setPF(server->getPixelBuffer()->getPF());
char buffer[256];
- cp.pf().print(buffer, 256);
+ client.pf().print(buffer, 256);
vlog.info("Server default pixel format %s", buffer);
// - Mark the entire display as "dirty"
{
unsigned int result;
- if (!(accessRights & AccessSetDesktopSize)) return;
+ if (!accessCheck(AccessSetDesktopSize)) return;
if (!rfb::Server::acceptSetDesktopSize) return;
- // Don't bother the desktop with an invalid configuration
- if (!layout.validate(fb_width, fb_height)) {
- writer()->writeDesktopSize(reasonClient, resultInvalid);
- return;
- }
-
- // FIXME: the desktop will call back to VNCServerST and an extra set
- // of ExtendedDesktopSize messages will be sent. This is okay
- // protocol-wise, but unnecessary.
- result = server->desktop->setScreenLayout(fb_width, fb_height, layout);
-
+ result = server->setDesktopSize(this, fb_width, fb_height, layout);
- writer()->writeExtendedDesktopSize(reasonClient, result,
- fb_width, fb_height, layout);
+ writer()->writeDesktopSize(reasonClient, result);
-
- // Only notify other clients on success
- if (result == resultSuccess) {
- if (server->screenLayout != layout)
- throw Exception("Desktop configured a different screen layout than requested");
- server->notifyScreenLayoutChange(this);
- }
}
void VNCSConnectionST::fence(rdr::U32 flags, unsigned len, const char data[])
if (!authenticated())
return;
- cp.screenLayout = server->getScreenLayout();
+ client.setDimensions(client.width(), client.height(),
- server->screenLayout);
++ server->getScreenLayout());
if (state() != RFBSTATE_NORMAL)
return;
// We need to blank out the client's cursor or there will be two
if (needRenderedCursor()) {
- cp.setCursor(emptyCursor);
+ client.setCursor(emptyCursor);
clientHasCursor = false;
} else {
- cp.setCursor(*server->getCursor());
- client.setCursor(*server->cursor);
++ client.setCursor(*server->getCursor());
clientHasCursor = true;
}