diff options
author | DRC <dcommander@users.sourceforge.net> | 2011-06-23 22:04:46 +0000 |
---|---|---|
committer | DRC <dcommander@users.sourceforge.net> | 2011-06-23 22:04:46 +0000 |
commit | 5aa0650322b2b898d1699a0bb2c4cc7696e01b7e (patch) | |
tree | f1e88717875fe72de46760394407d32b7aea5db1 | |
parent | 1b7abb9acf72860e8d550dbc49419316671d96d1 (diff) | |
download | tigervnc-5aa0650322b2b898d1699a0bb2c4cc7696e01b7e.tar.gz tigervnc-5aa0650322b2b898d1699a0bb2c4cc7696e01b7e.zip |
Call Fl::args() to properly parse the "hidden" arguments that FLTK understands. This has two primary benefits: (1) On X11 systems, you can now override the X display by passing '-display {display}' as the first argument, as is the case for most other X11 apps, and (2) on OS X, this allows the application to run within an application (.app) bundle, because Fl::args() parses the hidden arguments passed to the app by the launcher.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4525 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r-- | vncviewer/vncviewer.cxx | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index aa742ce2..b9e8ab56 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -1,5 +1,6 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. * Copyright 2011 Pierre Ossman <ossman@cendio.se> for Cendio AB + * Copyright (C) 2011 D. R. Commander * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -214,22 +215,24 @@ int main(int argc, char** argv) Configuration::enableViewerParams(); - for (int i = 1; i < argc; i++) { - if (Configuration::setParam(argv[i])) - continue; - - if (argv[i][0] == '-') { - if (i+1 < argc) { - if (Configuration::setParam(&argv[i][1], argv[i+1])) { - i++; - continue; + int i = 1; + if (!Fl::args(argc, argv, i) || i < argc) + for (; i < argc; i++) { + if (Configuration::setParam(argv[i])) + continue; + + if (argv[i][0] == '-') { + if (i+1 < argc) { + if (Configuration::setParam(&argv[i][1], argv[i+1])) { + i++; + continue; + } } + usage(argv[0]); } - usage(argv[0]); - } - vncServerName = argv[i]; - } + vncServerName = argv[i]; + } if (!::autoSelect.hasBeenSet()) { // Default to AutoSelect=0 if -PreferredEncoding or -FullColor is used |