]> source.dussan.org Git - tigervnc.git/commitdiff
Disable checkboxes for primary selection when relevant
authorPierre Ossman <ossman@cendio.se>
Mon, 2 Jan 2017 11:56:04 +0000 (12:56 +0100)
committerPierre Ossman <ossman@cendio.se>
Mon, 2 Jan 2017 11:56:04 +0000 (12:56 +0100)
vncviewer/OptionsDialog.cxx
vncviewer/OptionsDialog.h

index 2f9df9c4013199638f7861065c48301ad3f0819a..b018c95bcd3b15b048213029f23b3f014c8101ce 100644 (file)
@@ -700,6 +700,7 @@ void OptionsDialog::createInputPage(int tx, int ty, int tw, int th)
                                                          CHECK_MIN_WIDTH,
                                                          CHECK_HEIGHT,
                                                          _("Accept clipboard from server")));
+  acceptClipboardCheckbox->callback(handleClipboard, this);
   ty += CHECK_HEIGHT + TIGHT_MARGIN;
 
 #if !defined(WIN32) && !defined(__APPLE__)
@@ -714,10 +715,11 @@ void OptionsDialog::createInputPage(int tx, int ty, int tw, int th)
                                                        CHECK_MIN_WIDTH,
                                                        CHECK_HEIGHT,
                                                        _("Send clipboard to server")));
+  sendClipboardCheckbox->callback(handleClipboard, this);
   ty += CHECK_HEIGHT + TIGHT_MARGIN;
 
 #if !defined(WIN32) && !defined(__APPLE__)
-  sendPrimaryCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty,
+  sendPrimaryCheckbox = new Fl_Check_Button(LBLRIGHT(tx + INDENT, ty,
                                                      CHECK_MIN_WIDTH,
                                                      CHECK_HEIGHT,
                                                      _("Send primary selection as clipboard")));
@@ -876,6 +878,22 @@ void OptionsDialog::handleDesktopSize(Fl_Widget *widget, void *data)
   }
 }
 
+void OptionsDialog::handleClipboard(Fl_Widget *widget, void *data)
+{
+#if !defined(WIN32) && !defined(__APPLE__)
+  OptionsDialog *dialog = (OptionsDialog*)data;
+
+  if (dialog->acceptClipboardCheckbox->value())
+    dialog->setPrimaryCheckbox->activate();
+  else
+    dialog->setPrimaryCheckbox->deactivate();
+  if (dialog->sendClipboardCheckbox->value())
+    dialog->sendPrimaryCheckbox->activate();
+  else
+    dialog->sendPrimaryCheckbox->deactivate();
+#endif
+}
+
 void OptionsDialog::handleCancel(Fl_Widget *widget, void *data)
 {
   OptionsDialog *dialog = (OptionsDialog*)data;
index 6984c72f7c39f630f39719a0004152eb4983a813..c1775607fb39283bb07329a0eb0da734f8983b42 100644 (file)
@@ -64,6 +64,8 @@ protected:
 
   static void handleDesktopSize(Fl_Widget *widget, void *data);
 
+  static void handleClipboard(Fl_Widget *widget, void *data);
+
   static void handleCancel(Fl_Widget *widget, void *data);
   static void handleOK(Fl_Widget *widget, void *data);