From: Vadim Zeitlin Date: Mon, 23 Jul 2012 15:03:42 +0000 (+0000) Subject: Use __DARWIN__ instead of __WXOSX__ in non-GUI code. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/da0ee16ef9fb566f81f3c1aef9928a3b01394338?hp=6a3f00bd6660d0326904d774d6e7a48a13af1f6f Use __DARWIN__ instead of __WXOSX__ in non-GUI code. This fixes compilation of non-wxOSX ports (e.g. wxGTK) under OS X. Also make the difference between the two symbols more clear in the documentation. Closes #14503. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72180 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/doxygen/mainpages/const_cpp.h b/docs/doxygen/mainpages/const_cpp.h index f3ecc50271..69257230ab 100644 --- a/docs/doxygen/mainpages/const_cpp.h +++ b/docs/doxygen/mainpages/const_cpp.h @@ -42,14 +42,14 @@ always tested using @ifdef_ and not @if_. @itemdef{__WXGTK24__, GTK+ 2.4 or higher} @itemdef{__WXGTK26__, GTK+ 2.6 or higher} @itemdef{__WXGTK210__, GTK+ 2.10 or higher} -@itemdef{__WXMAC__, old define for Mac OS X} +@itemdef{__WXMAC__, old define, same as @c __WXOSX__} @itemdef{__WXMOTIF__, Motif} @itemdef{__WXMOTIF20__, Motif 2.0 or higher} @itemdef{__WXMSW__, GUI using Windows Controls} -@itemdef{__WXOSX__, any OS X} -@itemdef{__WXOSX_IPHONE__, OS X iPhone} +@itemdef{__WXOSX__, OS X GUI using any Apple widget framework (Carbon, AppKit or UIKit)} +@itemdef{__WXOSX_IPHONE__, OS X iPhone (UIKit)} @itemdef{__WXOSX_CARBON__, Mac OS X using Carbon} -@itemdef{__WXOSX_COCOA__, Mac OS X using Cocoa} +@itemdef{__WXOSX_COCOA__, Mac OS X using Cocoa (AppKit)} @itemdef{__WXOSX_MAC__, Mac OS X (Carbon or Cocoa)} @itemdef{__WXOSX_OR_COCOA__, Any Mac OS X port (wxOSX-Carbon, wxOSX-Cocoa or wxCocoa)} @@ -88,7 +88,7 @@ symbols, although this has not always been followed. @itemdef{__AIX__, AIX} @itemdef{__BSD__, Any *BSD system} @itemdef{__CYGWIN__, Cygwin: Unix on Win32} -@itemdef{__DARWIN__, Mac OS X (with BSD C library)} +@itemdef{__DARWIN__, Mac OS X (with BSD C library), using any port (see also @c __WXOSX__)} @itemdef{__DATA_GENERAL__, DG-UX} @itemdef{__FREEBSD__, FreeBSD} @itemdef{__HPUX__, HP-UX (Unix)} diff --git a/include/wx/defs.h b/include/wx/defs.h index f12c460b86..9f5627263c 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -2779,6 +2779,11 @@ typedef int (* LINKAGEMODE wxListIterateFunction)(void *current); /* platform specific (implementation) parts of the headers */ /* --------------------------------------------------------------------------- */ +#ifdef __DARWIN__ +#define DECLARE_WXOSX_OPAQUE_CFREF( name ) typedef struct __##name* name##Ref; +#define DECLARE_WXOSX_OPAQUE_CONST_CFREF( name ) typedef const struct __##name* name##Ref; +#endif + #ifdef __WXMAC__ #define WX_OPAQUE_TYPE( name ) struct wxOpaque##name @@ -2815,9 +2820,6 @@ typedef const void * CFTypeRef; /* typedef const struct __CFString * CFStringRef; */ -#define DECLARE_WXOSX_OPAQUE_CFREF( name ) typedef struct __##name* name##Ref; -#define DECLARE_WXOSX_OPAQUE_CONST_CFREF( name ) typedef const struct __##name* name##Ref; - DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFString ) typedef struct __CFString * CFMutableStringRef; diff --git a/include/wx/evtloop.h b/include/wx/evtloop.h index 1512a852b0..3923c6620e 100644 --- a/include/wx/evtloop.h +++ b/include/wx/evtloop.h @@ -233,7 +233,7 @@ private: // integration with MFC) but currently this is not done for all ports yet (e.g. // wxX11) so fall back to the old wxGUIEventLoop definition below for them -#if defined(__WXOSX__) +#if defined(__DARWIN__) // CoreFoundation-based event loop is currently in wxBase so include it in // any case too (although maybe it actually shouldn't be there at all) #include "wx/osx/evtloop.h" diff --git a/include/wx/evtloopsrc.h b/include/wx/evtloopsrc.h index dd54b9e4a3..0a5d7670cb 100644 --- a/include/wx/evtloopsrc.h +++ b/include/wx/evtloopsrc.h @@ -89,9 +89,11 @@ inline wxEventLoopSource::~wxEventLoopSource() { } #if defined(__WXGTK20__) #include "wx/gtk/evtloopsrc.h" -#elif defined(__WXOSX__) +#endif + +#if defined(__DARWIN__) #include "wx/osx/evtloopsrc.h" -#endif // platform +#endif #endif // wxUSE_EVENTLOOP_SOURCE diff --git a/include/wx/platform.h b/include/wx/platform.h index cdd8b9ce48..7057c77b54 100644 --- a/include/wx/platform.h +++ b/include/wx/platform.h @@ -609,8 +609,7 @@ checking for any OS X port (Carbon and Cocoa) and __WXMAC__ is an old name for it. */ -#if defined(__WXOSX_CARBON__) || defined(__WXOSX_COCOA__) || defined(__WXOSX_IPHONE__) \ - || (defined(__DARWIN__) && !wxUSE_GUI) +#if defined(__WXOSX_CARBON__) || defined(__WXOSX_COCOA__) || defined(__WXOSX_IPHONE__) # ifndef __WXOSX__ # define __WXOSX__ 1 # endif diff --git a/include/wx/thread.h b/include/wx/thread.h index 9b5ab4e2ef..1cc9857b65 100644 --- a/include/wx/thread.h +++ b/include/wx/thread.h @@ -840,7 +840,7 @@ public: #if wxUSE_THREADS -#if defined(__WINDOWS__) || defined(__OS2__) || defined(__EMX__) || defined(__WXOSX__) +#if defined(__WINDOWS__) || defined(__OS2__) || defined(__EMX__) || defined(__DARWIN__) // unlock GUI if there are threads waiting for and lock it back when // there are no more of them - should be called periodically by the main // thread @@ -852,7 +852,7 @@ public: // wakes up the main thread if it's sleeping inside ::GetMessage() extern void WXDLLIMPEXP_BASE wxWakeUpMainThread(); -#ifndef __WXOSX__ +#ifndef __DARWIN__ // return true if the main thread is waiting for some other to terminate: // wxApp then should block all "dangerous" messages extern bool WXDLLIMPEXP_BASE wxIsWaitingForThread(); diff --git a/src/common/mimecmn.cpp b/src/common/mimecmn.cpp index 63ef69d6e6..930f70a31e 100644 --- a/src/common/mimecmn.cpp +++ b/src/common/mimecmn.cpp @@ -48,7 +48,7 @@ // implementation classes: #if defined(__WINDOWS__) #include "wx/msw/mimetype.h" -#elif ( defined(__WXMAC__) ) +#elif ( defined(__DARWIN__) ) #include "wx/osx/mimetype.h" #elif defined(__WXPM__) || defined (__EMX__) #include "wx/os2/mimetype.h" diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 147b3748b5..462c0693dc 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -561,7 +561,7 @@ bool wxGetEnvMap(wxEnvVariableHashMap *map) // Now this routine wil give false for OpenVMS // TODO : should we do something with logicals? char **env=NULL; -#elif defined(__WXOSX__) +#elif defined(__DARWIN__) #if wxOSX_USE_COCOA_OR_CARBON // Under Mac shared libraries don't have access to the global environ // variable so use this Mac-specific function instead as advised by diff --git a/src/unix/threadpsx.cpp b/src/unix/threadpsx.cpp index 1d77856e80..ed33ff33c0 100644 --- a/src/unix/threadpsx.cpp +++ b/src/unix/threadpsx.cpp @@ -1837,7 +1837,7 @@ static void DeleteThread(wxThread *This) } } -#ifndef __WXOSX__ +#ifndef __DARWIN__ void wxMutexGuiEnterImpl() { diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index 6a7fcd27be..a09fb424df 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -992,7 +992,7 @@ wxLinuxDistributionInfo wxGetLinuxDistributionInfo() #endif // these functions are in src/osx/utilsexc_base.cpp for wxMac -#ifndef __WXMAC__ +#ifndef __DARWIN__ wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin) { @@ -1028,7 +1028,7 @@ wxString wxGetOsDescription() return wxGetCommandOutput(wxT("uname -s -r -m")); } -#endif // !__WXMAC__ +#endif // !__DARWIN__ unsigned long wxGetProcessId() {