aboutsummaryrefslogtreecommitdiffstats
path: root/unix/x0vncserver
diff options
context:
space:
mode:
Diffstat (limited to 'unix/x0vncserver')
-rw-r--r--unix/x0vncserver/XDesktop.cxx10
-rw-r--r--unix/x0vncserver/XDesktop.h3
-rw-r--r--unix/x0vncserver/x0vncserver.cxx7
3 files changed, 13 insertions, 7 deletions
diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx
index da298d35..55ea9667 100644
--- a/unix/x0vncserver/XDesktop.cxx
+++ b/unix/x0vncserver/XDesktop.cxx
@@ -232,9 +232,13 @@ void XDesktop::poll() {
}
}
+void XDesktop::init(VNCServer* vs)
+{
+ server = vs;
+}
-void XDesktop::start(VNCServer* vs) {
-
+void XDesktop::start()
+{
// Determine actual number of buttons of the X pointer device.
unsigned char btnMap[8];
int numButtons = XGetPointerMapping(dpy, btnMap, 8);
@@ -249,7 +253,6 @@ void XDesktop::start(VNCServer* vs) {
pb = new XPixelBuffer(dpy, factory, geometry->getRect());
vlog.info("Allocated %s", pb->getImage()->classDesc());
- server = vs;
server->setPixelBuffer(pb, computeScreenLayout());
#ifdef HAVE_XDAMAGE
@@ -292,7 +295,6 @@ void XDesktop::stop() {
queryConnectDialog = 0;
server->setPixelBuffer(0);
- server = 0;
delete pb;
pb = 0;
diff --git a/unix/x0vncserver/XDesktop.h b/unix/x0vncserver/XDesktop.h
index 1cb73f43..fc230e5b 100644
--- a/unix/x0vncserver/XDesktop.h
+++ b/unix/x0vncserver/XDesktop.h
@@ -47,7 +47,8 @@ public:
virtual ~XDesktop();
void poll();
// -=- SDesktop interface
- virtual void start(rfb::VNCServer* vs);
+ virtual void init(rfb::VNCServer* vs);
+ virtual void start();
virtual void stop();
virtual void terminate();
bool isRunning();
diff --git a/unix/x0vncserver/x0vncserver.cxx b/unix/x0vncserver/x0vncserver.cxx
index 8e27e62b..ffaf5788 100644
--- a/unix/x0vncserver/x0vncserver.cxx
+++ b/unix/x0vncserver/x0vncserver.cxx
@@ -382,7 +382,7 @@ int main(int argc, char** argv)
PollingScheduler sched((int)pollingCycle, (int)maxProcessorUsage);
while (!caughtSignal) {
- int wait_ms;
+ int wait_ms, nextTimeout;
struct timeval tv;
fd_set rfds, wfds;
std::list<Socket*> sockets;
@@ -426,7 +426,10 @@ int main(int argc, char** argv)
}
}
- soonestTimeout(&wait_ms, Timer::checkTimeouts());
+ // Trigger timers and check when the next will expire
+ nextTimeout = Timer::checkTimeouts();
+ if (nextTimeout >= 0 && nextTimeout < wait_ms)
+ wait_ms = nextTimeout;
tv.tv_sec = wait_ms / 1000;
tv.tv_usec = (wait_ms % 1000) * 1000;