Code improvements and better error checking in the Geometry class:
coordinates are now kept as a Rect, added new getRect() method. Also, when
the "Geometry" parameter is present but not valid, the constructor will not
set the geometry to full screen, zero-size rectangle will be used instead.
In that case, x0vncserver will exit with error.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2573 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/x0vncserver/x0vncserver.cxx b/unix/x0vncserver/x0vncserver.cxx
index f2ff430..5016d12 100644
--- a/unix/x0vncserver/x0vncserver.cxx
+++ b/unix/x0vncserver/x0vncserver.cxx
@@ -438,6 +438,10 @@
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);