I am not sure if I am doing something exceedingly stupid but my calls to the clipboard have ceased working since 3.1.3. I stepped into the code and it all works at the lower levels (wxClipboard::AddData returns true). This worked under 3.1.2, which I built on macOS 10.12.6 Sierra with the following configure:
configure --disable-shared --enable-unicode --prefix="$(pwd)" --enable-ipc --enable-base64 --enable-exceptions --enable-fontenum --enable-fs_archive --enable-stdpaths --enable-sysoptions --enable-threads --enable-url --enable-aui --enable-graphics_ctx --enable-printarch --enable-timer --enable-ribbon --enable-webview --enable-display --enable-splash --enable-snglinst --enable-printfposparam --with-opengl --with-osx_cocoa --with-expat=builtin --with-cxx=11 --enable-cxx11 --enable-stl --enable-std_iostreams --enable-std_string --enable-ftp --enable-http --enable-fileproto --enable-sockets --enable-ipv6 --enable-dataobj --enable-ipc --enable-any --enable-arcstream --enable-backtrace --enable-cmdline --enable-datetime --enable-debugreport --enable-dynamicloader --enable-exceptions --enable-ffile --enable-file --enable-filehistory --enable-filesystem --enable-fontmap --enable-fs_inet --enable-fs_zip --enable-fsvolume --enable-fswatcher --enable-geometry --enable-sound --enable-stopwatch --enable-streams --enable-tarstream --enable-textbuf --enable-textfile --enable-variant --enable-zipstream --enable-protocol --enable-protocol-http --enable-protocol-ftp --enable-protocol-file --enable-html --enable-htmlhelp --enable-propgrid --enable-svg --enable-clipboard --enable-dnd --enable-accel --with-osx_cocoa --disable-debug_flag --with-libpng=builtin --with-libjpeg=builtin --with-zlib=builtin
I know that the base SDK has moved from what it used to be (10.4?) to (10.9) and I do not explicitly specify it so I am going along with the defaults for 3.1.3.
For wxWidgets 3.1.3 under the same system I built with the following configure options:
configure --disable-shared --enable-unicode --prefix="$(pwd)" --enable-stc --enable-ipc --enable-base64 --enable-exceptions --enable-fontenum --enable-fs_archive --enable-stdpaths --enable-sysoptions --enable-threads --enable-url --enable-aui --enable-graphics_ctx --enable-printarch --enable-timer --enable-ribbon --enable-webview --enable-display --enable-splash --enable-snglinst --enable-printfposparam --with-opengl --with-osx_cocoa --with-expat=builtin --with-cxx=11 --enable-cxx11 --enable-stl --enable-std_iostreams --enable-std_string --enable-ftp --enable-http --enable-fileproto --enable-sockets --enable-ipv6 --enable-dataobj --enable-ipc --enable-any --enable-arcstream --enable-backtrace --enable-cmdline --enable-datetime --enable-debugreport --enable-dynamicloader --enable-exceptions --enable-ffile --enable-file --enable-filehistory --enable-filesystem --enable-fontmap --enable-fs_inet --enable-fs_zip --enable-fsvolume --enable-fswatcher --enable-geometry --enable-sound --enable-stopwatch --enable-streams --enable-tarstream --enable-textbuf --enable-textfile --enable-variant --enable-zipstream --enable-protocol --enable-protocol-http --enable-protocol-ftp --enable-protocol-file --enable-html --enable-htmlhelp --enable-propgrid --enable-svg --enable-clipboard --enable-dnd --enable-accel --with-osx_cocoa --disable-debug_flag --with-libpng=builtin --with-libjpeg=builtin --with-zlib=builtin --with-libtiff=builtin
I have written a sample test application to test this and the clipboard seems defunct. If I use the clipboard sample the paste button is disabled.
Here's a test application:
#include <wx/wx.h>
#include <wx/app.h>
#include <wx/clipbrd.h>
class MainFrame : public wxFrame
{
protected:
wxStaticText* label;
public:
MainFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL )
: wxFrame(parent, id, title, pos, size, style)
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL );
label = new wxStaticText( this, wxID_ANY, wxT("<pasted text should go here>"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT|wxST_NO_AUTORESIZE );
label->Wrap( -1 );
bSizer1->Add( label, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
this->SetSizer( bSizer1 );
this->Layout();
this->Centre( wxBOTH );
if (wxTheClipboard->Open())
{
wxTheClipboard->SetData(new wxTextDataObject("Hello this is pasted text"));
wxTheClipboard->Close();
}
if (wxTheClipboard->Open())
{
if (wxTheClipboard->IsSupported( wxDF_TEXT ))
{
wxTextDataObject data;
wxTheClipboard->GetData(data);
label->SetLabel(data.GetText());
}
wxTheClipboard->Close();
}
}
virtual ~MainFrame() { }
};
class demoApp: public wxApp
{
MainFrame *frame = nullptr;
public:
demoApp();
virtual ~demoApp() { }
virtual bool OnInit() override;
};
IMPLEMENT_APP(demoApp)
//#include <ApplicationServices/ApplicationServices.h>
demoApp::demoApp()
{
//ProcessSerialNumber PSN;
//GetCurrentProcess(&PSN);
//TransformProcessType(&PSN,kProcessTransformToForegroundApplication);
}
bool demoApp::OnInit()
{
frame = new MainFrame(nullptr);
frame->Show();
SetTopWindow(frame);
SetExitOnFrameDelete(true);
return true;
}
You can build that with something like
g++ clipboard.cpp -o clipboard -std=gnu++11 -I/DeveloperLibs/wxWidgets-3.1.3/build-debug/lib/wx/include/osx_cocoa-unicode-static-3.1/ -I/DeveloperLibs/wxWidgets-3.1.3/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__ -D_DEBUG=1-stdlib=libc++ -L/DeveloperLibs/wxWidgets-3.1.3/build-debug/lib/ -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -lwx_baseu-3.1 -lwx_osx_cocoau_adv-3.1 -lwx_osx_cocoau_core-3.1 -liconv -lz -headerpad_max_install_names -lwxregexu-3.1 -lwx_osx_cocoau_qa-3.1 -framework Quartz -lwx_baseu_xml-3.1 -lwxjpeg-3.1 -lwxpng-3.1 -lwxzlib-3.1 -lwxexpat-3.1 -lwxtiff-3.1 -llzma
I can't see anything wrong with it at all?? I should note that the same application fails to work under Mojave (with the binary from the Sierra system, or even with the binary built under Mojave using the wxWidgets on my Mojave system).
Yes, unfortunately copying to clipboard got broken shortly before 3.1.3 release. It was fixed soon after it in this commit that you should be able to cherry-pick locally -- or you could just update to the latest master.