]> source.dussan.org Git - tigervnc.git/commitdiff
Add option to set primary selection for cut text
authorPierre Ossman <ossman@cendio.se>
Tue, 29 Mar 2016 12:15:38 +0000 (14:15 +0200)
committerPierre Ossman <ossman@cendio.se>
Tue, 29 Mar 2016 12:15:38 +0000 (14:15 +0200)
Previously the incoming clipboard was unconditionally set to both
the PRIMARY and CLIPBOARD selection. This isn't always what the
user want, so make it configurable.

vncviewer/CConn.cxx
vncviewer/OptionsDialog.cxx
vncviewer/OptionsDialog.h
vncviewer/parameters.cxx
vncviewer/parameters.h
vncviewer/vncviewer.man

index 262dd2ce05cd78a9a00b7c8007619e6198660460..140b1d657821da2a87b47cfc28015b7435362f21 100644 (file)
@@ -439,7 +439,8 @@ void CConn::serverCutText(const char* str, rdr::U32 len)
 
   // RFB doesn't have separate selection and clipboard concepts, so we
   // dump the data into both variants.
-  Fl::copy(buffer, ret, 0);
+  if (setPrimary)
+    Fl::copy(buffer, ret, 0);
   Fl::copy(buffer, ret, 1);
 
   delete [] buffer;
index f112a529531936a44cc2c59c1417e4762177b356..55a366f1a24866a3324b9ed65a514ac5d4c9fb7d 100644 (file)
@@ -263,6 +263,9 @@ void OptionsDialog::loadOptions(void)
 
   viewOnlyCheckbox->value(viewOnly);
   acceptClipboardCheckbox->value(acceptClipboard);
+#if !defined(WIN32) && !defined(__APPLE__)
+  setPrimaryCheckbox->value(setPrimary);
+#endif
   sendClipboardCheckbox->value(sendClipboard);
 #if !defined(WIN32) && !defined(__APPLE__)
   sendPrimaryCheckbox->value(sendPrimary);
@@ -373,6 +376,9 @@ void OptionsDialog::storeOptions(void)
   /* Input */
   viewOnly.setParam(viewOnlyCheckbox->value());
   acceptClipboard.setParam(acceptClipboardCheckbox->value());
+#if !defined(WIN32) && !defined(__APPLE__)
+  setPrimary.setParam(setPrimaryCheckbox->value());
+#endif
   sendClipboard.setParam(sendClipboardCheckbox->value());
 #if !defined(WIN32) && !defined(__APPLE__)
   sendPrimary.setParam(sendPrimaryCheckbox->value());
@@ -696,6 +702,14 @@ void OptionsDialog::createInputPage(int tx, int ty, int tw, int th)
                                                          _("Accept clipboard from server")));
   ty += CHECK_HEIGHT + TIGHT_MARGIN;
 
+#if !defined(WIN32) && !defined(__APPLE__)
+  setPrimaryCheckbox = new Fl_Check_Button(LBLRIGHT(tx + INDENT, ty,
+                                                    CHECK_MIN_WIDTH,
+                                                    CHECK_HEIGHT,
+                                                    _("Also set primary selection")));
+  ty += CHECK_HEIGHT + TIGHT_MARGIN;
+#endif
+
   sendClipboardCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty,
                                                        CHECK_MIN_WIDTH,
                                                        CHECK_HEIGHT,
index 39bd7afa633fe77529ede44938c4540e620d58f1..6984c72f7c39f630f39719a0004152eb4983a813 100644 (file)
@@ -106,6 +106,9 @@ protected:
   /* Input */
   Fl_Check_Button *viewOnlyCheckbox;
   Fl_Check_Button *acceptClipboardCheckbox;
+#if !defined(WIN32) && !defined(__APPLE__)
+  Fl_Check_Button *setPrimaryCheckbox;
+#endif
   Fl_Check_Button *sendClipboardCheckbox;
 #if !defined(WIN32) && !defined(__APPLE__)
   Fl_Check_Button *sendPrimaryCheckbox;
index 9a9b9fd75753910c1ce8a5a8cae4fc276a8457b8..1151a7c8e30e1a8d17205258d4bae9fb81549181 100644 (file)
@@ -120,6 +120,9 @@ BoolParameter shared("Shared",
 BoolParameter acceptClipboard("AcceptClipboard",
                               "Accept clipboard changes from the server",
                               true);
+BoolParameter setPrimary("SetPrimary",
+                         "Set the primary selection as well as the "
+                         "clipboard selection", true);
 BoolParameter sendClipboard("SendClipboard",
                             "Send clipboard changes to the server", true);
 #if !defined(WIN32) && !defined(__APPLE__)
index e4378c85e604892ad10aa6a2c6f7f48601b91975..682b6d698a36350fb3dd9c179471a1b76d02146b 100644 (file)
@@ -51,6 +51,7 @@ extern rfb::BoolParameter viewOnly;
 extern rfb::BoolParameter shared;
 
 extern rfb::BoolParameter acceptClipboard;
+extern rfb::BoolParameter setPrimary;
 extern rfb::BoolParameter sendClipboard;
 #if !defined(WIN32) && !defined(__APPLE__)
 extern rfb::BoolParameter sendPrimary;
index 5dd3b45341505c0cb1c1ed388a18559a9879aeee..4b92b61174d37649ed34dba47b148a0e8329f4be 100644 (file)
@@ -153,6 +153,11 @@ combined with
 Accept clipboard changes from the server. Default is on.
 .
 .TP
+.B \-SetPrimary
+Set the primary selection as well as the clipboard selection.
+Default is on.
+.
+.TP
 .B \-SendClipboard
 Send clipboard changes to the server. Default is on.
 .