Call wxTheClipboard->UsePrimarySelection(true) when using wxClipboard, without getting into detail clipboard work very differently on X11. Without calling this copying to the clipboard won't work. I've just put it after every use of ->Open, this is safe as in every case Close() is called right after. This will fix clipboard copying on all unices.

Originally committed to SVN as r3431.
This commit is contained in:
Amar Takhar 2009-08-20 02:31:33 +00:00
parent 50d9dbd4f1
commit f5a9af6a6c
6 changed files with 6 additions and 0 deletions

View File

@ -1483,6 +1483,7 @@ void DialogColorPicker::OnRGBAdjust(wxCommandEvent &evt)
wxString data = wxString(_T("rgbadjust(")) + PrettyFloatD(r) + _T(",") + PrettyFloatD(g) + _T(",") + PrettyFloatD(b) + _T(")"); wxString data = wxString(_T("rgbadjust(")) + PrettyFloatD(r) + _T(",") + PrettyFloatD(g) + _T(",") + PrettyFloatD(b) + _T(")");
if (wxTheClipboard->Open()) { if (wxTheClipboard->Open()) {
wxTheClipboard->UsePrimarySelection(true);
wxTheClipboard->SetData(new wxTextDataObject(data)); wxTheClipboard->SetData(new wxTextDataObject(data));
wxTheClipboard->Close(); wxTheClipboard->Close();
} }

View File

@ -723,6 +723,7 @@ void DialogStyleManager::CopyToClipboard (wxListBox *list, std::vector<AssStyle*
} }
if (wxTheClipboard->Open()) { if (wxTheClipboard->Open()) {
wxTheClipboard->UsePrimarySelection(true);
wxTheClipboard->SetData(new wxTextDataObject(data)); wxTheClipboard->SetData(new wxTextDataObject(data));
wxTheClipboard->Close(); wxTheClipboard->Close();
} }

View File

@ -438,6 +438,7 @@ void FrameMain::OnMenuOpen (wxMenuEvent &event) {
bool can_paste = true; bool can_paste = true;
if (wxTheClipboard->Open()) { if (wxTheClipboard->Open()) {
wxTheClipboard->UsePrimarySelection(true);
can_paste = wxTheClipboard->IsSupported(wxDF_TEXT); can_paste = wxTheClipboard->IsSupported(wxDF_TEXT);
wxTheClipboard->Close(); wxTheClipboard->Close();
} }

View File

@ -976,6 +976,7 @@ void SubtitlesGrid::CopyLines(wxArrayInt target) {
// Send to clipboard // Send to clipboard
if (wxTheClipboard->Open()) { if (wxTheClipboard->Open()) {
wxTheClipboard->UsePrimarySelection(true);
wxTheClipboard->SetData(new wxTextDataObject(data)); wxTheClipboard->SetData(new wxTextDataObject(data));
wxTheClipboard->Close(); wxTheClipboard->Close();
} }

View File

@ -388,6 +388,7 @@ void TimeEdit::CopyTime() {
// Time // Time
if (wxTheClipboard->Open()) { if (wxTheClipboard->Open()) {
wxTheClipboard->UsePrimarySelection(true);
wxTheClipboard->SetData(new wxTextDataObject(GetStringSelection())); wxTheClipboard->SetData(new wxTextDataObject(GetStringSelection()));
wxTheClipboard->Close(); wxTheClipboard->Close();
} }

View File

@ -682,6 +682,7 @@ void VideoDisplay::UpdateSubsRelativeTime() {
/// ///
void VideoDisplay::OnCopyToClipboard(wxCommandEvent &event) { void VideoDisplay::OnCopyToClipboard(wxCommandEvent &event) {
if (wxTheClipboard->Open()) { if (wxTheClipboard->Open()) {
wxTheClipboard->UsePrimarySelection(true);
wxTheClipboard->SetData(new wxBitmapDataObject(wxBitmap(VideoContext::Get()->GetFrame(-1).GetImage(),24))); wxTheClipboard->SetData(new wxBitmapDataObject(wxBitmap(VideoContext::Get()->GetFrame(-1).GetImage(),24)));
wxTheClipboard->Close(); wxTheClipboard->Close();
} }