Add the -via arguments to config file and GUI for the viewer - #1517
Add the -via arguments to config file and GUI for the viewer#1517dmcmahill wants to merge 2 commits into
-via arguments to config file and GUI for the viewer#1517Conversation
CendioOssman
left a comment
There was a problem hiding this comment.
Nice! This would make this feature more accessible to others. I have some small concerns, though. See the comments.
c34524b to
10ac587
Compare
|
I've reworked the code from this PR into a branch based on the work in #1529. Once that PR merges I'll rebase the branch and resubmit this PR using the new code. In the mean time, my new branch is at https://github.com/dmcmahill/tigervnc/commits/newoptions-via-to-gui |
|
Sounds good. But please don't open a new PR. Simply rebase and force push an update to the PR here. That way we keep all history. |
752eeb3 to
e410f25
Compare
Understood. I went ahead and force pushed the new code that is still rooted in your branch so I'll need to do one more rebase and force push once the other PR merges. But at least this PR now shows what the change will be. Here is the options dialog with the new entry. |
|
One goal of the new layout is to avoid having to increase the size of the options dialog, and instead have scroll bars. My idea was something like this: diff --git a/vncviewer/OptionsDialog.cxx b/vncviewer/OptionsDialog.cxx
index 5550ade7..dd295abe 100644
--- a/vncviewer/OptionsDialog.cxx
+++ b/vncviewer/OptionsDialog.cxx
@@ -53,6 +53,7 @@
#include <FL/Fl_Round_Button.H>
#include <FL/Fl_Int_Input.H>
#include <FL/Fl_Choice.H>
+#include <FL/Fl_Scroll.H>
using namespace std;
using namespace rdr;
@@ -63,7 +64,7 @@ std::map<OptionsCallback*, void*> OptionsDialog::callbacks;
static std::set<OptionsDialog *> instances;
OptionsDialog::OptionsDialog()
- : Fl_Window(580, 480, _("TigerVNC Options"))
+ : Fl_Window(580, 420, _("TigerVNC Options"))
{
int x, y;
Fl_Button *button;
@@ -668,7 +669,9 @@ void OptionsDialog::createCompressionPage(int tx, int ty, int tw, int th)
void OptionsDialog::createSecurityPage(int tx, int ty, int tw, int th)
{
#if defined(HAVE_GNUTLS) || defined(HAVE_NETTLE) || !defined(WIN32)
- Fl_Group *group = new Fl_Group(tx, ty, tw, th, _("Security"));
+ Fl_Scroll *scroll = new Fl_Scroll(tx, ty, tw, th, _("Security"));
+ tw -= Fl::scrollbar_size();
+ Fl_Group *group = new Fl_Scroll(tx, ty, tw, 0);
int orig_tx;
int width;
@@ -828,10 +831,15 @@ void OptionsDialog::createSecurityPage(int tx, int ty, int tw, int th)
tx = orig_tx;
ty += INNER_MARGIN;
-
#endif // !WIN32
+ /* Needed for resize to work sanely */
+ group->resizable(NULL);
+ ty += OUTER_MARGIN - INNER_MARGIN;
+ group->size(group->w(), ty - group->y());
+
group->end();
+ scroll->end();
#endif // defined(HAVE_GNUTLS) || defined(HAVE_NETTLE) || !defined(WIN32)
} |
|
Updated with scrollbars as suggested by @CendioOssman . Thanks! |
|
Sorry about the delay. You are not forgotten, we're just a bit too busy at the moment. Please bear with us a bit more, and we will get this merged eventually. |
|
The options dialog changes are now merged, so please have a look at rebasing this PR so we can focus on just your new additions. |
vncviewer already includes a `-via <ssh_host>` command line option to specify that an SSH tunnel to `<ssh_host>` should be established and VNC traffic routed through the tunnel. However, that option was not available either in the `*.tigervnc` setup files or via the GUI. This adds a `via` (string) parameter to the config file and exposes it to the VNC viewer GUI under the options dialog. In addition, when establishing a tunnel and even before deciding to establish a tunnel, strip leading and trailing whitespace because `ssh " my.host.com "` will indeed fail and if someone manages to get a blank value (only whitespace) into the GUI or the config file it can produce confusing results.
Apply the code suggested by Pierre Ossman to use a scrollbar in the security section of the options dialog instead of growing the size of the dialog.
dfbed39 to
53473dd
Compare
rebased and force pushed |
CendioOssman
left a comment
There was a problem hiding this comment.
Great. I have some minor things that need adjusting, then we can go ahead and merge this.
| /* Connection */ | ||
| ty += GROUP_LABEL_OFFSET; | ||
| // height = GROUP_MARGIN * 2 + (INPUT_LABEL_OFFSET + INPUT_HEIGHT) * 1; | ||
| connectionGroup = new Fl_Group(tx, ty, width, 0, _("Connection")); |
There was a problem hiding this comment.
"Connection" is a bit general, so I think we need something more specific here. "Gateway" is what's used in the documentation, so something including that word would probably be best for consistency.
|
|
||
| static void handleX509(Fl_Widget *widget, void *data); | ||
| static void handleRSAAES(Fl_Widget *widget, void *data); | ||
| static void handleViaHost(Fl_Widget *widget, void *data); |
There was a problem hiding this comment.
This doesn't seem to be used?
There was a problem hiding this comment.
Thanks for catching this. It was there in the original version before your new options work and when I reworked the code I accidentally left this in. I'll remove it.
|
|
||
| #ifndef WIN32 | ||
| StringParameter via("via", "Gateway to tunnel via", ""); | ||
| StringParameter via("via", "SSH host for tunnel", ""); |
There was a problem hiding this comment.
This is an unrelated change, so it should be a separate commit.
The term "Gateway" is also used elsewhere, so everything would need to be adjusted so things are consistent.
Lastly, I'm uncertain if this is clearer. We're gaining the detail of it being SSH, but losing the gateway¹ aspect.
¹ Which is a less common description than "proxy"
There was a problem hiding this comment.
I'll remove this particular change.
| while (*tmps2 != '\0' && !isspace(*tmps2)) tmps2++; | ||
| if (isspace (*tmps2)) *tmps2 = '\0'; | ||
| vlog.info(_("Establish SSH tunnel to gatewayHost \"%s\"\n"), tmps); | ||
|
|
There was a problem hiding this comment.
These are nice improvements, but unrelated to adding the GUI. So please have this as a separate commit.
There was a problem hiding this comment.
Just to make sure I understand before I do it, would you like to see me take the changes (plus your corrections) and break into the GUI part and the non GUI part, re-do the commits and force push to have a more clean history before the merge? I'm happy to do that but wanted to make sure I didn't misunderstand your request.
There was a problem hiding this comment.
Yes, that's precisely right. :)
| if (useSSH && mktunnel() != 0) | ||
| usage(argv[0]); | ||
| strFree(tmps); | ||
| } |
|
|
||
| OptionsDialog::OptionsDialog() | ||
| : Fl_Window(580, 480, _("TigerVNC Options")) | ||
| : Fl_Window(580, 420, _("TigerVNC Options")) |
There was a problem hiding this comment.
Please include this commit into the main one so we can avoid this back and forth.
|
This would be a fantastic feature! Thanks for working on it. PR seems almost done. Any news @dmcmahill to push for the finish line? Question: Would this option be available on Windows? |
|
Unfortunately, it seems this PR is abandoned. :/ |

vncvieweralready includes a-via <ssh_host>command line option tospecify that an SSH tunnel to
<ssh_host>should be established andVNC traffic routed through the tunnel. However, that option was not
available either in the
*.tigervncsetup files or via the GUI.This adds
UseSSH(boolean) andvia(string) parameters to the configfile and exposes them to the VNC viewer GUI under the options dialog.
This shows where I added the option to the GUI:
This shows an example of how the option shows up in a
.tigervncfile: