#endif
-#define USE_ASYNCHRONOUS_CLIPBOARD_REQUEST 0
+#define USE_ASYNCHRONOUS_CLIPBOARD_REQUEST 1
class MyApp : public wxApp
{
#if USE_ASYNCHRONOUS_CLIPBOARD_REQUEST
if (m_request == Idle)
{
- wxTheClipboard->IsSupportedAsync( this );
+ if (!wxTheClipboard->IsSupportedAsync( this ))
+ {
+ // request failed, try again later
+ event.Enable( m_clipboardSupportsText ); // not yet known, assume last value
+ return;
+ }
m_request = Waiting;
event.Enable( m_clipboardSupportsText ); // not yet known, assume last value
}
if ( !selection_data || selection_data->length <= 0 )
{
clipboard->m_sink->QueueEvent( event );
+ clipboard->m_sink.Release();
return;
}
_T("got unsupported clipboard target") );
clipboard->m_sink->QueueEvent( event );
+ clipboard->m_sink.Release();
return;
}
}
}
clipboard->m_sink->QueueEvent( event );
+ clipboard->m_sink.Release();
}
}
bool wxClipboard::IsSupportedAsync(wxEvtHandler *sink)
{
+ if (m_sink.get())
+ return false; // currently busy, come back later
+
+ wxCHECK_MSG( sink, false, wxT("no sink given") );
+
m_sink = sink;
-
gtk_selection_convert( m_targetsWidgetAsync,
GTKGetClipboardAtom(),
g_targetsAtom,