mgr(gtk): use correct clipboard when copying text

X11 has two clipboards, CLIPBOARD and PRIMARY. CLIPBOARD is used for
copy-paste operations in the same manner as in other GUI environments.
PRIMARY is used for text selections. Any selected text is automatically
copied to PRIMARY and can be pasted with mouse middle click.

wxClipboard is used to access both clipboard types. wxClipboard
remembers which clipboard was last used and continues to use it until it
is told otherwise. So when user selects text somewhere in Manager
wxClipboard is set to access PRIMARY. When user later clicks Copy button
in Properties dialog or in Event Log the text goes to PRIMARY against
user's expectations.

Fix this by telling wxClipboard to use CLIPBOARD in Properties dialog
and Event Log Copy buttons.
This commit is contained in:
Juha Sointusalo 2018-02-02 22:54:45 +02:00
parent 422aba5fde
commit b0f6783c94
2 changed files with 6 additions and 0 deletions

View File

@ -1073,6 +1073,9 @@ bool CDlgEventLog::OpenClipboard( wxInt32 size ) {
m_strClipboardData = wxEmptyString;
m_strClipboardData.Alloc( size );
#if defined(__WXGTK__) || defined(__WXQT__)
wxTheClipboard->UsePrimarySelection(false);
#endif
wxTheClipboard->Clear();
}

View File

@ -575,6 +575,9 @@ void CDlgItemProperties::addProperty(const wxString& name, const wxString& value
void CDlgItemProperties::copyTextToClipboard(const wxString& text) {
if (wxTheClipboard->Open()) {
#if defined(__WXGTK__) || defined(__WXQT__)
wxTheClipboard->UsePrimarySelection(false);
#endif
wxTheClipboard->Clear();
wxTheClipboard->SetData(new wxTextDataObject(text));
wxTheClipboard->Close();