X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/47be989f6bee132748c4051577251e72c0b0c045..9bb50fd0b04c824fc7ba14c0dc4ba4a2a9a1e6ad:/src/motif/clipbrd.cpp diff --git a/src/motif/clipbrd.cpp b/src/motif/clipbrd.cpp index 9c09d7ff2b..7b13ed0d2b 100644 --- a/src/motif/clipbrd.cpp +++ b/src/motif/clipbrd.cpp @@ -9,11 +9,23 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation #pragma implementation "clipbrd.h" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __VMS +#include "wx/vms_x_fix.h" +#define XtWindow XTWINDOW +#define XtScreen XTSCREEN +#define XtParent XTPARENT +#define XtIsRealized XTISREALIZED +#define XtDisplay XTDISPLAY +#endif + #include "wx/defs.h" #if wxUSE_CLIPBOARD @@ -27,6 +39,7 @@ #ifdef __VMS__ #pragma message disable nosimpint + #endif #include #include @@ -163,9 +176,16 @@ struct wxDataIdToDataObject WX_DEFINE_LIST(wxDataObjectList); WX_DEFINE_LIST(wxDataIdToDataObjectList); +extern "C" +{ +#if wxCHECK_LESSTIF() +static void wxClipboardCallback( Widget widget, int* data_id, + int* priv, int* reason ); +#else // Motif static void wxClipboardCallback( Widget widget, long* data_id, long* priv, int* reason ); - +#endif // Less/Motif +} IMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject) @@ -181,7 +201,7 @@ wxClipboard::~wxClipboard() void wxClipboard::Clear() { - wxDataObjectList::Node* node = m_data.GetFirst(); + wxDataObjectList::compatibility_iterator node = m_data.GetFirst(); while (node) { delete node->GetData(); @@ -189,9 +209,11 @@ void wxClipboard::Clear() } m_data.Clear(); - for( wxDataIdToDataObjectList::Node* node2 = m_idToObject.GetFirst(); + for( wxDataIdToDataObjectList::compatibility_iterator node2 = m_idToObject.GetFirst(); node2; node2 = node2->GetNext() ) - delete node->GetData(); + { + delete node2->GetData(); + } m_idToObject.Clear(); } @@ -217,15 +239,20 @@ bool wxClipboard::SetData( wxDataObject *data ) wxDECLARE_SCOPED_ARRAY( wxDataFormat, wxDataFormatScopedArray ); wxDEFINE_SCOPED_ARRAY( wxDataFormat, wxDataFormatScopedArray ); +#if wxCHECK_LESSTIF() +void wxClipboardCallback( Widget xwidget, int* data_id, + int* priv, int* reason ) +#else void wxClipboardCallback( Widget xwidget, long* data_id, long* priv, int* reason ) +#endif { Display* xdisplay = XtDisplay( xwidget ); Window xwindow = XtWindow( xwidget ); wxDataObject* dobj = NULL; size_t size = 0; - for( wxDataIdToDataObjectList::Node* node2 = + for( wxDataIdToDataObjectList::compatibility_iterator node2 = wxTheClipboard->m_idToObject.GetFirst(); node2; node2 = node2->GetNext() ) { @@ -261,7 +288,7 @@ bool wxClipboard::AddData( wxDataObject *data ) m_data.Append( data ); Display* xdisplay = wxGlobalDisplay(); - Widget xwidget = (Widget)wxTheApp->GetTopLevelWidget(); + Widget xwidget = (Widget)wxTheApp->GetTopLevelRealizedWidget(); Window xwindow = XtWindow( xwidget ); wxXmString label( wxTheApp->GetAppName() ); Time timestamp = XtLastTimestampProcessed( xdisplay ); @@ -311,7 +338,7 @@ void wxClipboard::Close() bool wxClipboard::IsSupported(const wxDataFormat& format) { Display* xdisplay = wxGlobalDisplay(); - Window xwindow = XtWindow( (Widget)wxTheApp->GetTopLevelWidget() ); + Window xwindow = XtWindow( (Widget)wxTheApp->GetTopLevelRealizedWidget() ); bool isSupported = false; int retval, count; unsigned long max_name_length; @@ -371,7 +398,7 @@ bool wxClipboard::GetData( wxDataObject& data ) wxCHECK_MSG( m_open, false, "clipboard not open" ); Display* xdisplay = wxGlobalDisplay(); - Window xwindow = XtWindow( (Widget)wxTheApp->GetTopLevelWidget() ); + Window xwindow = XtWindow( (Widget)wxTheApp->GetTopLevelRealizedWidget() ); Time timestamp = XtLastTimestampProcessed( xdisplay ); wxDataFormat chosenFormat;