Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright (C) 2011 D. R. Commander. All Rights Reserved.
  3. * Copyright 2009-2014 Pierre Ossman for Cendio AB
  4. *
  5. * This is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This software is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this software; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  18. * USA.
  19. */
  20. #ifdef HAVE_CONFIG_H
  21. #include <config.h>
  22. #endif
  23. #include <assert.h>
  24. #ifndef _WIN32
  25. #include <unistd.h>
  26. #endif
  27. #include <rfb/CMsgWriter.h>
  28. #include <rfb/CSecurity.h>
  29. #include <rfb/Hostname.h>
  30. #include <rfb/LogWriter.h>
  31. #include <rfb/Security.h>
  32. #include <rfb/util.h>
  33. #include <rfb/screenTypes.h>
  34. #include <rfb/fenceTypes.h>
  35. #include <rfb/Timer.h>
  36. #include <rdr/MemInStream.h>
  37. #include <rdr/MemOutStream.h>
  38. #include <network/TcpSocket.h>
  39. #ifndef WIN32
  40. #include <network/UnixSocket.h>
  41. #endif
  42. #include <FL/Fl.H>
  43. #include <FL/fl_ask.H>
  44. #include "CConn.h"
  45. #include "OptionsDialog.h"
  46. #include "DesktopWindow.h"
  47. #include "PlatformPixelBuffer.h"
  48. #include "i18n.h"
  49. #include "parameters.h"
  50. #include "vncviewer.h"
  51. #ifdef WIN32
  52. #include "win32.h"
  53. #endif
  54. using namespace rdr;
  55. using namespace rfb;
  56. using namespace std;
  57. static rfb::LogWriter vlog("CConn");
  58. // 8 colours (1 bit per component)
  59. static const PixelFormat verylowColourPF(8, 3,false, true,
  60. 1, 1, 1, 2, 1, 0);
  61. // 64 colours (2 bits per component)
  62. static const PixelFormat lowColourPF(8, 6, false, true,
  63. 3, 3, 3, 4, 2, 0);
  64. // 256 colours (2-3 bits per component)
  65. static const PixelFormat mediumColourPF(8, 8, false, true,
  66. 7, 7, 3, 5, 2, 0);
  67. CConn::CConn(const char* vncServerName, network::Socket* socket=NULL)
  68. : serverHost(0), serverPort(0), desktop(NULL),
  69. updateCount(0), pixelCount(0), pendingPFChange(false),
  70. currentEncoding(encodingTight), lastServerEncoding((unsigned int)-1),
  71. formatChange(false), encodingChange(false),
  72. firstUpdate(true), pendingUpdate(false), continuousUpdates(false),
  73. forceNonincremental(true), supportsSyncFence(false)
  74. {
  75. setShared(::shared);
  76. sock = socket;
  77. int encNum = encodingNum(preferredEncoding);
  78. if (encNum != -1)
  79. currentEncoding = encNum;
  80. server.supportsLocalCursor = true;
  81. server.supportsDesktopResize = true;
  82. server.supportsExtendedDesktopSize = true;
  83. server.supportsDesktopRename = true;
  84. server.supportsLEDState = true;
  85. if (customCompressLevel)
  86. server.compressLevel = compressLevel;
  87. else
  88. server.compressLevel = -1;
  89. if (!noJpeg)
  90. server.qualityLevel = qualityLevel;
  91. else
  92. server.qualityLevel = -1;
  93. if(sock == NULL) {
  94. try {
  95. #ifndef WIN32
  96. if (strchr(vncServerName, '/') != NULL) {
  97. sock = new network::UnixSocket(vncServerName);
  98. serverHost = sock->getPeerAddress();
  99. vlog.info(_("Connected to socket %s"), serverHost);
  100. } else
  101. #endif
  102. {
  103. getHostAndPort(vncServerName, &serverHost, &serverPort);
  104. sock = new network::TcpSocket(serverHost, serverPort);
  105. vlog.info(_("Connected to host %s port %d"), serverHost, serverPort);
  106. }
  107. } catch (rdr::Exception& e) {
  108. vlog.error("%s", e.str());
  109. if (alertOnFatalError)
  110. fl_alert("%s", e.str());
  111. exit_vncviewer();
  112. return;
  113. }
  114. }
  115. Fl::add_fd(sock->getFd(), FL_READ | FL_EXCEPT, socketEvent, this);
  116. // See callback below
  117. sock->inStream().setBlockCallback(this);
  118. setServerName(serverHost);
  119. setStreams(&sock->inStream(), &sock->outStream());
  120. initialiseProtocol();
  121. OptionsDialog::addCallback(handleOptions, this);
  122. }
  123. CConn::~CConn()
  124. {
  125. OptionsDialog::removeCallback(handleOptions);
  126. Fl::remove_timeout(handleUpdateTimeout, this);
  127. if (desktop)
  128. delete desktop;
  129. delete [] serverHost;
  130. if (sock)
  131. Fl::remove_fd(sock->getFd());
  132. delete sock;
  133. }
  134. void CConn::refreshFramebuffer()
  135. {
  136. forceNonincremental = true;
  137. // Without fences, we cannot safely trigger an update request directly
  138. // but must wait for the next update to arrive.
  139. if (supportsSyncFence)
  140. requestNewUpdate();
  141. }
  142. const char *CConn::connectionInfo()
  143. {
  144. static char infoText[1024] = "";
  145. char scratch[100];
  146. char pfStr[100];
  147. // Crude way of avoiding constant overflow checks
  148. assert((sizeof(scratch) + 1) * 10 < sizeof(infoText));
  149. infoText[0] = '\0';
  150. snprintf(scratch, sizeof(scratch),
  151. _("Desktop name: %.80s"), server.name());
  152. strcat(infoText, scratch);
  153. strcat(infoText, "\n");
  154. snprintf(scratch, sizeof(scratch),
  155. _("Host: %.80s port: %d"), serverHost, serverPort);
  156. strcat(infoText, scratch);
  157. strcat(infoText, "\n");
  158. snprintf(scratch, sizeof(scratch),
  159. _("Size: %d x %d"), server.width(), server.height());
  160. strcat(infoText, scratch);
  161. strcat(infoText, "\n");
  162. // TRANSLATORS: Will be filled in with a string describing the
  163. // protocol pixel format in a fairly language neutral way
  164. server.pf().print(pfStr, 100);
  165. snprintf(scratch, sizeof(scratch),
  166. _("Pixel format: %s"), pfStr);
  167. strcat(infoText, scratch);
  168. strcat(infoText, "\n");
  169. // TRANSLATORS: Similar to the earlier "Pixel format" string
  170. serverPF.print(pfStr, 100);
  171. snprintf(scratch, sizeof(scratch),
  172. _("(server default %s)"), pfStr);
  173. strcat(infoText, scratch);
  174. strcat(infoText, "\n");
  175. snprintf(scratch, sizeof(scratch),
  176. _("Requested encoding: %s"), encodingName(currentEncoding));
  177. strcat(infoText, scratch);
  178. strcat(infoText, "\n");
  179. snprintf(scratch, sizeof(scratch),
  180. _("Last used encoding: %s"), encodingName(lastServerEncoding));
  181. strcat(infoText, scratch);
  182. strcat(infoText, "\n");
  183. snprintf(scratch, sizeof(scratch),
  184. _("Line speed estimate: %d kbit/s"), sock->inStream().kbitsPerSecond());
  185. strcat(infoText, scratch);
  186. strcat(infoText, "\n");
  187. snprintf(scratch, sizeof(scratch),
  188. _("Protocol version: %d.%d"), server.majorVersion, server.minorVersion);
  189. strcat(infoText, scratch);
  190. strcat(infoText, "\n");
  191. snprintf(scratch, sizeof(scratch),
  192. _("Security method: %s"), secTypeName(csecurity->getType()));
  193. strcat(infoText, scratch);
  194. strcat(infoText, "\n");
  195. return infoText;
  196. }
  197. unsigned CConn::getUpdateCount()
  198. {
  199. return updateCount;
  200. }
  201. unsigned CConn::getPixelCount()
  202. {
  203. return pixelCount;
  204. }
  205. unsigned CConn::getPosition()
  206. {
  207. return sock->inStream().pos();
  208. }
  209. // The RFB core is not properly asynchronous, so it calls this callback
  210. // whenever it needs to block to wait for more data. Since FLTK is
  211. // monitoring the socket, we just make sure FLTK gets to run.
  212. void CConn::blockCallback()
  213. {
  214. run_mainloop();
  215. if (should_exit())
  216. throw rdr::Exception("Termination requested");
  217. }
  218. void CConn::socketEvent(FL_SOCKET fd, void *data)
  219. {
  220. CConn *cc;
  221. static bool recursing = false;
  222. assert(data);
  223. cc = (CConn*)data;
  224. // I don't think processMsg() is recursion safe, so add this check
  225. if (recursing)
  226. return;
  227. recursing = true;
  228. try {
  229. // processMsg() only processes one message, so we need to loop
  230. // until the buffers are empty or things will stall.
  231. do {
  232. cc->processMsg();
  233. // Make sure that the FLTK handling and the timers gets some CPU
  234. // time in case of back to back messages
  235. Fl::check();
  236. Timer::checkTimeouts();
  237. // Also check if we need to stop reading and terminate
  238. if (should_exit())
  239. break;
  240. } while (cc->sock->inStream().checkNoWait(1));
  241. } catch (rdr::EndOfStream& e) {
  242. vlog.info("%s", e.str());
  243. exit_vncviewer();
  244. } catch (rdr::Exception& e) {
  245. vlog.error("%s", e.str());
  246. // Somebody might already have requested us to terminate, and
  247. // might have already provided an error message.
  248. if (!should_exit())
  249. exit_vncviewer(e.str());
  250. }
  251. recursing = false;
  252. }
  253. ////////////////////// CConnection callback methods //////////////////////
  254. // serverInit() is called when the serverInit message has been received. At
  255. // this point we create the desktop window and display it. We also tell the
  256. // server the pixel format and encodings to use and request the first update.
  257. void CConn::serverInit()
  258. {
  259. CConnection::serverInit();
  260. // If using AutoSelect with old servers, start in FullColor
  261. // mode. See comment in autoSelectFormatAndEncoding.
  262. if (server.beforeVersion(3, 8) && autoSelect)
  263. fullColour.setParam(true);
  264. serverPF = server.pf();
  265. desktop = new DesktopWindow(server.width(), server.height(),
  266. server.name(), serverPF, this);
  267. fullColourPF = desktop->getPreferredPF();
  268. // Force a switch to the format and encoding we'd like
  269. formatChange = encodingChange = true;
  270. // And kick off the update cycle
  271. requestNewUpdate();
  272. // This initial update request is a bit of a corner case, so we need
  273. // to help out setting the correct format here.
  274. assert(pendingPFChange);
  275. server.setPF(pendingPF);
  276. pendingPFChange = false;
  277. }
  278. // setDesktopSize() is called when the desktop size changes (including when
  279. // it is set initially).
  280. void CConn::setDesktopSize(int w, int h)
  281. {
  282. CConnection::setDesktopSize(w,h);
  283. resizeFramebuffer();
  284. }
  285. // setExtendedDesktopSize() is a more advanced version of setDesktopSize()
  286. void CConn::setExtendedDesktopSize(unsigned reason, unsigned result,
  287. int w, int h, const rfb::ScreenSet& layout)
  288. {
  289. CConnection::setExtendedDesktopSize(reason, result, w, h, layout);
  290. if ((reason == reasonClient) && (result != resultSuccess)) {
  291. vlog.error(_("SetDesktopSize failed: %d"), result);
  292. return;
  293. }
  294. resizeFramebuffer();
  295. }
  296. // setName() is called when the desktop name changes
  297. void CConn::setName(const char* name)
  298. {
  299. CConnection::setName(name);
  300. if (desktop)
  301. desktop->setName(name);
  302. }
  303. // framebufferUpdateStart() is called at the beginning of an update.
  304. // Here we try to send out a new framebuffer update request so that the
  305. // next update can be sent out in parallel with us decoding the current
  306. // one.
  307. void CConn::framebufferUpdateStart()
  308. {
  309. CConnection::framebufferUpdateStart();
  310. // Note: This might not be true if sync fences are supported
  311. pendingUpdate = false;
  312. requestNewUpdate();
  313. // Update the screen prematurely for very slow updates
  314. Fl::add_timeout(1.0, handleUpdateTimeout, this);
  315. }
  316. // framebufferUpdateEnd() is called at the end of an update.
  317. // For each rectangle, the FdInStream will have timed the speed
  318. // of the connection, allowing us to select format and encoding
  319. // appropriately, and then request another incremental update.
  320. void CConn::framebufferUpdateEnd()
  321. {
  322. CConnection::framebufferUpdateEnd();
  323. updateCount++;
  324. Fl::remove_timeout(handleUpdateTimeout, this);
  325. desktop->updateWindow();
  326. if (firstUpdate) {
  327. // We need fences to make extra update requests and continuous
  328. // updates "safe". See fence() for the next step.
  329. if (server.supportsFence)
  330. writer()->writeFence(fenceFlagRequest | fenceFlagSyncNext, 0, NULL);
  331. firstUpdate = false;
  332. }
  333. // A format change has been scheduled and we are now past the update
  334. // with the old format. Time to active the new one.
  335. if (pendingPFChange) {
  336. server.setPF(pendingPF);
  337. pendingPFChange = false;
  338. }
  339. // Compute new settings based on updated bandwidth values
  340. if (autoSelect)
  341. autoSelectFormatAndEncoding();
  342. }
  343. // The rest of the callbacks are fairly self-explanatory...
  344. void CConn::setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs)
  345. {
  346. vlog.error(_("Invalid SetColourMapEntries from server!"));
  347. }
  348. void CConn::bell()
  349. {
  350. fl_beep();
  351. }
  352. void CConn::serverCutText(const char* str, rdr::U32 len)
  353. {
  354. desktop->serverCutText(str, len);
  355. }
  356. void CConn::dataRect(const Rect& r, int encoding)
  357. {
  358. sock->inStream().startTiming();
  359. if (encoding != encodingCopyRect)
  360. lastServerEncoding = encoding;
  361. CConnection::dataRect(r, encoding);
  362. sock->inStream().stopTiming();
  363. pixelCount += r.area();
  364. }
  365. void CConn::setCursor(int width, int height, const Point& hotspot,
  366. const rdr::U8* data)
  367. {
  368. desktop->setCursor(width, height, hotspot, data);
  369. }
  370. void CConn::fence(rdr::U32 flags, unsigned len, const char data[])
  371. {
  372. CMsgHandler::fence(flags, len, data);
  373. if (flags & fenceFlagRequest) {
  374. // We handle everything synchronously so we trivially honor these modes
  375. flags = flags & (fenceFlagBlockBefore | fenceFlagBlockAfter);
  376. writer()->writeFence(flags, len, data);
  377. return;
  378. }
  379. if (len == 0) {
  380. // Initial probe
  381. if (flags & fenceFlagSyncNext) {
  382. supportsSyncFence = true;
  383. if (server.supportsContinuousUpdates) {
  384. vlog.info(_("Enabling continuous updates"));
  385. continuousUpdates = true;
  386. writer()->writeEnableContinuousUpdates(true, 0, 0,
  387. server.width(),
  388. server.height());
  389. }
  390. }
  391. } else {
  392. // Pixel format change
  393. rdr::MemInStream memStream(data, len);
  394. PixelFormat pf;
  395. pf.read(&memStream);
  396. server.setPF(pf);
  397. }
  398. }
  399. void CConn::setLEDState(unsigned int state)
  400. {
  401. CConnection::setLEDState(state);
  402. desktop->setLEDState(state);
  403. }
  404. ////////////////////// Internal methods //////////////////////
  405. void CConn::resizeFramebuffer()
  406. {
  407. if (!desktop)
  408. return;
  409. if (continuousUpdates)
  410. writer()->writeEnableContinuousUpdates(true, 0, 0,
  411. server.width(),
  412. server.height());
  413. desktop->resizeFramebuffer(server.width(), server.height());
  414. }
  415. // autoSelectFormatAndEncoding() chooses the format and encoding appropriate
  416. // to the connection speed:
  417. //
  418. // First we wait for at least one second of bandwidth measurement.
  419. //
  420. // Above 16Mbps (i.e. LAN), we choose the second highest JPEG quality,
  421. // which should be perceptually lossless.
  422. //
  423. // If the bandwidth is below that, we choose a more lossy JPEG quality.
  424. //
  425. // If the bandwidth drops below 256 Kbps, we switch to palette mode.
  426. //
  427. // Note: The system here is fairly arbitrary and should be replaced
  428. // with something more intelligent at the server end.
  429. //
  430. void CConn::autoSelectFormatAndEncoding()
  431. {
  432. int kbitsPerSecond = sock->inStream().kbitsPerSecond();
  433. unsigned int timeWaited = sock->inStream().timeWaited();
  434. bool newFullColour = fullColour;
  435. int newQualityLevel = qualityLevel;
  436. // Always use Tight
  437. if (currentEncoding != encodingTight) {
  438. currentEncoding = encodingTight;
  439. encodingChange = true;
  440. }
  441. // Check that we have a decent bandwidth measurement
  442. if ((kbitsPerSecond == 0) || (timeWaited < 10000))
  443. return;
  444. // Select appropriate quality level
  445. if (!noJpeg) {
  446. if (kbitsPerSecond > 16000)
  447. newQualityLevel = 8;
  448. else
  449. newQualityLevel = 6;
  450. if (newQualityLevel != qualityLevel) {
  451. vlog.info(_("Throughput %d kbit/s - changing to quality %d"),
  452. kbitsPerSecond, newQualityLevel);
  453. server.qualityLevel = newQualityLevel;
  454. qualityLevel.setParam(newQualityLevel);
  455. encodingChange = true;
  456. }
  457. }
  458. if (server.beforeVersion(3, 8)) {
  459. // Xvnc from TightVNC 1.2.9 sends out FramebufferUpdates with
  460. // cursors "asynchronously". If this happens in the middle of a
  461. // pixel format change, the server will encode the cursor with
  462. // the old format, but the client will try to decode it
  463. // according to the new format. This will lead to a
  464. // crash. Therefore, we do not allow automatic format change for
  465. // old servers.
  466. return;
  467. }
  468. // Select best color level
  469. newFullColour = (kbitsPerSecond > 256);
  470. if (newFullColour != fullColour) {
  471. if (newFullColour)
  472. vlog.info(_("Throughput %d kbit/s - full color is now enabled"),
  473. kbitsPerSecond);
  474. else
  475. vlog.info(_("Throughput %d kbit/s - full color is now disabled"),
  476. kbitsPerSecond);
  477. fullColour.setParam(newFullColour);
  478. formatChange = true;
  479. }
  480. }
  481. // checkEncodings() sends a setEncodings message if one is needed.
  482. void CConn::checkEncodings()
  483. {
  484. if (encodingChange && writer()) {
  485. vlog.info(_("Using %s encoding"),encodingName(currentEncoding));
  486. writer()->writeSetEncodings(currentEncoding, true);
  487. encodingChange = false;
  488. }
  489. }
  490. // requestNewUpdate() requests an update from the server, having set the
  491. // format and encoding appropriately.
  492. void CConn::requestNewUpdate()
  493. {
  494. if (formatChange) {
  495. PixelFormat pf;
  496. /* Catch incorrect requestNewUpdate calls */
  497. assert(!pendingUpdate || supportsSyncFence);
  498. if (fullColour) {
  499. pf = fullColourPF;
  500. } else {
  501. if (lowColourLevel == 0)
  502. pf = verylowColourPF;
  503. else if (lowColourLevel == 1)
  504. pf = lowColourPF;
  505. else
  506. pf = mediumColourPF;
  507. }
  508. if (supportsSyncFence) {
  509. // We let the fence carry the pixel format and switch once we
  510. // get the response back. That way we will be synchronised with
  511. // when the server switches.
  512. rdr::MemOutStream memStream;
  513. pf.write(&memStream);
  514. writer()->writeFence(fenceFlagRequest | fenceFlagSyncNext,
  515. memStream.length(), (const char*)memStream.data());
  516. } else {
  517. // New requests are sent out at the start of processing the last
  518. // one, so we cannot switch our internal format right now (doing so
  519. // would mean misdecoding the current update).
  520. pendingPFChange = true;
  521. pendingPF = pf;
  522. }
  523. char str[256];
  524. pf.print(str, 256);
  525. vlog.info(_("Using pixel format %s"),str);
  526. writer()->writeSetPixelFormat(pf);
  527. formatChange = false;
  528. }
  529. checkEncodings();
  530. if (forceNonincremental || !continuousUpdates) {
  531. pendingUpdate = true;
  532. writer()->writeFramebufferUpdateRequest(Rect(0, 0,
  533. server.width(),
  534. server.height()),
  535. !forceNonincremental);
  536. }
  537. forceNonincremental = false;
  538. }
  539. void CConn::handleOptions(void *data)
  540. {
  541. CConn *self = (CConn*)data;
  542. // Checking all the details of the current set of encodings is just
  543. // a pain. Assume something has changed, as resending the encoding
  544. // list is cheap. Avoid overriding what the auto logic has selected
  545. // though.
  546. if (!autoSelect) {
  547. int encNum = encodingNum(preferredEncoding);
  548. if (encNum != -1)
  549. self->currentEncoding = encNum;
  550. }
  551. self->server.supportsLocalCursor = true;
  552. if (customCompressLevel)
  553. self->server.compressLevel = compressLevel;
  554. else
  555. self->server.compressLevel = -1;
  556. if (!noJpeg && !autoSelect)
  557. self->server.qualityLevel = qualityLevel;
  558. else
  559. self->server.qualityLevel = -1;
  560. self->encodingChange = true;
  561. // Format changes refreshes the entire screen though and are therefore
  562. // very costly. It's probably worth the effort to see if it is necessary
  563. // here.
  564. PixelFormat pf;
  565. if (fullColour) {
  566. pf = self->fullColourPF;
  567. } else {
  568. if (lowColourLevel == 0)
  569. pf = verylowColourPF;
  570. else if (lowColourLevel == 1)
  571. pf = lowColourPF;
  572. else
  573. pf = mediumColourPF;
  574. }
  575. if (!pf.equal(self->server.pf())) {
  576. self->formatChange = true;
  577. // Without fences, we cannot safely trigger an update request directly
  578. // but must wait for the next update to arrive.
  579. if (self->supportsSyncFence)
  580. self->requestNewUpdate();
  581. }
  582. }
  583. void CConn::handleUpdateTimeout(void *data)
  584. {
  585. CConn *self = (CConn *)data;
  586. assert(self);
  587. self->desktop->updateWindow();
  588. Fl::repeat_timeout(1.0, handleUpdateTimeout, data);
  589. }