From 64c642c1420af343dbfb5c0b857977da989cfbff Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Fri, 28 Aug 2009 21:45:01 +0000 Subject: [PATCH] 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. --- aegisub/src/dialog_colorpicker.cpp | 1 - aegisub/src/dialog_style_manager.cpp | 1 - aegisub/src/frame_main_events.cpp | 1 - aegisub/src/subs_grid.cpp | 1 - aegisub/src/timeedit_ctrl.cpp | 1 - aegisub/src/video_display.cpp | 1 - 6 files changed, 6 deletions(-) diff --git a/aegisub/src/dialog_colorpicker.cpp b/aegisub/src/dialog_colorpicker.cpp index 0c06579ee..0eecd890f 100644 --- a/aegisub/src/dialog_colorpicker.cpp +++ b/aegisub/src/dialog_colorpicker.cpp @@ -1483,7 +1483,6 @@ void DialogColorPicker::OnRGBAdjust(wxCommandEvent &evt) wxString data = wxString(_T("rgbadjust(")) + PrettyFloatD(r) + _T(",") + PrettyFloatD(g) + _T(",") + PrettyFloatD(b) + _T(")"); if (wxTheClipboard->Open()) { - wxTheClipboard->UsePrimarySelection(true); wxTheClipboard->SetData(new wxTextDataObject(data)); wxTheClipboard->Close(); } diff --git a/aegisub/src/dialog_style_manager.cpp b/aegisub/src/dialog_style_manager.cpp index 41fd49825..42b21150d 100644 --- a/aegisub/src/dialog_style_manager.cpp +++ b/aegisub/src/dialog_style_manager.cpp @@ -723,7 +723,6 @@ void DialogStyleManager::CopyToClipboard (wxListBox *list, std::vectorOpen()) { - wxTheClipboard->UsePrimarySelection(true); wxTheClipboard->SetData(new wxTextDataObject(data)); wxTheClipboard->Close(); } diff --git a/aegisub/src/frame_main_events.cpp b/aegisub/src/frame_main_events.cpp index eb8f5c2f6..e96f84a86 100644 --- a/aegisub/src/frame_main_events.cpp +++ b/aegisub/src/frame_main_events.cpp @@ -438,7 +438,6 @@ void FrameMain::OnMenuOpen (wxMenuEvent &event) { bool can_paste = true; if (wxTheClipboard->Open()) { - wxTheClipboard->UsePrimarySelection(true); can_paste = wxTheClipboard->IsSupported(wxDF_TEXT); wxTheClipboard->Close(); } diff --git a/aegisub/src/subs_grid.cpp b/aegisub/src/subs_grid.cpp index efd1c36ed..7e89b8697 100644 --- a/aegisub/src/subs_grid.cpp +++ b/aegisub/src/subs_grid.cpp @@ -976,7 +976,6 @@ void SubtitlesGrid::CopyLines(wxArrayInt target) { // Send to clipboard if (wxTheClipboard->Open()) { - wxTheClipboard->UsePrimarySelection(true); wxTheClipboard->SetData(new wxTextDataObject(data)); wxTheClipboard->Close(); } diff --git a/aegisub/src/timeedit_ctrl.cpp b/aegisub/src/timeedit_ctrl.cpp index b8c568646..cafc319b8 100644 --- a/aegisub/src/timeedit_ctrl.cpp +++ b/aegisub/src/timeedit_ctrl.cpp @@ -388,7 +388,6 @@ void TimeEdit::CopyTime() { // Time if (wxTheClipboard->Open()) { - wxTheClipboard->UsePrimarySelection(true); wxTheClipboard->SetData(new wxTextDataObject(GetStringSelection())); wxTheClipboard->Close(); } diff --git a/aegisub/src/video_display.cpp b/aegisub/src/video_display.cpp index 89850dcc5..81dc906c9 100644 --- a/aegisub/src/video_display.cpp +++ b/aegisub/src/video_display.cpp @@ -682,7 +682,6 @@ void VideoDisplay::UpdateSubsRelativeTime() { /// void VideoDisplay::OnCopyToClipboard(wxCommandEvent &event) { if (wxTheClipboard->Open()) { - wxTheClipboard->UsePrimarySelection(true); wxTheClipboard->SetData(new wxBitmapDataObject(wxBitmap(VideoContext::Get()->GetFrame(-1).GetImage(),24))); wxTheClipboard->Close(); }