Revert r3431, it breaks the clipboard on Windows and is in fact also incorrect usage of the primary selection in X11 context. (I have never heard of anyone claiming clipboard usage not working on X11 before.)

This comment is in `include/wx/clipbrd.h`:
{{{
    // this allows to choose whether we work with CLIPBOARD (default) or
    // PRIMARY selection on X11-based systems
    //
    // on the other ones, working with primary selection does nothing: this
    // allows to write code which sets the primary selection when something is
    // selected without any ill effects (i.e. without overwriting the
    // clipboard which would be wrong on the platforms without X11 PRIMARY)
}}}
Note that it says that primary selection enabled causes the clipboard to do nothing on platforms that have no concept of primary selection, such as Windows and Mac.

On X11 the primary selection should only reflect an active selection of text (or similar) that the user has performed, and the contents of the primary selection buffer will essentially change all the time as the user changes selection. When the user chooses to explicitly copy something to the clipboard (as is the case with Aegisub, the only operation supported by us currently) the data is placed in a less ephemeral buffer which is the actual clipboard, separate from the primary selection, allowing the user to change the primary selection further without affecting the clipboard.

Originally committed to SVN as r3443.
This commit is contained in:
Niels Martin Hansen 2009-08-28 21:45:01 +00:00
parent b1225cdd1f
commit 64c642c142
6 changed files with 0 additions and 6 deletions

View file

@ -1483,7 +1483,6 @@ 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,7 +723,6 @@ 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,7 +438,6 @@ 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,7 +976,6 @@ 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,7 +388,6 @@ 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,7 +682,6 @@ 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();
} }