From b0f6783c94b5cdd62da78dffccf53de18c607914 Mon Sep 17 00:00:00 2001 From: Juha Sointusalo Date: Fri, 2 Feb 2018 22:54:45 +0200 Subject: [PATCH] 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. --- clientgui/DlgEventLog.cpp | 3 +++ clientgui/DlgItemProperties.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/clientgui/DlgEventLog.cpp b/clientgui/DlgEventLog.cpp index b7985f54af..a1ce833fd8 100644 --- a/clientgui/DlgEventLog.cpp +++ b/clientgui/DlgEventLog.cpp @@ -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(); } diff --git a/clientgui/DlgItemProperties.cpp b/clientgui/DlgItemProperties.cpp index b7550febe1..0f19a0913d 100644 --- a/clientgui/DlgItemProperties.cpp +++ b/clientgui/DlgItemProperties.cpp @@ -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();