Browse Source

Add option to set primary selection for cut text

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.
tags/v1.6.90
Pierre Ossman 8 years ago
parent
commit
f862c2e8f4

+ 2
- 1
vncviewer/CConn.cxx View 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;

+ 14
- 0
vncviewer/OptionsDialog.cxx View 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,

+ 3
- 0
vncviewer/OptionsDialog.h View 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;

+ 3
- 0
vncviewer/parameters.cxx View 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__)

+ 1
- 0
vncviewer/parameters.h View 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;

+ 5
- 0
vncviewer/vncviewer.man View 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.
.

Loading…
Cancel
Save