Skip to content

Commit

Permalink
update spawnvncserver
Browse files Browse the repository at this point in the history
  • Loading branch information
gschwind committed Aug 30, 2019
1 parent c384803 commit 9fde081
Showing 1 changed file with 31 additions and 21 deletions.
52 changes: 31 additions & 21 deletions unix/spawnvncserver/spawnvncserver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <errno.h>
#include <rfb/Logger_stdio.h>
#include <rfb/LogWriter.h>
#include <rfb/VNCServerST.h>
#include <rfb/VNCServerSpawnX.h>
#include <rfb/Configuration.h>
#include <rfb/Timer.h>
#include <network/TcpSocket.h>
Expand Down Expand Up @@ -175,6 +175,16 @@ class FileTcpFilter : public TcpFilter

};

struct VNCServerSpawnXS : public VNCServerSpawnXBase
{
VNCServerSpawnXS(const char* name_) : VNCServerSpawnXBase(name_) { }

virtual SDesktop * create_sdesktop() override {
return nullptr; // TODO;
// return new XDesktop();
}
};

char* programName;

static void printVersion(FILE *fp)
Expand Down Expand Up @@ -232,13 +242,13 @@ int main(int argc, char** argv)
usage();
}

CharArray dpyStr(displayname.getData());
if (!(dpy = XOpenDisplay(dpyStr.buf[0] ? dpyStr.buf : 0))) {
// FIXME: Why not vlog.error(...)?
fprintf(stderr,"%s: unable to open display \"%s\"\r\n",
programName, XDisplayName(dpyStr.buf));
exit(1);
}
// CharArray dpyStr(displayname.getData());
// if (!(dpy = XOpenDisplay(dpyStr.buf[0] ? dpyStr.buf : 0))) {
// // FIXME: Why not vlog.error(...)?
// fprintf(stderr,"%s: unable to open display \"%s\"\r\n",
// programName, XDisplayName(dpyStr.buf));
// exit(1);
// }

signal(SIGHUP, CleanupSignalHandler);
signal(SIGINT, CleanupSignalHandler);
Expand All @@ -247,16 +257,16 @@ int main(int argc, char** argv)
std::list<SocketListener*> listeners;

try {
TXWindow::init(dpy,"x0vncserver");
Geometry geo(DisplayWidth(dpy, DefaultScreen(dpy)),
DisplayHeight(dpy, DefaultScreen(dpy)));
if (geo.getRect().is_empty()) {
vlog.error("Exiting with error");
return 1;
}
XDesktop desktop(dpy, &geo);
// TXWindow::init(dpy,"x0vncserver");
// Geometry geo(DisplayWidth(dpy, DefaultScreen(dpy)),
// DisplayHeight(dpy, DefaultScreen(dpy)));
// if (geo.getRect().is_empty()) {
// vlog.error("Exiting with error");
// return 1;
// }
// XDesktop desktop(dpy, &geo);

VNCServerST server("x0vncserver", &desktop);
VNCServerSpawnXS server("x0vncserver");

if (rfbunixpath.getValueStr()[0] != '\0') {
listeners.push_back(new network::UnixListener(rfbunixpath, rfbunixmode));
Expand Down Expand Up @@ -377,10 +387,10 @@ int main(int argc, char** argv)
server.processSocketWriteEvent(*i);
}

if (desktop.isRunning() && sched.goodTimeToPoll()) {
sched.newPass();
desktop.poll();
}
// if (desktop.isRunning() && sched.goodTimeToPoll()) {
// sched.newPass();
// desktop.poll();
// }
}

} catch (rdr::Exception &e) {
Expand Down

0 comments on commit 9fde081

Please sign in to comment.