Revision: 4928
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4928&view=rev
Author:   ossman_
Date:     2012-07-05 11:01:23 +0000 (Thu, 05 Jul 2012)
Log Message:
-----------
Make DesktopSize configurable from the options dialog.

Modified Paths:
--------------
    trunk/vncviewer/OptionsDialog.cxx
    trunk/vncviewer/OptionsDialog.h

Modified: trunk/vncviewer/OptionsDialog.cxx
===================================================================
--- trunk/vncviewer/OptionsDialog.cxx   2012-07-05 09:23:03 UTC (rev 4927)
+++ trunk/vncviewer/OptionsDialog.cxx   2012-07-05 11:01:23 UTC (rev 4928)
@@ -271,8 +271,24 @@
       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 @@
   }
 
   /* 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::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::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;

Modified: trunk/vncviewer/OptionsDialog.h
===================================================================
--- trunk/vncviewer/OptionsDialog.h     2012-07-05 09:23:03 UTC (rev 4927)
+++ trunk/vncviewer/OptionsDialog.h     2012-07-05 11:01:23 UTC (rev 4928)
@@ -59,6 +59,8 @@
 
   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 @@
   Fl_Choice *menuKeyChoice;
 
   /* Screen */
+  Fl_Check_Button *desktopSizeCheckbox;
+  Fl_Int_Input *desktopWidthInput;
+  Fl_Int_Input *desktopHeightInput;
   Fl_Check_Button *fullScreenCheckbox;
 
   /* Misc. */

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Tigervnc-commits mailing list
Tigervnc-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits

Reply via email to