aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2012-07-05 11:01:23 +0000
committerPierre Ossman <ossman@cendio.se>2012-07-05 11:01:23 +0000
commit9ff733a67281210bf102524d7606c272bacf5cf6 (patch)
tree07f3ceeb7025a48f9d8c1aea7be38e94da82be3b /vncviewer
parent1c2189b084458ab80f8a93c9a99e5cfd5d2682aa (diff)
downloadtigervnc-9ff733a67281210bf102524d7606c272bacf5cf6.tar.gz
tigervnc-9ff733a67281210bf102524d7606c272bacf5cf6.zip
Make DesktopSize configurable from the options dialog.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4928 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'vncviewer')
-rw-r--r--vncviewer/OptionsDialog.cxx55
-rw-r--r--vncviewer/OptionsDialog.h5
2 files changed, 60 insertions, 0 deletions
diff --git a/vncviewer/OptionsDialog.cxx b/vncviewer/OptionsDialog.cxx
index 58f2fd7e..d3ed3334 100644
--- a/vncviewer/OptionsDialog.cxx
+++ b/vncviewer/OptionsDialog.cxx
@@ -271,8 +271,24 @@ void OptionsDialog::loadOptions(void)
menuKeyChoice->value(i + 1);
/* Screen */
+ int width, height;
+
+ if (sscanf(desktopSize.getValueStr(), "%dx%d", &width, &height) != 2) {
+ desktopSizeCheckbox->value(false);
+ desktopWidthInput->value("1024");
+ desktopHeightInput->value("768");
+ } else {
+ char buf[32];
+ desktopSizeCheckbox->value(true);
+ snprintf(buf, sizeof(buf), "%d", width);
+ desktopWidthInput->value(buf);
+ snprintf(buf, sizeof(buf), "%d", height);
+ desktopHeightInput->value(buf);
+ }
fullScreenCheckbox->value(fullScreen);
+ handleDesktopSize(desktopSizeCheckbox, this);
+
/* Misc. */
sharedCheckbox->value(shared);
dotCursorCheckbox->value(dotWhenNoCursor);
@@ -360,6 +376,17 @@ void OptionsDialog::storeOptions(void)
}
/* Screen */
+ int width, height;
+
+ if (desktopSizeCheckbox->value() &&
+ (sscanf(desktopWidthInput->value(), "%d", &width) == 1) &&
+ (sscanf(desktopHeightInput->value(), "%d", &height) == 1)) {
+ char buf[64];
+ snprintf(buf, sizeof(buf), "%dx%d", width, height);
+ desktopSize.setParam(buf);
+ } else {
+ desktopSize.setParam("");
+ }
fullScreen.setParam(fullScreenCheckbox->value());
/* Misc. */
@@ -693,11 +720,26 @@ void OptionsDialog::createInputPage(int tx, int ty, int tw, int th)
void OptionsDialog::createScreenPage(int tx, int ty, int tw, int th)
{
+ int x;
+
Fl_Group *group = new Fl_Group(tx, ty, tw, th, _("Screen"));
tx += OUTER_MARGIN;
ty += OUTER_MARGIN;
+ desktopSizeCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty,
+ CHECK_MIN_WIDTH,
+ CHECK_HEIGHT,
+ _("Resize remote session on connect")));
+ desktopSizeCheckbox->callback(handleDesktopSize, this);
+ ty += CHECK_HEIGHT + TIGHT_MARGIN;
+
+ desktopWidthInput = new Fl_Int_Input(tx + INDENT, ty, 50, INPUT_HEIGHT);
+ x = desktopWidthInput->x() + desktopWidthInput->w() + \
+ gui_str_len("x") + 3 * 2;
+ desktopHeightInput = new Fl_Int_Input(x, ty, 50, INPUT_HEIGHT, "x");
+ ty += INPUT_HEIGHT + TIGHT_MARGIN;
+
fullScreenCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty,
CHECK_MIN_WIDTH,
CHECK_HEIGHT,
@@ -785,6 +827,19 @@ void OptionsDialog::handleX509(Fl_Widget *widget, void *data)
}
+void OptionsDialog::handleDesktopSize(Fl_Widget *widget, void *data)
+{
+ OptionsDialog *dialog = (OptionsDialog*)data;
+
+ if (dialog->desktopSizeCheckbox->value()) {
+ dialog->desktopWidthInput->activate();
+ dialog->desktopHeightInput->activate();
+ } else {
+ dialog->desktopWidthInput->deactivate();
+ dialog->desktopHeightInput->deactivate();
+ }
+}
+
void OptionsDialog::handleCancel(Fl_Widget *widget, void *data)
{
OptionsDialog *dialog = (OptionsDialog*)data;
diff --git a/vncviewer/OptionsDialog.h b/vncviewer/OptionsDialog.h
index d33ecaad..c406a453 100644
--- a/vncviewer/OptionsDialog.h
+++ b/vncviewer/OptionsDialog.h
@@ -59,6 +59,8 @@ protected:
static void handleX509(Fl_Widget *widget, void *data);
+ static void handleDesktopSize(Fl_Widget *widget, void *data);
+
static void handleCancel(Fl_Widget *widget, void *data);
static void handleOK(Fl_Widget *widget, void *data);
@@ -107,6 +109,9 @@ protected:
Fl_Choice *menuKeyChoice;
/* Screen */
+ Fl_Check_Button *desktopSizeCheckbox;
+ Fl_Int_Input *desktopWidthInput;
+ Fl_Int_Input *desktopHeightInput;
Fl_Check_Button *fullScreenCheckbox;
/* Misc. */