Added a standard -geometry command line option. Such an option is
actually already documented on the man page.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4972 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
index 463adf3..1693ab5 100644
--- a/vncviewer/DesktopWindow.cxx
+++ b/vncviewer/DesktopWindow.cxx
@@ -88,12 +88,42 @@
} else
#endif
{
+
+ int geom_x = 0, geom_y = 0;
+ if (geometry.hasBeenSet()) {
+ int matched;
+ matched = sscanf(geometry.getValueStr(), "+%d+%d", &geom_x, &geom_y);
+ if (matched == 2) {
+ force_position(1);
+ } else {
+ int geom_w, geom_h;
+ matched = sscanf(geometry.getValueStr(), "%dx%d+%d+%d", &geom_w, &geom_h, &geom_x, &geom_y);
+ switch (matched) {
+ case 4:
+ force_position(1);
+ /* fall through */
+ case 2:
+ w = geom_w;
+ h = geom_h;
+ default:
+ vlog.error("Invalid geometry specified!");
+ }
+ }
+ }
+
// If we are creating a window which is equal to the size on the
// screen on X11, many WMs will treat this as a legacy fullscreen
// request. This is not what we want. Besides, it doesn't really
// make sense to try to create a window which is larger than the
// available work space.
- size(__rfbmin(w, Fl::w()), __rfbmin(h, Fl::h()));
+ w = __rfbmin(w, Fl::w());
+ h = __rfbmin(h, Fl::h());
+
+ if (force_position()) {
+ resize(geom_x, geom_y, w, h);
+ } else {
+ size(w, h);
+ }
}
show();