void CSecondaryScreen::remoteControl() { // assume primary has all clipboards for (ClipboardID id = 0; id < kClipboardEnd; ++id) { grabClipboard(id); } // update keyboard state updateKeys(); // now remote ready. fake being active for call to leave(). bool screenSaverSync; { CLock lock(&m_mutex); m_remoteReady = true; m_active = true; // copy screen saver synchronization state screenSaverSync = m_screenSaverSync; } // disable the screen saver if synchronization is enabled if (screenSaverSync) { getScreen()->openScreensaver(false); } // hide the cursor leave(); }
void Screen::enableSecondary() { // assume primary has all clipboards for (ClipboardID id = 0; id < kClipboardEnd; ++id) { grabClipboard(id); } // disable the screen saver if synchronization is enabled if (m_screenSaverSync) { m_screen->openScreensaver(false); } }
ServerProxy::EResult ServerProxy::parseMessage(const UInt8* code) { if (memcmp(code, kMsgDMouseMove, 4) == 0) { mouseMove(); } else if (memcmp(code, kMsgDMouseRelMove, 4) == 0) { mouseRelativeMove(); } else if (memcmp(code, kMsgDMouseWheel, 4) == 0) { mouseWheel(); } else if (memcmp(code, kMsgDKeyDown, 4) == 0) { keyDown(); } else if (memcmp(code, kMsgDKeyUp, 4) == 0) { keyUp(); } else if (memcmp(code, kMsgDMouseDown, 4) == 0) { mouseDown(); } else if (memcmp(code, kMsgDMouseUp, 4) == 0) { mouseUp(); } else if (memcmp(code, kMsgDKeyRepeat, 4) == 0) { keyRepeat(); } else if (memcmp(code, kMsgCKeepAlive, 4) == 0) { // echo keep alives and reset alarm ProtocolUtil::writef(m_stream, kMsgCKeepAlive); resetKeepAliveAlarm(); } else if (memcmp(code, kMsgCNoop, 4) == 0) { // accept and discard no-op } else if (memcmp(code, kMsgCEnter, 4) == 0) { enter(); } else if (memcmp(code, kMsgCLeave, 4) == 0) { leave(); } else if (memcmp(code, kMsgCClipboard, 4) == 0) { grabClipboard(); } else if (memcmp(code, kMsgCScreenSaver, 4) == 0) { screensaver(); } else if (memcmp(code, kMsgQInfo, 4) == 0) { queryInfo(); } else if (memcmp(code, kMsgCInfoAck, 4) == 0) { infoAcknowledgment(); } else if (memcmp(code, kMsgDClipboard, 4) == 0) { setClipboard(); } else if (memcmp(code, kMsgCResetOptions, 4) == 0) { resetOptions(); } else if (memcmp(code, kMsgDSetOptions, 4) == 0) { setOptions(); } else if (memcmp(code, kMsgDFileTransfer, 4) == 0) { fileChunkReceived(); } else if (memcmp(code, kMsgDDragInfo, 4) == 0) { dragInfoReceived(); } else if (memcmp(code, kMsgCClose, 4) == 0) { // server wants us to hangup LOG((CLOG_DEBUG1 "recv close")); m_client->disconnect(NULL); return kDisconnect; } else if (memcmp(code, kMsgEBad, 4) == 0) { LOG((CLOG_ERR "server disconnected due to a protocol error")); m_client->disconnect("server reported a protocol error"); return kDisconnect; } else { return kUnknown; } // send a reply. this is intended to work around a delay when // running a linux server and an OS X (any BSD?) client. the // client waits to send an ACK (if the system control flag // net.inet.tcp.delayed_ack is 1) in hopes of piggybacking it // on a data packet. we provide that packet here. i don't // know why a delayed ACK should cause the server to wait since // TCP_NODELAY is enabled. ProtocolUtil::writef(m_stream, kMsgCNoop); return kOkay; }