Improve macOS/iOS chkconf.h headers handling

Include these headers when compiling for the corresponding platform
rather than using the default GUI toolkit for the platform to ensure
that the relevant features are correctly enabled or disabled when using
wxBase without any toolkit.

Also move the non-GUI symbols to the beginning of the file and put
wxUSE_GUI guard against the rest just to keep things tidy and avoid
defining GUI-specific symbols when not using GUI.

Finally, also improve (hopefully?) things for wxGTK under macOS by
including GTK-specific chkconf.h too under this platform, just as we
already did under Windows.
This commit is contained in:
Vadim Zeitlin
2026-01-07 14:37:58 +01:00
parent cafa693da0
commit e2e4ff2df9
4 changed files with 33 additions and 28 deletions

View File

@@ -1263,12 +1263,7 @@
#if defined(__WINDOWS__)
# include "wx/msw/chkconf.h"
# if defined(__WXGTK__)
# include "wx/gtk/chkconf.h"
# endif
#elif defined(__WXGTK__)
# include "wx/gtk/chkconf.h"
#elif defined(__WXMAC__)
#elif defined(__DARWIN__)
# include "wx/osx/chkconf.h"
#elif defined(__WXDFB__)
# include "wx/dfb/chkconf.h"
@@ -1278,6 +1273,12 @@
# include "wx/android/chkconf.h"
#endif
/* Note that __WXGTK__ may be defined under Windows and Mac if we're using
the wxGTK port there, so do NOT use #elif for it. */
#if defined(__WXGTK__)
# include "wx/gtk/chkconf.h"
#endif
/*
__UNIX__ is also defined under Cygwin but we shouldn't perform these checks
there if we're building Windows ports.

View File

@@ -72,9 +72,9 @@
#define wxOSX_USE_COCOA_OR_IPHONE 0
#endif
#if wxOSX_USE_IPHONE
#ifdef __WXDARWIN_IPHONE__
#include "wx/osx/iphone/chkconf.h"
#elif wxOSX_USE_COCOA
#elif defined(__WXDARWIN_OSX__)
#include "wx/osx/cocoa/chkconf.h"
#endif

View File

@@ -11,6 +11,15 @@
#ifndef _WX_OSX_COCOA_CHKCONF_H_
#define _WX_OSX_COCOA_CHKCONF_H_
/*
Use the more efficient FSEvents API instead of kqueue
events for file system watcher since that version introduced a flag that
allows watching files as well as sub directories.
*/
#define wxHAVE_FSEVENTS_FILE_NOTIFICATIONS 1
#if wxUSE_GUI
/*
* native (1) or emulated (0) toolbar
*/
@@ -33,13 +42,6 @@
#define wxOSX_USE_QUICKTIME 0
#define wxOSX_USE_AUDIOTOOLBOX 1
/*
Use the more efficient FSEvents API instead of kqueue
events for file system watcher since that version introduced a flag that
allows watching files as well as sub directories.
*/
#define wxHAVE_FSEVENTS_FILE_NOTIFICATIONS 1
/*
* turn off old style icon format if not asked for
*/
@@ -47,9 +49,7 @@
#define wxOSX_USE_ICONREF 0
#endif
/*
* turning off capabilities that don't work under cocoa yet
*/
#endif // wxUSE_GUI
#endif
/* _WX_MAC_CHKCONF_H_ */

View File

@@ -11,6 +11,18 @@
#ifndef _WX_OSX_IPHONE_CHKCONF_H_
#define _WX_OSX_IPHONE_CHKCONF_H_
#if wxUSE_MIMETYPE
#undef wxUSE_MIMETYPE
#define wxUSE_MIMETYPE 0
#endif
#if wxUSE_SECRETSTORE
#undef wxUSE_SECRETSTORE
#define wxUSE_SECRETSTORE 0
#endif
#if wxUSE_GUI
/*
* text rendering system
*/
@@ -28,11 +40,6 @@
* turning off capabilities that don't work under iphone yet
*/
#if wxUSE_MIMETYPE
#undef wxUSE_MIMETYPE
#define wxUSE_MIMETYPE 0
#endif
#if wxUSE_MDI
#undef wxUSE_MDI
#define wxUSE_MDI 0
@@ -355,16 +362,13 @@
#define wxUSE_WEBVIEW 0
#endif
#if wxUSE_SECRETSTORE
#undef wxUSE_SECRETSTORE
#define wxUSE_SECRETSTORE 0
#endif
// IconRef datatype does not exist on iOS
#undef wxOSX_USE_ICONREF
#define wxOSX_USE_ICONREF 0
#endif // wxUSE_GUI
#endif
/* _WX_OSX_IPHONE_CHKCONF_H_ */